Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -330,6 +330,8 @@ def save_feedback_to_huggingface():
|
|
330 |
except Exception as e:
|
331 |
print("β Feedback upload failed:", e)
|
332 |
|
|
|
|
|
333 |
|
334 |
def main():
|
335 |
load_environment()
|
@@ -399,7 +401,7 @@ def main():
|
|
399 |
st.markdown(f"π Feedbacks collected: **{len(st.session_state.feedback_log)} / 5**")
|
400 |
|
401 |
# Show input box for next question
|
402 |
-
user_question = st.text_input("Ask your next question:", key="user_input")
|
403 |
|
404 |
if user_question:
|
405 |
with st.spinner("Generating answer..."):
|
@@ -415,8 +417,6 @@ def main():
|
|
415 |
"bot": response
|
416 |
})
|
417 |
|
418 |
-
# Clear input and rerun for a clean view
|
419 |
-
st.session_state.user_input = ""
|
420 |
st.rerun()
|
421 |
|
422 |
if __name__ == "__main__":
|
|
|
330 |
except Exception as e:
|
331 |
print("β Feedback upload failed:", e)
|
332 |
|
333 |
+
def clear_user_input():
|
334 |
+
st.session_state["user_input"] = ""
|
335 |
|
336 |
def main():
|
337 |
load_environment()
|
|
|
401 |
st.markdown(f"π Feedbacks collected: **{len(st.session_state.feedback_log)} / 5**")
|
402 |
|
403 |
# Show input box for next question
|
404 |
+
user_question = st.text_input("Ask your next question:", key="user_input", on_change=clear_user_input)
|
405 |
|
406 |
if user_question:
|
407 |
with st.spinner("Generating answer..."):
|
|
|
417 |
"bot": response
|
418 |
})
|
419 |
|
|
|
|
|
420 |
st.rerun()
|
421 |
|
422 |
if __name__ == "__main__":
|