mirror of
https://github.com/ThearchyHelios/AgentLab.git
synced 2026-11-25 17:54:31 +00:00
前端:审批卡按审批当场拼出待办(不再为一张卡取一次待办,收到中断就出卡;有 task_id 走待办接口,没有走老的审批接口);矮窗口导航两档高度不再叠加,480px 放得下九项;待办数随目录启动时就取、外壳订阅时当场记底,派给自己的新待办通知不再漏;头一回取目录的卡住从启动算起;外壳横向裁掉悬停提示的占位;证据抽屉同一指标在取时不另发请求;编辑器去掉第二个 main、检查一次只跑一遍;记录页对不上待办的审批照旧画审批卡,待办行写 runName 和节点名;检查脚本按新页面更新断言(沙箱没有待办时用合成的两条、未保存与已删除工作流分开认、生效记录页签、能力子页签)
This commit is contained in:
@@ -150,6 +150,14 @@ const FETCHERS: Record<CatalogKey, () => Promise<unknown[]>> = {
|
||||
|
||||
export const useCatalog = create<CatalogState>((set, get) => {
|
||||
let backoffStep = 0
|
||||
// 待办数:启动时随目录取一次、之后每拍心跳取。后发的请求先回来时,先发的那份晚到了不再盖掉它
|
||||
let countReq = 0
|
||||
let countApplied = 0
|
||||
const applyCounts = (seq: number, counts: TaskCounts) => {
|
||||
if (seq < countApplied) return
|
||||
countApplied = seq
|
||||
set({ taskCounts: counts })
|
||||
}
|
||||
|
||||
const markDown = (error: string) => {
|
||||
// 已经断着再失败一次,就把下一次重试往后推一档。所以"发现断开"的各条路
|
||||
@@ -235,6 +243,10 @@ export const useCatalog = create<CatalogState>((set, get) => {
|
||||
})
|
||||
}
|
||||
}
|
||||
// 待办数和目录一起取一次:导航上「应用」「记录」的徽标、新待办通知的记底都等它,不该等到第一拍心跳(4 秒后)。
|
||||
// 不算进清单:取不到时徽标退回按待审批数,下一拍心跳再取
|
||||
const countSeq = ++countReq
|
||||
void api.tasks.count(catalogOpts).then((c) => applyCounts(countSeq, c)).catch(() => undefined)
|
||||
const t0 = performance.now()
|
||||
await Promise.all(keys.map(track))
|
||||
if (!get().loaded) set({ loaded: true })
|
||||
@@ -260,11 +272,12 @@ export const useCatalog = create<CatalogState>((set, get) => {
|
||||
// 留空,「记录」的徽标退回按待审批数
|
||||
const builder = atLeast(useAuth.getState().me, 'builder')
|
||||
const seq = ++fetchSeq
|
||||
const countSeq = ++countReq
|
||||
const [approvals, counts] = await Promise.allSettled([
|
||||
builder ? api.approvals.list('pending', catalogOpts) : Promise.resolve(null),
|
||||
api.tasks.count(catalogOpts),
|
||||
])
|
||||
if (counts.status === 'fulfilled') set({ taskCounts: counts.value })
|
||||
if (counts.status === 'fulfilled') applyCounts(countSeq, counts.value)
|
||||
// 心跳测的是这一拍的往返;使用者不取待审批,看待办数那一个请求
|
||||
const probe = builder ? approvals : counts
|
||||
if (probe.status === 'fulfilled') set({ latencyMs: Math.round(performance.now() - t0), lastOkAt: Date.now() })
|
||||
|
||||
Reference in New Issue
Block a user