fix: robust DictObject handling for AgentIO JSON body auto-detect

This commit is contained in:
ymq 2026-08-08 23:35:00 +08:00
parent 9bef8e131a
commit 47d5c490e4

View File

@ -2,13 +2,14 @@
import aiohttp
action = (params_kw or {}).get('action', 'list_messages')
# AgentIO sends JSON body without action field — detect from message_text presence
# AgentIO sends JSON body: {"params":{"prompt":"...","model_id":"..."},...}
if action != 'send_message':
p = params_kw or {}
msg = (p.get('message_text') or '').strip()
try: p = dict(params_kw) if params_kw else {}
except: p = {}
msg = p.get('message_text', '') or ''
if not msg:
inner = p.get('params', {})
if isinstance(inner, dict):
inner = p.get('params', None)
if hasattr(inner, 'get') and callable(inner.get):
msg = (inner.get('prompt') or inner.get('message_text') or '').strip()
if msg:
action = 'send_message'