优化脚本 就该模型
This commit is contained in:
@@ -214,6 +214,11 @@
|
||||
padding: 52px clamp(40px, 3.2vw, 68px) 48px;
|
||||
}
|
||||
.admin-page .page-head {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
flex-wrap: wrap;
|
||||
margin-bottom: 28px;
|
||||
}
|
||||
.admin-page .page-head h1 {
|
||||
|
||||
@@ -1033,6 +1033,12 @@ export const adminApi = {
|
||||
retryTask(id: string) {
|
||||
return request<{ retried: boolean; task_id: string }>(`/api/admin/tasks/${id}/retry/`, { method: "POST" });
|
||||
},
|
||||
pollTasks(taskIds?: string[]) {
|
||||
return request<{ polled: number; statuses: Record<string, string> }>(
|
||||
"/api/admin/tasks/poll/",
|
||||
{ method: "POST", body: JSON.stringify(taskIds ? { task_ids: taskIds } : {}) }
|
||||
);
|
||||
},
|
||||
reapTask(id: string) {
|
||||
return request<AdminTask>(`/api/admin/tasks/${id}/reap/`, { method: "POST" });
|
||||
},
|
||||
|
||||
@@ -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