From 9a1d8083fdde13afb7fbff4aff28cc335a7f7ab2 Mon Sep 17 00:00:00 2001 From: ymq Date: Sat, 8 Aug 2026 23:37:07 +0800 Subject: [PATCH] fix: read raw body as JSON when bricks_fetch omits Content-Type header --- wwwroot/api/cockpit_chat.dspy | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/wwwroot/api/cockpit_chat.dspy b/wwwroot/api/cockpit_chat.dspy index 25a1d1c..520f762 100644 --- a/wwwroot/api/cockpit_chat.dspy +++ b/wwwroot/api/cockpit_chat.dspy @@ -9,8 +9,19 @@ if action != 'send_message': msg = p.get('message_text', '') or '' if not msg: inner = p.get('params', None) - if hasattr(inner, 'get') and callable(inner.get): + if inner is not None and isinstance(inner, dict): msg = (inner.get('prompt') or inner.get('message_text') or '').strip() + # bricks_fetch sends JSON body without Content-Type — read raw + if not msg: + try: + raw_body = await request.read() + if raw_body: + import json + body = json.loads(raw_body.decode('utf-8')) + inner2 = body.get('params', {}) + if isinstance(inner2, dict): + msg = (inner2.get('prompt') or inner2.get('message_text') or '').strip() + except: pass if msg: action = 'send_message' dbname = get_module_dbname('pipeline-sdlc')