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