fix(ai): isolate provider test results between edits

This commit is contained in:
zipg authored and GitHub committed 2026-09-16 23:22:42 +08:00
1 parent 1ed06f270b
commit b969a86d38
2 files changed
+17

No files matched your search

@@ -4677,6 +4677,8 @@ function aiSelectProvider(presetId: string) {
if (isWeb && CLI_AI_PROVIDERS.has(provider)) return;
if (presetId === aiEditProviderPresetId.value) return;
syncAiEditState();
// Apply new provider's preset defaults to edit state
aiEditProviderPresetId.value = presetId;
aiEditProvider.value = provider;
@@ -4706,6 +4708,7 @@ function aiEnterListMode() {
}
function aiEnterEditMode(configId?: string) {
syncAiEditState();
aiConfigListMode.value = "edit";
aiEditConfigId.value = configId || null;
@@ -0,0 +1,14 @@
import { describe, expect, it } from "vitest";
import { readFileSync } from "node:fs";
const dialogSource = readFileSync(new URL("../EditorSettingsDialog.vue", import.meta.url), "utf8");
describe("EditorSettingsDialog AI test result isolation", () => {
it("clears the previous test result when opening another configuration", () => {
expect(dialogSource).toMatch(/function aiEnterEditMode\(configId\?: string\) \{\s*syncAiEditState\(\);/);
});
it("clears the previous test result when changing provider in the editor", () => {
expect(dialogSource).toMatch(/if \(presetId === aiEditProviderPresetId\.value\) return;\s*\n\s*syncAiEditState\(\);/);
});
});