bug: adapt UI random question for streamlit 1.12 and pin to streamlit>=1.9.0 (#3121)

* adapt for streamlit 1.12.0 and pin to streamlit>=1.9.0

* make pylint happy
This commit is contained in:
Stefano Fiorucci 2022-08-31 12:35:40 +02:00 committed by GitHub
parent 911a2fa7e4
commit e7771dc18e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -36,5 +36,5 @@ setup(
],
packages=find_packages(),
python_requires=">=3.7, <4",
install_requires=["streamlit>=1.2.0, <2", "st-annotated-text>=2.0.0, <3", "markdown>=3.3.4, <4"],
install_requires=["streamlit>=1.9.0, <2", "st-annotated-text>=2.0.0, <3", "markdown>=3.3.4, <4"],
)

View File

@ -164,7 +164,13 @@ Ask any question on this topic and see if Haystack can find the correct answer t
st.session_state.random_question_requested = True
# Re-runs the script setting the random question as the textbox value
# Unfortunately necessary as the Random Question button is _below_ the textbox
raise st.scriptrunner.script_runner.RerunException(st.scriptrunner.script_requests.RerunData(None))
if hasattr(st, "scriptrunner"):
raise st.scriptrunner.script_runner.RerunException(
st.scriptrunner.script_requests.RerunData(widget_states=None)
)
raise st.runtime.scriptrunner.script_runner.RerunException(
st.runtime.scriptrunner.script_requests.RerunData(widget_states=None)
)
st.session_state.random_question_requested = False
run_query = (