Merge branch 'bb/gui' of github.com:NousResearch/hermes-agent into bb/gui

This commit is contained in:
emozilla
2026-05-27 22:43:13 -04:00
+30
View File
@@ -2421,6 +2421,36 @@ def _enrich_with_attached_images(user_text: str, image_paths: list[str]) -> str:
return text or "What do you see in this image?"
def _content_display_text(content: Any) -> str:
if content is None:
return ""
if isinstance(content, str):
return content
if isinstance(content, (int, float)):
return str(content)
if isinstance(content, list):
parts = []
for part in content:
text = _content_display_text(part).strip()
if text:
parts.append(text)
return "\n".join(parts)
if isinstance(content, dict):
kind = content.get("type")
if kind in {"text", "input_text", "output_text"}:
return str(content.get("text") or content.get("content") or "")
if kind in {"image_url", "input_image", "image"}:
return "[image]"
if kind in {"input_audio", "audio"}:
return "[audio]"
if kind:
return f"[{kind}]"
if "text" in content:
return str(content.get("text") or "")
return "[structured content]"
return str(content)
def _coerce_message_text(content: Any) -> str:
"""Render ``message['content']`` as a plain string for transport.