Dhruv-Ty commited on
Commit
f3742d0
·
verified ·
1 Parent(s): 68b9874

2 commits before

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +7 -9
src/streamlit_app.py CHANGED
@@ -87,16 +87,14 @@ if prompt := st.chat_input("Describe your symptoms or ask a medical question..."
87
  # Check if we need to process a response (this block runs after the rerun if processing is True)
88
  if st.session_state.processing:
89
  try:
90
- # Get the full history from database
91
- full_history = get_full_history()
92
 
93
- if full_history: # Ensure history is not empty
94
- current_user_prompt_message = full_history[-1] # The last message is the current user's prompt
95
-
96
- # The history for the orchestrator is all messages EXCEPT the last one
97
- history_for_orchestrator = full_history[:-1]
98
-
99
- # The query for the orchestrator is the content of the last user message
100
  current_query = current_user_prompt_message["content"]
101
 
102
  reply, explanation, follow_up_questions, evidence = orchestrator_chat(
 
87
  # Check if we need to process a response (this block runs after the rerun if processing is True)
88
  if st.session_state.processing:
89
  try:
90
+ # Use the local session state history
91
+ current_session_history = st.session_state.get('history', [])
92
 
93
+ if current_session_history: # Ensure history is not empty
94
+ # The history for the orchestrator is all messages EXCEPT the last one (current user's prompt)
95
+ # The last message is the current user's prompt, which was just added.
96
+ history_for_orchestrator = current_session_history[:-1]
97
+ current_user_prompt_message = current_session_history[-1]
 
 
98
  current_query = current_user_prompt_message["content"]
99
 
100
  reply, explanation, follow_up_questions, evidence = orchestrator_chat(