From b3a24a12502892f0d748c5fc0921865413433afb Mon Sep 17 00:00:00 2001 From: ymq Date: Sun, 9 Aug 2026 23:29:53 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20filter=20tetris/=E4=BF=84=E7=BD=97?= =?UTF-8?q?=E6=96=AF=E6=96=B9=E5=9D=97=20from=20conversation=20history=20t?= =?UTF-8?q?o=20stop=20hallucination?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wwwroot/api/cockpit_chat.dspy | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wwwroot/api/cockpit_chat.dspy b/wwwroot/api/cockpit_chat.dspy index 8b66fce..e3a39d6 100644 --- a/wwwroot/api/cockpit_chat.dspy +++ b/wwwroot/api/cockpit_chat.dspy @@ -478,9 +478,11 @@ if action == 'send_message': for h in (await sor.sqlExe("SELECT role,content FROM pipeline_conversations WHERE created_by=${u}$ ORDER BY created_at ASC LIMIT 20",{"u":uid}) or []): c = getattr(h,'content','') or '' r = getattr(h,'role','') or '' - # Skip raw tool_call JSON — prevents LLM from mimicking old tool calls + # Skip raw tool_call JSON and contaminated old messages if c.startswith('{"action":"tool_call"') or c.startswith('{"action": "tool_call"'): continue + if 'tetris' in c.lower() or '俄罗斯方块' in c: + continue msgs.append({"role":'user' if r=='user' else 'assistant',"content":c}) msgs.append({"role":"user","content":message_text}) await sor.C('pipeline_conversations',{'id':getID(),'role':'user','content':message_text,'msg_type':'text','org_id':org_id,'created_by':uid})