Update app.py
Browse files
app.py
CHANGED
@@ -173,18 +173,16 @@ def create_ui(agent: TxAgent):
|
|
173 |
if isinstance(update, str):
|
174 |
final_response.append(update)
|
175 |
elif isinstance(update, list):
|
176 |
-
for msg in update
|
177 |
-
if hasattr(msg, 'content'):
|
178 |
-
final_response.append(msg.content)
|
179 |
|
180 |
if len(final_response) % 3 == 0:
|
181 |
-
|
182 |
-
history[-1] = {"role": "assistant", "content":
|
183 |
yield history
|
184 |
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
print(f"Model processing took: {time.time() - model_start:.2f}s")
|
189 |
yield history
|
190 |
|
|
|
173 |
if isinstance(update, str):
|
174 |
final_response.append(update)
|
175 |
elif isinstance(update, list):
|
176 |
+
final_response.extend(msg.content for msg in update if hasattr(msg, 'content'))
|
|
|
|
|
177 |
|
178 |
if len(final_response) % 3 == 0:
|
179 |
+
current_output = "".join(final_response).strip().replace("[TOOL_CALLS]", "")
|
180 |
+
history[-1] = {"role": "assistant", "content": current_output or "⏳ Generating..."}
|
181 |
yield history
|
182 |
|
183 |
+
full_output = "".join(final_response).strip().replace("[TOOL_CALLS]", "")
|
184 |
+
print("Final model response:\n", full_output)
|
185 |
+
history[-1] = {"role": "assistant", "content": full_output or "❌ No response."}
|
186 |
print(f"Model processing took: {time.time() - model_start:.2f}s")
|
187 |
yield history
|
188 |
|