Spaces:
Runtime error
Runtime error
Update agents.py
Browse files
agents.py
CHANGED
|
@@ -330,7 +330,7 @@ def make_specialist_node(name: str, tools, role_description: str):
|
|
| 330 |
else:
|
| 331 |
summary = f"Requested unknown tool '{decision['tool']}'."
|
| 332 |
elif decision and "final" in decision:
|
| 333 |
-
summary = decision["final"]
|
| 334 |
else:
|
| 335 |
summary = raw_response # model didn't follow the JSON protocol — use raw text as a fallback
|
| 336 |
|
|
@@ -414,6 +414,7 @@ def _format_attribution(results: dict) -> str:
|
|
| 414 |
return ""
|
| 415 |
lines = ["", "---", "**Agents used:**"]
|
| 416 |
for name, summary in results.items():
|
|
|
|
| 417 |
label = AGENT_LABELS.get(name, name)
|
| 418 |
preview = summary if len(summary) <= 160 else summary[:157] + "..."
|
| 419 |
lines.append(f"- **{label}** — {preview}")
|
|
|
|
| 330 |
else:
|
| 331 |
summary = f"Requested unknown tool '{decision['tool']}'."
|
| 332 |
elif decision and "final" in decision:
|
| 333 |
+
summary = str(decision["final"]) # model may return a bare number/bool instead of a string
|
| 334 |
else:
|
| 335 |
summary = raw_response # model didn't follow the JSON protocol — use raw text as a fallback
|
| 336 |
|
|
|
|
| 414 |
return ""
|
| 415 |
lines = ["", "---", "**Agents used:**"]
|
| 416 |
for name, summary in results.items():
|
| 417 |
+
summary = str(summary) # defensive: a tool or model could hand back a non-string value
|
| 418 |
label = AGENT_LABELS.get(name, name)
|
| 419 |
preview = summary if len(summary) <= 160 else summary[:157] + "..."
|
| 420 |
lines.append(f"- **{label}** — {preview}")
|