Merge branch 'fe6'
This commit is contained in:
commit
4d850c1c9c
22 files changed
+1030
-417
No files matched your search
@@ -413,3 +413,31 @@ export function useRunInvocationAudit(runId: string, enabled: boolean, version =
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 巡检触发的最近会话(trigger=schedule,createdBy = schedule:<定时任务 id>):
|
||||
* 计划页的巡检卡片、首页计划带按定时任务分组取费用、模型与最近结果。一次取最近 100 条。
|
||||
*/
|
||||
export function useScheduleAgentRuns() {
|
||||
return useQuery({
|
||||
queryKey: [...agentKeys.runs(undefined, "schedule"), "plan"],
|
||||
queryFn: ({ signal }) =>
|
||||
apiParsed(RunPage, AGENT_BASE, { params: cleanParams({ trigger: "schedule", limit: 100 }), signal }),
|
||||
select: (page) => page.items,
|
||||
staleTime: 30 * TTL_SECOND,
|
||||
refetchInterval: 60 * TTL_SECOND,
|
||||
});
|
||||
}
|
||||
|
||||
/** 按定时任务 id 分组(新 → 旧,保持接口顺序) */
|
||||
export function groupRunsBySchedule(runs: AgentRun[]): Map<string, AgentRun[]> {
|
||||
const out = new Map<string, AgentRun[]>();
|
||||
for (const r of runs) {
|
||||
const id = r.createdBy?.startsWith("schedule:") ? r.createdBy.slice("schedule:".length) : null;
|
||||
if (!id) continue;
|
||||
const list = out.get(id);
|
||||
if (list) list.push(r);
|
||||
else out.set(id, [r]);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
Reference in new issue
Block a user