refactor: remove unused runtime and WebUI helpers (#5999)

* refactor: remove unused runtime and WebUI helpers

* fix: preserve exported agent helper methods
This commit is contained in:
chengyongru authored and GitHub committed 2026-10-02 01:41:05 +08:00
1 parent d3d70f2065
commit 6ecb74aea9
17 files changed
+26 -143

No files matched your search

+1 -9
View File
@@ -52,7 +52,6 @@ import {
pollChannelConnect,
startChannelConnect,
updateAutomation,
updateSidebarState,
updateImageGenerationSettings,
updateModelCallOrder,
updateModelConfiguration,
@@ -1158,7 +1157,7 @@ describe("webui API helpers", () => {
);
});
it("reads and writes persisted sidebar state", async () => {
it("reads persisted sidebar state", async () => {
const state = {
schema_version: 1,
pinned_keys: ["websocket:chat-1"],
@@ -1189,13 +1188,6 @@ describe("webui API helpers", () => {
headers: { Authorization: "Bearer tok" },
}),
);
await updateSidebarState(mutationTransport, state);
expect(requestMutation).toHaveBeenCalledWith(
"sidebar.update",
{ state },
20_000,
);
});
it("fetches workspace project state", async () => {
+1 -23
View File
@@ -2,7 +2,7 @@ import { act, renderHook, waitFor } from "@testing-library/react";
import type { ReactNode } from "react";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { sessionTitle, useSessionHistory, useSessions } from "@/hooks/useSessions";
import { useSessionHistory, useSessions } from "@/hooks/useSessions";
import * as api from "@/lib/api";
import { webuiThreadCache } from "@/lib/webui-thread-cache";
import { activateReloadCache, clearReloadCache, writeReloadCache } from "@/lib/reload-cache";
@@ -130,28 +130,6 @@ describe("useSessions", () => {
webuiThreadCache.clear();
});
it("does not use low-information greetings as fallback session titles", () => {
expect(sessionTitle({
key: "websocket:chat-hi",
channel: "websocket",
chatId: "chat-hi",
createdAt: "2026-04-16T10:00:00Z",
updatedAt: "2026-04-16T10:00:00Z",
title: "",
preview: "hi",
})).toBe("New topic");
expect(sessionTitle({
key: "websocket:chat-work",
channel: "websocket",
chatId: "chat-work",
createdAt: "2026-04-16T10:00:00Z",
updatedAt: "2026-04-16T10:00:00Z",
title: "",
preview: "帮我优化 WebUI 性能",
})).toBe("帮我优化 WebUI 性能");
});
it("removes a session from the local list after delete succeeds", async () => {
vi.mocked(api.listSessions).mockResolvedValue([
{