autonomy M1 phase4: expose last pause reason/time in task queue API and task detail view

This commit is contained in:
DBT
2026-02-28 06:25:10 +00:00
parent 9bf90b65c3
commit 9788f9f7de
3 changed files with 28 additions and 9 deletions

View File

@@ -1455,15 +1455,17 @@ func (s *RegistryServer) handleWebUITaskQueue(w http.ResponseWriter, r *http.Req
continue continue
} }
row := map[string]interface{}{ row := map[string]interface{}{
"task_id": id, "task_id": id,
"time": t["updated_at"], "time": t["updated_at"],
"status": t["status"], "status": t["status"],
"source": t["source"], "source": t["source"],
"idle_run": true, "idle_run": true,
"input_preview": t["content"], "input_preview": t["content"],
"block_reason": t["block_reason"], "block_reason": t["block_reason"],
"logs": []string{fmt.Sprintf("autonomy state: %v", t["status"])}, "last_pause_reason": t["last_pause_reason"],
"retry_count": 0, "last_pause_at": t["last_pause_at"],
"logs": []string{fmt.Sprintf("autonomy state: %v", t["status"])},
"retry_count": 0,
} }
items = append(items, row) items = append(items, row)
if fmt.Sprintf("%v", row["status"]) == "running" { if fmt.Sprintf("%v", row["status"]) == "running" {

View File

@@ -19,6 +19,8 @@ const resources = {
taskQueue: 'Task Queue', taskQueue: 'Task Queue',
taskLogs: 'Task Logs', taskLogs: 'Task Logs',
mediaSources: 'Media Sources', mediaSources: 'Media Sources',
lastPauseReason: 'Last Pause Reason',
lastPauseAt: 'Last Pause Time',
error: 'Error', error: 'Error',
noTaskAudit: 'No task audit records', noTaskAudit: 'No task audit records',
selectTask: 'Select a task from the left list', selectTask: 'Select a task from the left list',
@@ -172,6 +174,8 @@ const resources = {
taskQueue: '任务队列', taskQueue: '任务队列',
taskLogs: '任务日志', taskLogs: '任务日志',
mediaSources: '媒体来源', mediaSources: '媒体来源',
lastPauseReason: '最近暂停原因',
lastPauseAt: '最近暂停时间',
error: '错误', error: '错误',
noTaskAudit: '暂无任务审计记录', noTaskAudit: '暂无任务审计记录',
selectTask: '请从左侧选择任务', selectTask: '请从左侧选择任务',

View File

@@ -13,6 +13,8 @@ type TaskAuditItem = {
source?: string; source?: string;
idle_run?: boolean; idle_run?: boolean;
block_reason?: string; block_reason?: string;
last_pause_reason?: string;
last_pause_at?: string;
duration_ms?: number; duration_ms?: number;
retry_count?: number; retry_count?: number;
error?: string; error?: string;
@@ -115,6 +117,17 @@ const TaskAudit: React.FC = () => {
<div className="p-2 rounded bg-zinc-950/60 border border-zinc-800 whitespace-pre-wrap text-amber-200">{selected.block_reason || '-'}</div> <div className="p-2 rounded bg-zinc-950/60 border border-zinc-800 whitespace-pre-wrap text-amber-200">{selected.block_reason || '-'}</div>
</div> </div>
<div className="grid grid-cols-1 md:grid-cols-2 gap-3">
<div>
<div className="text-zinc-500 text-xs mb-1">{t('lastPauseReason')}</div>
<div className="p-2 rounded bg-zinc-950/60 border border-zinc-800 whitespace-pre-wrap text-zinc-200">{selected.last_pause_reason || '-'}</div>
</div>
<div>
<div className="text-zinc-500 text-xs mb-1">{t('lastPauseAt')}</div>
<div className="p-2 rounded bg-zinc-950/60 border border-zinc-800 whitespace-pre-wrap text-zinc-200">{selected.last_pause_at || '-'}</div>
</div>
</div>
<div> <div>
<div className="text-zinc-500 text-xs mb-1">{t('taskLogs')}</div> <div className="text-zinc-500 text-xs mb-1">{t('taskLogs')}</div>
<div className="p-2 rounded bg-zinc-950/60 border border-zinc-800 whitespace-pre-wrap text-zinc-200">{Array.isArray(selected.logs) && selected.logs.length ? selected.logs.join('\n') : '-'}</div> <div className="p-2 rounded bg-zinc-950/60 border border-zinc-800 whitespace-pre-wrap text-zinc-200">{Array.isArray(selected.logs) && selected.logs.length ? selected.logs.join('\n') : '-'}</div>