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。

feat(ai): localize custom provider label

t8y236a7b7bd3a49
diff --git a/apps/desktop/src/components/editor/AiAssistant.vue b/apps/desktop/src/components/editor/AiAssistant.vue
index e0553137f6..b2c055c9d8 100644
--- a/apps/desktop/src/components/editor/AiAssistant.vue
+++ b/apps/desktop/src/components/editor/AiAssistant.vue
@@ -55,7 +55,7 @@ import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, D
import { useTheme } from "@/composables/useTheme";
import CodeSnapshotDialog from "@/components/codeSnapshot/CodeSnapshotDialog.vue";
import type { CodeSnapshotSource } from "@/lib/codeSnapshot/codeSnapshot";
-import { useSettingsStore, AI_PROVIDER_PRESETS, normalizeAiConfig } from "@/stores/settingsStore";
+import { useSettingsStore, AI_PROVIDER_PRESETS, aiProviderLabel, normalizeAiConfig } from "@/stores/settingsStore";
import AiProviderLogo from "@/components/icons/AiProviderLogo.vue";
import { useConnectionStore } from "@/stores/connectionStore";
import { useSavedSqlStore } from "@/stores/savedSqlStore";
@@ -725,7 +725,7 @@ function getModelsForConfig(configId: string) {
}
function configMatchesModelQuery(config: AiConfigItem, query: string): boolean {
- return config.name.toLowerCase().includes(query) || config.provider.toLowerCase().includes(query) || AI_PROVIDER_PRESETS[config.provider].label.toLowerCase().includes(query);
+ return config.name.toLowerCase().includes(query) || config.provider.toLowerCase().includes(query) || aiProviderLabel(config.provider, t).toLowerCase().includes(query) || AI_PROVIDER_PRESETS[config.provider].label.toLowerCase().includes(query);
}
function getConfigModelOptions(config: AiConfigItem) {
@@ -5001,12 +5001,7 @@ async function openExternalUrl(url: string) {
<Popover v-model:open="providerSelectorOpen">
<PopoverTrigger as-child>
<button type="button" class="min-w-0 flex shrink items-center gap-1.5 max-w-[220px] rounded-[6px] border px-2 py-0.5 text-[11px] text-muted-foreground hover:bg-muted hover:text-foreground">
- <AiProviderLogo
- :provider="activeFullConfig?.provider ?? 'claude'"
- :label="AI_PROVIDER_PRESETS[activeFullConfig?.provider ?? 'claude']?.label ?? activeFullConfig?.provider ?? 'claude'"
- :icon-slug="AI_PROVIDER_PRESETS[activeFullConfig?.provider ?? 'claude']?.iconSlug"
- class="h-3 w-3 shrink-0"
- />
+ <AiProviderLogo :provider="activeFullConfig?.provider ?? 'claude'" :label="aiProviderLabel(activeFullConfig?.provider ?? 'claude', t)" :icon-slug="AI_PROVIDER_PRESETS[activeFullConfig?.provider ?? 'claude']?.iconSlug" class="h-3 w-3 shrink-0" />
<span class="min-w-0 truncate">{{ activeFullConfig?.model || t("ai.selectModel") }}</span>
<svg class="h-3 w-3 shrink-0 opacity-60" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="m6 9 6 6 6-6" /></svg>
</button>
diff --git a/apps/desktop/src/components/editor/EditorSettingsDialog.vue b/apps/desktop/src/components/editor/EditorSettingsDialog.vue
index 59a7156fa4..6e578c3fee 100644
--- a/apps/desktop/src/components/editor/EditorSettingsDialog.vue
+++ b/apps/desktop/src/components/editor/EditorSettingsDialog.vue
@@ -51,6 +51,7 @@ import { HelpTooltip, Tooltip, TooltipContent, TooltipTrigger, TooltipProvider }
import {
useSettingsStore,
AI_PROVIDER_PRESETS,
+ aiProviderLabel,
EDITOR_THEMES,
DEFAULT_EDITOR_SETTINGS,
DEFAULT_DESKTOP_SETTINGS,
@@ -6282,7 +6283,7 @@ onUnmounted(() => {
</Badge>
</div>
<div class="text-xs text-muted-foreground">
- {{ AI_PROVIDER_PRESETS[config.provider].label }}
+ {{ aiProviderLabel(config.provider, t) }}
</div>
</div>
</div>
@@ -6531,8 +6532,8 @@ onUnmounted(() => {
<SelectTrigger class="col-span-2" inputClass="h-8 text-xs">
<SelectValue>
<span class="flex items-center gap-2">
- <AiProviderLogo :provider="selectedAiProviderPreset.provider" :label="selectedAiProviderPreset.label" :icon-slug="selectedAiProviderPreset.iconSlug" />
- <span>{{ selectedAiProviderPreset.label }}</span>
+ <AiProviderLogo :provider="selectedAiProviderPreset.provider" :label="aiProviderLabel(selectedAiProviderPreset.provider, t)" :icon-slug="selectedAiProviderPreset.iconSlug" />
+ <span>{{ aiProviderLabel(selectedAiProviderPreset.provider, t) }}</span>
</span>
</SelectValue>
</SelectTrigger>
@@ -6540,8 +6541,8 @@ onUnmounted(() => {
<SelectItem v-for="provider in aiProviderOptions" :key="provider.provider" :value="provider.provider">
<span class="flex w-full items-center justify-between gap-4">
<span class="flex items-center gap-2">
- <AiProviderLogo :provider="provider.provider" :label="provider.label" :icon-slug="provider.iconSlug" />
- <span>{{ provider.label }}</span>
+ <AiProviderLogo :provider="provider.provider" :label="aiProviderLabel(provider.provider, t)" :icon-slug="provider.iconSlug" />
+ <span>{{ aiProviderLabel(provider.provider, t) }}</span>
</span>
</span>
</SelectItem>
diff --git a/apps/desktop/src/i18n/locales/en.ts b/apps/desktop/src/i18n/locales/en.ts
index 073a48a1c2..8b682efcb8 100644
--- a/apps/desktop/src/i18n/locales/en.ts
+++ b/apps/desktop/src/i18n/locales/en.ts
@@ -2437,6 +2437,7 @@ export default {
settings: "AI Settings",
noConfig: "AI is not configured. Please set up your AI provider in Settings > AI.",
provider: "Provider",
+ providerCustom: "Custom",
providerStatusActive: "Active",
providerStatusConfigured: "Configured",
switchProvider: "Switch Provider",
diff --git a/apps/desktop/src/i18n/locales/es.ts b/apps/desktop/src/i18n/locales/es.ts
index 345aed9932..c2d53bd63e 100644
--- a/apps/desktop/src/i18n/locales/es.ts
+++ b/apps/desktop/src/i18n/locales/es.ts
@@ -2373,6 +2373,7 @@ export default withEnglishFallback({
settings: "Configuración de IA",
noConfig: "La IA no está configurada. Configura tu proveedor de IA en Ajustes > IA.",
provider: "Proveedor",
+ providerCustom: "Personalizado",
providerStatusActive: "Activo",
providerStatusConfigured: "Configurado",
switchProvider: "Cambiar proveedor",
diff --git a/apps/desktop/src/i18n/locales/it.ts b/apps/desktop/src/i18n/locales/it.ts
index e4735b8e39..9458ca1de0 100644
--- a/apps/desktop/src/i18n/locales/it.ts
+++ b/apps/desktop/src/i18n/locales/it.ts
@@ -2371,6 +2371,7 @@ export default withEnglishFallback({
settings: "Impostazioni AI",
noConfig: "L'AI non è configurata. Configura il tuo provider AI in Impostazioni > AI.",
provider: "Provider",
+ providerCustom: "Personalizzato",
providerStatusActive: "Attivo",
providerStatusConfigured: "Configurato",
switchProvider: "Cambia provider",
diff --git a/apps/desktop/src/i18n/locales/ja.ts b/apps/desktop/src/i18n/locales/ja.ts
index ed5b77f0a2..e06ac5ae77 100644
--- a/apps/desktop/src/i18n/locales/ja.ts
+++ b/apps/desktop/src/i18n/locales/ja.ts
@@ -2397,6 +2397,7 @@ export default withEnglishFallback({
settings: "AI設定",
noConfig: "AIが設定されていません。設定 > AIでAIプロバイダーを設定してください。",
provider: "プロバイダー",
+ providerCustom: "カスタム",
providerStatusActive: "使用中",
providerStatusConfigured: "設定済み",
switchProvider: "プロバイダーを切替",
diff --git a/apps/desktop/src/i18n/locales/ko.ts b/apps/desktop/src/i18n/locales/ko.ts
index 08469fb477..e9ef63be6f 100644
--- a/apps/desktop/src/i18n/locales/ko.ts
+++ b/apps/desktop/src/i18n/locales/ko.ts
@@ -2269,6 +2269,7 @@ export default withEnglishFallback({
settings: "AI 설정",
noConfig: "AI가 구성되지 않았습니다. 설정 > AI에서 AI 공급자를 설정하세요.",
provider: "공급자",
+ providerCustom: "사용자 지정",
providerStatusActive: "활성",
providerStatusConfigured: "구성됨",
switchProvider: "공급자 전환",
diff --git a/apps/desktop/src/i18n/locales/pt-BR.ts b/apps/desktop/src/i18n/locales/pt-BR.ts
index c05d59b4e2..88d0ae9553 100644
--- a/apps/desktop/src/i18n/locales/pt-BR.ts
+++ b/apps/desktop/src/i18n/locales/pt-BR.ts
@@ -2373,6 +2373,7 @@ export default withEnglishFallback({
settings: "Configurações de AI",
noConfig: "A AI não está configurada. Configure seu provedor de AI em Configurações > AI.",
provider: "Provedor",
+ providerCustom: "Personalizado",
providerStatusActive: "Ativo",
providerStatusConfigured: "Configurado",
switchProvider: "Trocar provedor",
diff --git a/apps/desktop/src/i18n/locales/zh-CN.ts b/apps/desktop/src/i18n/locales/zh-CN.ts
index b97cc804e8..d26f9b4219 100644
--- a/apps/desktop/src/i18n/locales/zh-CN.ts
+++ b/apps/desktop/src/i18n/locales/zh-CN.ts
@@ -2361,6 +2361,7 @@ export default withEnglishFallback({
settings: "AI 设置",
noConfig: "AI 尚未配置。请在 设置 > AI 中配置你的 AI 服务。",
provider: "提供商",
+ providerCustom: "自定义",
providerStatusActive: "当前",
providerStatusConfigured: "已配置",
switchProvider: "切换服务商",
diff --git a/apps/desktop/src/i18n/locales/zh-TW.ts b/apps/desktop/src/i18n/locales/zh-TW.ts
index 9e327c31c4..30ac83401b 100644
--- a/apps/desktop/src/i18n/locales/zh-TW.ts
+++ b/apps/desktop/src/i18n/locales/zh-TW.ts
@@ -2371,6 +2371,7 @@ export default withEnglishFallback({
settings: "AI 設定",
noConfig: "AI 尚未設定。請在 設定 > AI 中設定你的 AI 服務。",
provider: "供應商",
+ providerCustom: "自訂",
providerStatusActive: "目前",
providerStatusConfigured: "已設定",
switchProvider: "切換服務商",
diff --git a/apps/desktop/src/stores/settingsStore.ts b/apps/desktop/src/stores/settingsStore.ts
index a3b30d55e5..533286b1f0 100644
--- a/apps/desktop/src/stores/settingsStore.ts
+++ b/apps/desktop/src/stores/settingsStore.ts
@@ -313,6 +313,12 @@ export const AI_PROVIDER_PRESETS: Record<AiProvider, AiProviderPreset> = {
},
};
+/** Brand names stay as preset labels; only the generic "custom" entry is localized. */
+export function aiProviderLabel(provider: AiProvider, t: (key: string) => string): string {
+ if (provider === "custom") return t("ai.providerCustom");
+ return AI_PROVIDER_PRESETS[provider].label;
+}
+
const defaultConfigs: Record<AiProvider, Omit<AiConfig, "apiKey">> = Object.fromEntries(
Object.entries(AI_PROVIDER_PRESETS).map(([provider, preset]) => {
const { label: _label, iconSlug: _iconSlug, requiresApiKey: _requiresApiKey, ...config } = preset;