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): format pre-load database fallback with shared label helper

U1556c31388091
diff --git a/apps/desktop/src/components/editor/AiAssistant.vue b/apps/desktop/src/components/editor/AiAssistant.vue
index 9b651a508d..601bc4e397 100644
--- a/apps/desktop/src/components/editor/AiAssistant.vue
+++ b/apps/desktop/src/components/editor/AiAssistant.vue
@@ -1521,7 +1521,25 @@ const selectedDatabaseValues = computed(() => new Set(selectedDatabases.value));
const selectedDatabaseLabel = computed(() => {
if (!props.connection) return t("editor.selectDatabase");
const labels = dbSelectOptions.value.filter((option) => selectedDatabaseValues.value.has(option.database)).map((option) => option.label);
- return labels.length ? labels.join(", ") : t("editor.selectDatabase");
+ if (labels.length) return labels.join(", ");
+ // The options list loads asynchronously (on popover open or connection
+ // switch), so before it arrives the selection is still valid — fall back to
+ // the raw database names instead of the "select database" placeholder,
+ // which made the button look unselected while the dropdown showed a check.
+ // Format with the same helper as the option labels so the text stays
+ // identical once the options load (e.g. Redis "db0", localized defaults).
+ const raw = [...selectedDatabaseValues.value];
+ if (raw.length) {
+ return raw
+ .map((database) =>
+ formatDatabaseLabel(props.connection, database, {
+ defaultDatabase: t("editor.defaultDatabase"),
+ noDatabase: t("editor.noDatabase"),
+ }),
+ )
+ .join(", ");
+ }
+ return t("editor.selectDatabase");
});
function syncSelectedDatabases() {