fix: devops直接用message_text作命令,去掉前缀
This commit is contained in:
parent
1d22da86ac
commit
746b372a6e
@ -876,12 +876,12 @@ if action == 'send_message':
|
|||||||
else:
|
else:
|
||||||
agent_reply = f"❌ 导入失败:{msg}"
|
agent_reply = f"❌ 导入失败:{msg}"
|
||||||
elif intent_type == 'devops':
|
elif intent_type == 'devops':
|
||||||
description = intent.get('description', '') or message_text
|
# LLM 分类器的 description 可能是自然语言,直接用用户原始消息作为命令
|
||||||
# 去掉中文前缀("执行命令:"、"运行:"等)
|
cmd = message_text.strip()
|
||||||
import re
|
import re
|
||||||
description = re.sub(r'^(执行命令[::]|运行[::])', '', description.strip())
|
cmd = re.sub(r'^(执行命令[::]|运行[::]|帮我\s*)', '', cmd).strip()
|
||||||
workdir = ctx.get('workspace_dir', '') or '/d/pipeline/workspaces'
|
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:
|
if result['rc'] == 0:
|
||||||
out = result['stdout'].strip()
|
out = result['stdout'].strip()
|
||||||
agent_reply = f"执行成功。{'输出:' + out[:500] if out else '(无输出)'}"
|
agent_reply = f"执行成功。{'输出:' + out[:500] if out else '(无输出)'}"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user