diff --git a/src/features/providers/sheets/forms/BaseProviderForm.tsx b/src/features/providers/sheets/forms/BaseProviderForm.tsx index eed645a..8290634 100644 --- a/src/features/providers/sheets/forms/BaseProviderForm.tsx +++ b/src/features/providers/sheets/forms/BaseProviderForm.tsx @@ -9,6 +9,7 @@ import { IconX, } from '@/components/ui/icons'; import { Collapsible } from '@/components/ui/Collapsible'; +import { Select } from '@/components/ui/Select'; import { hasDisableAllModelsRule } from '@/components/providers/utils'; import type { GeminiKeyConfig, @@ -271,6 +272,33 @@ export function BaseProviderForm({ return set; }, [form.models]); + const testModelOptions = useMemo(() => { + const seen = new Set(); + const names: string[] = []; + form.models.forEach((m) => { + const name = (m.name ?? '').trim(); + if (!name || seen.has(name)) return; + seen.add(name); + names.push(name); + }); + const firstName = names[0]; + const autoLabel = firstName + ? t('providersPage.form.testModelAutoWith', { name: firstName }) + : t('providersPage.form.testModelAutoEmpty'); + const opts: Array<{ value: string; label: string }> = [ + { value: '', label: autoLabel }, + ]; + names.forEach((n) => opts.push({ value: n, label: n })); + const tm = (form.testModel ?? '').trim(); + if (tm && !seen.has(tm)) { + opts.push({ + value: tm, + label: t('providersPage.form.testModelCustom', { name: tm }), + }); + } + return opts; + }, [form.models, form.testModel, t]); + const openDiscovery = () => { setDiscoveryOpen(true); if (!discovery.loading && !discovery.hasFetched) { @@ -518,12 +546,13 @@ export function BaseProviderForm({ ) : null} - updateField('testModel', e.target.value)} + options={testModelOptions} + onChange={(value) => updateField('testModel', value)} disabled={mutating} + ariaLabel={t('providersPage.form.testModel')} /> {brand === 'claude' ? (
diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index e8cad36..7bc3119 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -1550,6 +1550,9 @@ "websockets": "Enable WebSockets", "testModel": "Test model", "testModelClaudeHint": "Used for connectivity testing only; not saved", + "testModelAutoWith": "Auto · {{name}}", + "testModelAutoEmpty": "Auto (no models added yet)", + "testModelCustom": "{{name}} (custom)", "modelsSection": "Custom models", "addModel": "Add model", "headersSection": "Request headers", diff --git a/src/i18n/locales/ru.json b/src/i18n/locales/ru.json index 7139fd8..5d40d62 100644 --- a/src/i18n/locales/ru.json +++ b/src/i18n/locales/ru.json @@ -1547,6 +1547,9 @@ "websockets": "Включить WebSockets", "testModel": "Тестовая модель", "testModelClaudeHint": "Используется только для проверки соединения; не сохраняется", + "testModelAutoWith": "Авто · {{name}}", + "testModelAutoEmpty": "Авто (модели ещё не добавлены)", + "testModelCustom": "{{name}} (своя)", "modelsSection": "Пользовательские модели", "addModel": "Добавить модель", "headersSection": "Заголовки запроса", diff --git a/src/i18n/locales/zh-CN.json b/src/i18n/locales/zh-CN.json index f25ca73..ec95ca0 100644 --- a/src/i18n/locales/zh-CN.json +++ b/src/i18n/locales/zh-CN.json @@ -1550,6 +1550,9 @@ "websockets": "启用 WebSockets", "testModel": "测试模型", "testModelClaudeHint": "仅用于连通性测试,不会被保存", + "testModelAutoWith": "自动 · {{name}}", + "testModelAutoEmpty": "自动(尚未添加模型)", + "testModelCustom": "{{name}}(自定义)", "modelsSection": "自定义模型", "addModel": "添加模型", "headersSection": "请求头", diff --git a/src/i18n/locales/zh-TW.json b/src/i18n/locales/zh-TW.json index 80cccb5..fd6a7a7 100644 --- a/src/i18n/locales/zh-TW.json +++ b/src/i18n/locales/zh-TW.json @@ -1576,6 +1576,9 @@ "websockets": "啟用 WebSockets", "testModel": "測試模型", "testModelClaudeHint": "僅用於連通性測試,不會被儲存", + "testModelAutoWith": "自動 · {{name}}", + "testModelAutoEmpty": "自動(尚未新增模型)", + "testModelCustom": "{{name}}(自訂)", "modelsSection": "自訂模型", "addModel": "新增模型", "headersSection": "請求標頭",