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 '(无输出)'}"