feat: cockpit_chat添加show_tasks/show_bugs意图处理
This commit is contained in:
parent
dbaf2f7b28
commit
71682b0aba
@ -376,6 +376,8 @@ INTENT_PROMPT = """你是一个开发产线意图分类器。分析用户输入
|
||||
- start_agent: 启动Agent自动执行任务
|
||||
- agent_status: 查看Agent状态和交付件
|
||||
- query: 查询当前状态
|
||||
- show_tasks: 查看当前项目的任务列表(如\"显示任务\"\"任务列表\"\"有哪些任务\")
|
||||
- show_bugs: 查看当前项目/迭代的Bug列表(如\"显示Bug\"\"Bug列表\"\"有哪些Bug\")
|
||||
- skill_list: 列出已导入的企业开发技能(如"查看技能""有哪些skills")
|
||||
- skill_import: 导入本地技能文件(如"导入技能 /path/to/skill",注意:只限本地路径,不包含 git@ 或 .git URL)
|
||||
- devops: git/Shell 操作(如 git clone, git pull, 克隆仓库, 执行命令,注意:任何包含 git@ 或 .git 的请求都属于 devops)
|
||||
@ -763,6 +765,51 @@ if action == 'send_message':
|
||||
agent_reply = '\n'.join(ctx_info) + '\n\n请描述具体想查询什么(如:任务列表、Bug列表等)'
|
||||
else:
|
||||
agent_reply = "当前未选择项目。请先「创建XXX项目」或「切换到XXX项目」。"
|
||||
elif intent_type == 'show_tasks':
|
||||
pid = ctx['project_id']
|
||||
if not pid:
|
||||
agent_reply = "请先指定项目。「创建XXX项目」或「切换到XXX项目」"
|
||||
else:
|
||||
tasks = await sor.sqlExe(
|
||||
"SELECT id, title, state, current_version, created_at FROM pipeline_tasks WHERE tenant_id=${pid}$ ORDER BY created_at DESC LIMIT 20",
|
||||
{"pid": pid})
|
||||
if not tasks:
|
||||
agent_reply = f"项目「{ctx['project_name']}」暂无任务。"
|
||||
else:
|
||||
lines = [f"项目「{ctx['project_name']}」的任务列表:"]
|
||||
for t in tasks:
|
||||
title = getattr(t, 'title', '') or ''
|
||||
state = getattr(t, 'state', '') or ''
|
||||
tid = getattr(t, 'id', '') or ''
|
||||
ver = getattr(t, 'current_version', 1) or 1
|
||||
emoji = '\u25cf'
|
||||
if state == 'running': emoji = '\U0001f7e2'
|
||||
elif state == 'completed': emoji = '\u2705'
|
||||
elif state == 'failed': emoji = '\u274c'
|
||||
lines.append(f"{emoji} {title} [{state}] v{ver} ({str(tid)[:8]})")
|
||||
agent_reply = '\n'.join(lines)
|
||||
elif intent_type == 'show_bugs':
|
||||
pid = ctx['project_id']
|
||||
iid = ctx['iteration_id']
|
||||
if not pid:
|
||||
agent_reply = "请先指定项目。"
|
||||
else:
|
||||
bugs = await sor.sqlExe(
|
||||
"SELECT id, title, severity, status FROM sd_bugs WHERE iteration_id=${iid}$ ORDER BY created_at DESC LIMIT 20",
|
||||
{"iid": iid or ''}) if iid else []
|
||||
if not bugs:
|
||||
agent_reply = f"当前{'迭代' if iid else '项目'}暂无Bug。"
|
||||
else:
|
||||
lines = [f"{'迭代' if iid else '项目'}Bug列表:"]
|
||||
for b in bugs:
|
||||
title = getattr(b, 'title', '') or ''
|
||||
severity = getattr(b, 'severity', '') or ''
|
||||
status = getattr(b, 'status', '') or ''
|
||||
bid = getattr(b, 'id', '') or ''
|
||||
sev_map = {'critical': '\U0001f534', 'major': '\U0001f7e0', 'minor': '\U0001f7e1', 'trivial': '\u26aa'}
|
||||
sev_emoji = sev_map.get(severity, '\u25cf')
|
||||
lines.append(f"{sev_emoji} {title} [{severity}] {status} ({str(bid)[:8]})")
|
||||
agent_reply = '\n'.join(lines)
|
||||
elif intent_type == 'start_agent':
|
||||
pid = ctx['project_id']
|
||||
if not pid:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user