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 import aiohttp
action = (params_kw or {}).get('action', 'list_messages') 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': if action != 'send_message':
p = params_kw or {} try: p = dict(params_kw) if params_kw else {}
msg = (p.get('message_text') or '').strip() except: p = {}
msg = p.get('message_text', '') or ''
if not msg: if not msg:
inner = p.get('params', {}) inner = p.get('params', None)
if isinstance(inner, dict): if hasattr(inner, 'get') and callable(inner.get):
msg = (inner.get('prompt') or inner.get('message_text') or '').strip() msg = (inner.get('prompt') or inner.get('message_text') or '').strip()
if msg: if msg:
action = 'send_message' action = 'send_message'