Fix WebUI startup blocking on slow gateway routes

This commit is contained in:
chengyongru
2026-06-13 21:59:36 +08:00
committed by Xubin Ren
parent 3a221d74cf
commit af0e3441d7
12 changed files with 280 additions and 17 deletions
+20
View File
@@ -5,6 +5,7 @@ import {
deleteSession,
fetchFilePreview,
fetchCliApps,
fetchInstalledCliApps,
fetchMcpPresets,
fetchProviderModels,
fetchSessionAutomations,
@@ -375,6 +376,25 @@ describe("webui API helpers", () => {
);
});
it("reads installed CLI Apps without fetching the full catalog", async () => {
vi.mocked(fetch).mockResolvedValueOnce({
ok: true,
json: async () => ({
apps: [],
installed_count: 0,
catalog_updated_at: null,
}),
} as Response);
await expect(fetchInstalledCliApps("tok")).resolves.toMatchObject({ apps: [] });
expect(fetch).toHaveBeenCalledWith(
"/api/settings/cli-apps?installed_only=1",
expect.objectContaining({
headers: { Authorization: "Bearer tok" },
}),
);
});
it("reads MCP presets and serializes actions", async () => {
vi.mocked(fetch).mockResolvedValueOnce({
ok: true,