Allen458 commited on
Commit
373f095
·
verified ·
1 Parent(s): 9fe3e59

Update Gradio_UI.py

Browse files
Files changed (1) hide show
  1. Gradio_UI.py +8 -2
Gradio_UI.py CHANGED
@@ -153,8 +153,14 @@ def stream_to_gradio(
153
  ):
154
  yield message
155
 
156
- final_answer = step_log # Last log is the run's final_answer
157
- final_answer = handle_agent_output_types(final_answer)
 
 
 
 
 
 
158
 
159
  if isinstance(final_answer, AgentText):
160
  yield gr.ChatMessage(
 
153
  ):
154
  yield message
155
 
156
+ # 1. 拆开包装盒,提取真正的答案对象
157
+ if hasattr(step_log, "final_answer"):
158
+ raw_answer = step_log.final_answer
159
+ else:
160
+ raw_answer = step_log
161
+
162
+ # 2. 交给原来的处理逻辑
163
+ final_answer = handle_agent_output_types(raw_answer)
164
 
165
  if isinstance(final_answer, AgentText):
166
  yield gr.ChatMessage(