mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-04-13 20:47:49 +08:00
feat: harden concurrency scheduling and task watchdog
This commit is contained in:
@@ -119,7 +119,7 @@ const TaskAudit: React.FC = () => {
|
||||
if (!ok) return;
|
||||
}
|
||||
try {
|
||||
const url = `/webui/api/task_queue${q}`;
|
||||
const url = `/webui/api/task_audit${q}`;
|
||||
const r = await fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ action, task_id: selected.task_id }) });
|
||||
if (!r.ok) throw new Error(await r.text());
|
||||
await fetchData();
|
||||
@@ -129,6 +129,7 @@ const TaskAudit: React.FC = () => {
|
||||
};
|
||||
|
||||
const selectedPretty = useMemo(() => selected ? JSON.stringify(selected, null, 2) : '', [selected]);
|
||||
const selectedReadonly = selected?.source === 'command_watchdog';
|
||||
|
||||
return (
|
||||
<div className="h-full p-4 md:p-6 flex flex-col gap-4">
|
||||
@@ -140,6 +141,7 @@ const TaskAudit: React.FC = () => {
|
||||
<option value="autonomy">{t('sourceAutonomy')}</option>
|
||||
<option value="direct">{t('sourceDirect')}</option>
|
||||
<option value="memory_todo">{t('sourceMemoryTodo')}</option>
|
||||
<option value="command_watchdog">command_watchdog</option>
|
||||
<option value="-">-</option>
|
||||
</select>
|
||||
<select value={statusFilter} onChange={(e)=>setStatusFilter(e.target.value)} className="bg-zinc-900 border border-zinc-700 rounded px-2 py-1 text-xs">
|
||||
@@ -195,13 +197,16 @@ const TaskAudit: React.FC = () => {
|
||||
<div className="border border-zinc-800 rounded-xl bg-zinc-900/40 overflow-hidden flex flex-col min-h-0">
|
||||
<div className="px-3 py-2 border-b border-zinc-800 text-xs text-zinc-400 uppercase tracking-wider">{t('taskDetail')}</div>
|
||||
<div className="p-4 overflow-y-auto min-h-0 space-y-3 text-sm">
|
||||
{selected && (
|
||||
{selected && !selectedReadonly && (
|
||||
<div className="flex items-center gap-2 flex-wrap">
|
||||
<button onClick={()=>taskAction('pause')} className="px-2 py-1 text-xs rounded bg-amber-700/70 hover:bg-amber-600">{t('pauseTask')}</button>
|
||||
<button onClick={()=>taskAction('retry')} className="px-2 py-1 text-xs rounded bg-indigo-700/70 hover:bg-indigo-600">{t('retryTask')}</button>
|
||||
<button onClick={()=>taskAction('complete')} className="px-2 py-1 text-xs rounded bg-emerald-700/70 hover:bg-emerald-600">{t('completeTask')}</button>
|
||||
<button onClick={()=>taskAction('ignore')} className="px-2 py-1 text-xs rounded bg-zinc-700 hover:bg-zinc-600">{t('ignoreTask')}</button>
|
||||
</div>
|
||||
)}
|
||||
{selectedReadonly && (
|
||||
<div className="text-xs text-zinc-400">{t('source')}: command_watchdog(readonly)</div>
|
||||
)}
|
||||
{!selected ? (
|
||||
<div className="text-zinc-500">{t('selectTask')}</div>
|
||||
|
||||
Reference in New Issue
Block a user