From 746b372a6e3b16db48240bb038d4e6200a54273e Mon Sep 17 00:00:00 2001 From: yumoqing Date: Wed, 5 Aug 2026 18:03:16 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20devops=E7=9B=B4=E6=8E=A5=E7=94=A8message?= =?UTF-8?q?=5Ftext=E4=BD=9C=E5=91=BD=E4=BB=A4=EF=BC=8C=E5=8E=BB=E6=8E=89?= =?UTF-8?q?=E5=89=8D=E7=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wwwroot/api/cockpit_chat.dspy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wwwroot/api/cockpit_chat.dspy b/wwwroot/api/cockpit_chat.dspy index 0d67525..dc14090 100644 --- a/wwwroot/api/cockpit_chat.dspy +++ b/wwwroot/api/cockpit_chat.dspy @@ -876,12 +876,12 @@ if action == 'send_message': else: agent_reply = f"❌ 导入失败:{msg}" elif intent_type == 'devops': - description = intent.get('description', '') or message_text - # 去掉中文前缀("执行命令:"、"运行:"等) + # LLM 分类器的 description 可能是自然语言,直接用用户原始消息作为命令 + cmd = message_text.strip() import re - description = re.sub(r'^(执行命令[::]|运行[::])', '', description.strip()) + cmd = re.sub(r'^(执行命令[::]|运行[::]|帮我\s*)', '', cmd).strip() workdir = ctx.get('workspace_dir', '') or '/d/pipeline/workspaces' - result = await shell_exec(description, workdir=workdir) + result = await shell_exec(cmd, workdir=workdir) if result['rc'] == 0: out = result['stdout'].strip() agent_reply = f"执行成功。{'输出:' + out[:500] if out else '(无输出)'}"