fix: handle prompt at top level from bricks AgentIO request body

This commit is contained in:
ymq 2026-08-09 17:05:36 +08:00
parent 426998b6c6
commit 255f41c780

View File

@ -189,9 +189,13 @@ async def _exec_tool(sor, tool, params, ctx, uid, org_id):
if action == 'send_message':
# AgentIO sends JSON: {"params":{"prompt":"...","model_id":"..."},...}
# FormData sends: action=send_message&message_text=...&model_id=...
# bricks sends prompt/model_id at top level
p = params_kw or {}
message_text = (p.get('message_text') or '').strip()
user_model_id = p.get('model_id', '')
# Try prompt at top level (bricks AgentIO)
if not message_text:
message_text = (p.get('prompt') or '').strip()
# Try JSON body from AgentIO
if not message_text:
inner = p.get('params', {})