feat(webui): persist reviewed automation chat changes

This commit is contained in:
Xubin Ren committed 2026-10-07 01:12:23 +08:00
1 parent 707f7eb079
commit 845afe9215
41 files changed
+1210 -626

No files matched your search

+16
View File
@@ -1,6 +1,7 @@
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import {
changeAutomationChat,
cancelMcpOAuth,
configureChannel,
completeMcpOAuth,
@@ -13,6 +14,7 @@ import {
fetchFilePreview,
fetchFilePreviewAvailability,
fetchAutomations,
fetchAutomationChats,
fetchAutomationRunResult,
fetchApiService,
fetchCliApps,
@@ -377,6 +379,20 @@ describe("webui API helpers", () => {
);
});
it("reads chat choices over HTTP and commits the opaque choice over WebSocket", async () => {
const controller = new AbortController();
await fetchAutomationChats("tok", "task/id", controller.signal);
expect(fetch).toHaveBeenCalledWith(
"/api/webui/automations/chats?id=task%2Fid",
expect.objectContaining({ headers: { Authorization: "Bearer tok" }, signal: expect.any(AbortSignal) }),
);
vi.mocked(fetch).mockClear();
const values = { target_id: "opaque-id", revision: "reviewed-version", message: "Reviewed prompt" };
await changeAutomationChat(mutationTransport, "task/id", values);
expect(requestMutation).toHaveBeenCalledWith("automation.change_chat", { id: "task/id", values }, 20_000);
expect(fetch).not.toHaveBeenCalled();
});
it("validates channel settings with form values", async () => {
await validateChannel(
mutationTransport,