Ali2206 commited on
Commit
f0b8f72
·
verified ·
1 Parent(s): d911fc0

Update ui/ui_core.py

Browse files
Files changed (1) hide show
  1. ui/ui_core.py +5 -5
ui/ui_core.py CHANGED
@@ -117,8 +117,8 @@ def create_ui(agent: TxAgent):
117
  )
118
 
119
  try:
120
- history.append(("user", message))
121
- history.append(("assistant", "⏳ Processing your request..."))
122
  yield history
123
 
124
  extracted_text = ""
@@ -172,12 +172,12 @@ def create_ui(agent: TxAgent):
172
 
173
  full_response = "\n\n".join(results)
174
  full_response = clean_final_response(full_response.strip())
175
- history[-1] = ("assistant", full_response)
176
  yield history
177
 
178
  except Exception as chat_error:
179
  print(f"Chat handling error: {chat_error}")
180
- history[-1] = ("assistant", "❌ An error occurred while processing your request.")
181
  yield history
182
 
183
  inputs = [message_input, chatbot, conversation_state, file_upload]
@@ -190,4 +190,4 @@ def create_ui(agent: TxAgent):
190
  ["Is there anything abnormal in the attached blood work report?"]
191
  ], inputs=message_input)
192
 
193
- return demo
 
117
  )
118
 
119
  try:
120
+ history.append({"role": "user", "content": message})
121
+ history.append({"role": "assistant", "content": "⏳ Processing your request..."})
122
  yield history
123
 
124
  extracted_text = ""
 
172
 
173
  full_response = "\n\n".join(results)
174
  full_response = clean_final_response(full_response.strip())
175
+ history[-1] = {"role": "assistant", "content": full_response}
176
  yield history
177
 
178
  except Exception as chat_error:
179
  print(f"Chat handling error: {chat_error}")
180
+ history[-1] = {"role": "assistant", "content": "❌ An error occurred while processing your request."}
181
  yield history
182
 
183
  inputs = [message_input, chatbot, conversation_state, file_upload]
 
190
  ["Is there anything abnormal in the attached blood work report?"]
191
  ], inputs=message_input)
192
 
193
+ return demo