From 89c5e9b26f94cf652d4ef550e4e64ed8c35f6774 Mon Sep 17 00:00:00 2001 From: Autumn-27 <53844290+Autumn-27@users.noreply.github.com> Date: Wed, 19 Aug 2026 11:05:09 -0400 Subject: [PATCH] =?UTF-8?q?fix(mock):=20intentsPage=20=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E5=88=86=E9=A1=B5=E6=A0=BC=E5=BC=8F,=E4=BF=AE=E5=A4=8D=20worke?= =?UTF-8?q?r=20=E5=88=97=E8=A1=A8=E4=B8=BA=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit handler 对 /exploration/intents 只返回裸数组,intentsPage 带 ?page= 参数时期望 {items, has_more} 形状,r.items 取到 undefined 导致 mock 模式下 worker 会话列表始终为空。 --- web/src/lib/mock/handler.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/web/src/lib/mock/handler.ts b/web/src/lib/mock/handler.ts index 8b9f313..1d59db2 100644 --- a/web/src/lib/mock/handler.ts +++ b/web/src/lib/mock/handler.ts @@ -148,7 +148,16 @@ function route(m: string, path: string, seg: string[], q: URLSearchParams, b: Re page_size: pageSize, }; } - if (path === "/exploration/intents") return D.intents; + if (path === "/exploration/intents") { + if (q.has("page")) { + const before = Number(q.get("before") ?? 0); + const limit = Number(q.get("limit") ?? 300); + let list = D.intents; + if (before > 0) list = list.filter((n) => Number(n.id.replace(/\D/g, "") || n.id) < before); + return { items: list.slice(0, limit), has_more: list.length > limit }; + } + return D.intents; + } if (path === "/exploration/tokens") return { workers: D.tokenWorkers, total: D.tokenTotal }; if (path === "/exploration/graph") return D.explorationGraph; if (path === "/exploration/activity" && seg.length === 2) { @@ -190,6 +199,9 @@ function route(m: string, path: string, seg: string[], q: URLSearchParams, b: Re if (path === "/llm/profiles" && m === "GET") return { profiles: D.llmProfiles }; if (path === "/llm/profiles" && m === "POST") return { id: Number(b.id) || 3 }; if (path === "/llm/profiles/active") return { ok: true }; + if (path === "/llm/pool" && m === "GET") return D.llmPool; + if (path === "/llm/pool/reset") + return { ...D.llmPool, chain: D.llmPool.chain.map((c) => ({ ...c, state: "ok", fails: 0, cooldown_secs: 0 })) }; if (seg[0] === "llm" && seg[1] === "profiles" && seg.length === 3 && m === "DELETE") return { deleted: Number(seg[2]) }; // ── agents ──