Ali2206 commited on
Commit
9f7cad2
·
verified ·
1 Parent(s): 6b07b3d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -8
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
- content = "".join(final_response).strip().replace("[TOOL_CALLS]", "")
182
- history[-1] = {"role": "assistant", "content": content or " No response."}
183
  yield history
184
 
185
- final_cleaned = "".join(final_response).strip().replace("[TOOL_CALLS]", "")
186
- history[-1] = {"role": "assistant", "content": final_cleaned or "❌ No response."}
187
- print("Final model response:\n", final_cleaned)
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