Spaces:
Sleeping
Sleeping
Update Gradio_UI.py
Browse files- Gradio_UI.py +8 -2
Gradio_UI.py
CHANGED
|
@@ -153,8 +153,14 @@ def stream_to_gradio(
|
|
| 153 |
):
|
| 154 |
yield message
|
| 155 |
|
| 156 |
-
|
| 157 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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(
|