@@ -852,109 +824,6 @@ export function SystemSettingsForm({ initialSettings }: SystemSettingsFormProps)
/>
diff --git a/src/types/system-config.ts b/src/types/system-config.ts
index 30e39fffd..96c489e89 100644
--- a/src/types/system-config.ts
+++ b/src/types/system-config.ts
@@ -22,12 +22,7 @@ export interface FakeStreamingWhitelistEntry {
// Default whitelist used when system_settings has no persisted value (legacy
// upgrade path). A persisted empty array is preserved as explicit opt-out.
-export const DEFAULT_FAKE_STREAMING_WHITELIST: ReadonlyArray = [
- { model: "gpt-image-2", groupTags: [] },
- { model: "gpt-image-1.5", groupTags: [] },
- { model: "gemini-3.1-flash-image-preview", groupTags: [] },
- { model: "gemini-3-pro-image-preview", groupTags: [] },
-];
+export const DEFAULT_FAKE_STREAMING_WHITELIST: ReadonlyArray = [];
export interface SystemSettings {
id: number;
diff --git a/tests/unit/actions/system-config-fake-streaming-setting.test.ts b/tests/unit/actions/system-config-fake-streaming-setting.test.ts
index cc1cbad23..aa225c120 100644
--- a/tests/unit/actions/system-config-fake-streaming-setting.test.ts
+++ b/tests/unit/actions/system-config-fake-streaming-setting.test.ts
@@ -60,12 +60,7 @@ vi.mock("@/lib/utils/timezone", () => ({
isValidIANATimezone: vi.fn(() => true),
}));
-const DEFAULT_FAKE_STREAMING_MODELS = [
- { model: "gpt-image-2", groupTags: [] },
- { model: "gpt-image-1.5", groupTags: [] },
- { model: "gemini-3.1-flash-image-preview", groupTags: [] },
- { model: "gemini-3-pro-image-preview", groupTags: [] },
-];
+const DEFAULT_FAKE_STREAMING_MODELS: { model: string; groupTags: string[] }[] = [];
function createSettings(overrides: Record = {}) {
return {
@@ -131,7 +126,7 @@ describe("fake streaming whitelist system setting", () => {
});
describe("transformer defaults", () => {
- test("defaults missing fake streaming config to requested image models", async () => {
+ test("defaults missing fake streaming config to the empty default", async () => {
const { toSystemSettings } = await import("@/repository/_shared/transformers");
const fromUndefined = toSystemSettings(undefined);
@@ -180,7 +175,7 @@ describe("fake streaming whitelist system setting", () => {
expect(result.fakeStreamingWhitelist).toEqual(persisted);
});
- test("repository fallback (table missing) defaults to image models", async () => {
+ test("repository fallback (table missing) defaults to the empty default", async () => {
vi.resetModules();
vi.doUnmock("@/repository/system-config");
vi.doMock("@/drizzle/db", () => ({
diff --git a/tests/unit/settings/system-settings-form-fake-streaming.test.tsx b/tests/unit/settings/system-settings-form-fake-streaming.test.tsx
index 5bc489e6c..f49341474 100644
--- a/tests/unit/settings/system-settings-form-fake-streaming.test.tsx
+++ b/tests/unit/settings/system-settings-form-fake-streaming.test.tsx
@@ -146,22 +146,6 @@ async function submitForm() {
});
}
-function findRemoveButtons(): HTMLButtonElement[] {
- return Array.from(
- document.querySelectorAll('button[data-testid^="fake-streaming-remove-"]')
- );
-}
-
-function findAddButton(): HTMLButtonElement | null {
- return document.querySelector('button[data-testid="fake-streaming-add"]');
-}
-
-function findModelInputs(): HTMLInputElement[] {
- return Array.from(
- document.querySelectorAll('input[data-testid^="fake-streaming-model-"]')
- );
-}
-
describe("SystemSettingsForm fake streaming whitelist", () => {
beforeEach(() => {
document.body.innerHTML = "";
@@ -185,55 +169,23 @@ describe("SystemSettingsForm fake streaming whitelist", () => {
unmount();
});
- test("user can add a new model entry and saves it for all groups", async () => {
+ test("editor UI is no longer rendered", () => {
const { unmount } = render();
- const addBtn = findAddButton();
- if (!addBtn) throw new Error("未找到 fake-streaming 添加按钮");
-
- act(() => {
- addBtn.dispatchEvent(new MouseEvent("click", { bubbles: true }));
- });
-
- const inputs = findModelInputs();
- expect(inputs.length).toBe(3);
- const newRow = inputs[2];
-
- act(() => {
- const setter = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set;
- setter?.call(newRow, "custom-model-x");
- newRow.dispatchEvent(new Event("input", { bubbles: true }));
- });
-
- await submitForm();
-
- expect(systemConfigActionMocks.saveSystemSettings).toHaveBeenCalledWith(
- expect.objectContaining({
- fakeStreamingWhitelist: [
- { model: "gpt-image-2", groupTags: [] },
- { model: "gemini-3.1-flash-image-preview", groupTags: [] },
- { model: "custom-model-x", groupTags: [] },
- ],
- })
- );
+ expect(document.querySelector('button[data-testid="fake-streaming-add"]')).toBeNull();
+ expect(document.querySelector('button[data-testid^="fake-streaming-remove-"]')).toBeNull();
+ expect(document.querySelector('input[data-testid^="fake-streaming-model-"]')).toBeNull();
unmount();
});
- test("user can remove a model entry and the empty whitelist is preserved as opt-out", async () => {
- const singleEntry = {
+ test("preserves an explicitly empty initial whitelist as opt-out", async () => {
+ const emptyInitial = {
...baseSettings,
- fakeStreamingWhitelist: [{ model: "gpt-image-2", groupTags: [] }],
+ fakeStreamingWhitelist: [],
} satisfies typeof baseSettings;
- const { unmount } = render();
-
- const removeBtns = findRemoveButtons();
- expect(removeBtns.length).toBe(1);
-
- act(() => {
- removeBtns[0].dispatchEvent(new MouseEvent("click", { bubbles: true }));
- });
+ const { unmount } = render();
await submitForm();
@@ -247,18 +199,15 @@ describe("SystemSettingsForm fake streaming whitelist", () => {
});
test("trims whitespace and drops empty model entries before submitting", async () => {
- const { unmount } = render();
-
- const inputs = findModelInputs();
- expect(inputs.length).toBe(2);
- const setter = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set;
+ const initial = {
+ ...baseSettings,
+ fakeStreamingWhitelist: [
+ { model: " custom-image-model ", groupTags: [] },
+ { model: " ", groupTags: [] },
+ ],
+ } satisfies typeof baseSettings;
- act(() => {
- setter?.call(inputs[0], " custom-image-model ");
- inputs[0].dispatchEvent(new Event("input", { bubbles: true }));
- setter?.call(inputs[1], " ");
- inputs[1].dispatchEvent(new Event("input", { bubbles: true }));
- });
+ const { unmount } = render();
await submitForm();