feat: markdown table format for list_tasks with emoji

This commit is contained in:
ymq 2026-08-11 15:11:09 +08:00
parent 99ebd88100
commit aaad55cdab

View File

@ -603,13 +603,21 @@ class AgentExecutor:
if not recs:
return "暂无任务"
lines = []
# 状态图标映射
icons = {
"submitted": "", "running": "🔄", "review": "👀",
"approved": "", "completed": "✔️", "failed": "",
"waiting": "⏸️",
}
lines = ["| 状态 | 任务 | 角色 | ID |",
"|------|------|------|----|"]
for r in recs:
lines.append(
f"- [{getattr(r, 'state', '?')}] {getattr(r, 'title', '')} "
f"(角色: {getattr(r, 'role', '')}) "
f"id={getattr(r, 'id', '')[:8]}"
)
st = getattr(r, 'state', '?')
icon = icons.get(st, "")
title = (getattr(r, 'title', '') or '')[:60]
role = getattr(r, 'role', '')
tid = getattr(r, 'id', '')[:8]
lines.append(f"| {icon} {st} | {title} | {role} | {tid} |")
return "\n".join(lines)
async def _t_task_detail(self, sor, p, pid):