优化脚本 就该模型
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import { Activity, X } from "lucide-react";
|
||||
import { Activity, RefreshCw, X } from "lucide-react";
|
||||
import { adminApi } from "../../api";
|
||||
import { Pager } from "../../components/pager";
|
||||
import { IconKitSvg } from "../../components/IconKitSvg";
|
||||
@@ -77,6 +77,20 @@ export function AdminTasksPage({ notify }: { notify: Notify }) {
|
||||
}
|
||||
}
|
||||
|
||||
async function refreshStatus() {
|
||||
if (busy) return;
|
||||
setBusy(true);
|
||||
try {
|
||||
const res = await adminApi.pollTasks();
|
||||
notify("success", res.polled > 0 ? `已刷新 ${res.polled} 个进行中任务` : "列表已更新");
|
||||
await load();
|
||||
} catch {
|
||||
notify("error", "刷新失败");
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
}
|
||||
|
||||
async function retry(t: AdminTask) {
|
||||
if (busy) return;
|
||||
setBusy(true);
|
||||
@@ -114,6 +128,11 @@ export function AdminTasksPage({ notify }: { notify: Notify }) {
|
||||
<h1>任务监控</h1>
|
||||
<div className="sub"><span className="mono">{count} 个任务</span> · 全局 AI 任务 · 成本异常 · 失败重投</div>
|
||||
</div>
|
||||
<div className="actions">
|
||||
<button className="btn" type="button" disabled={busy} onClick={() => void refreshStatus()}>
|
||||
<RefreshCw size={14} /> 刷新状态
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="admin-toolbar">
|
||||
|
||||
Reference in New Issue
Block a user