feat(ai): localize custom provider label

This commit is contained in:
t8y2 committed 2026-08-27 16:23:51 +08:00
1 parent 565feb8745
commit 36a7b7bd3a
11 files changed
+23 -13

No files matched your search

+6
View File
@@ -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;