Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

fix(ai): isolate provider test results between edits

zipgb969a86d38e1
diff --git a/apps/desktop/src/components/editor/EditorSettingsDialog.vue b/apps/desktop/src/components/editor/EditorSettingsDialog.vue
index 95d41c5f8c..6dcb7bbd01 100644
--- a/apps/desktop/src/components/editor/EditorSettingsDialog.vue
+++ b/apps/desktop/src/components/editor/EditorSettingsDialog.vue
@@ -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;
diff --git a/apps/desktop/src/components/editor/__tests__/EditorSettingsDialog.aiTestIsolation.spec.ts b/apps/desktop/src/components/editor/__tests__/EditorSettingsDialog.aiTestIsolation.spec.ts
new file mode 100644
index 0000000000..1afcd9592a
--- /dev/null
+++ b/apps/desktop/src/components/editor/__tests__/EditorSettingsDialog.aiTestIsolation.spec.ts
@@ -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\(\);/);
+ });
+});