revert: cockpit_chat.dspy back to yield streaming version (6f5e989), remove request.read() raw body path
This commit is contained in:
parent
9a1d8083fd
commit
d46ab14e12
@ -2,26 +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: {"params":{"prompt":"...","model_id":"..."},...}
|
# AgentIO sends JSON body without action field — detect from message_text presence
|
||||||
if action != 'send_message':
|
if action != 'send_message':
|
||||||
try: p = dict(params_kw) if params_kw else {}
|
p = params_kw or {}
|
||||||
except: p = {}
|
msg = (p.get('message_text') or '').strip()
|
||||||
msg = p.get('message_text', '') or ''
|
|
||||||
if not msg:
|
if not msg:
|
||||||
inner = p.get('params', None)
|
inner = p.get('params', {})
|
||||||
if inner is not None and isinstance(inner, dict):
|
if isinstance(inner, dict):
|
||||||
msg = (inner.get('prompt') or inner.get('message_text') or '').strip()
|
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:
|
if msg:
|
||||||
action = 'send_message'
|
action = 'send_message'
|
||||||
dbname = get_module_dbname('pipeline-sdlc')
|
dbname = get_module_dbname('pipeline-sdlc')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user