diff --git a/web/src/app/wizard/page.tsx b/web/src/app/wizard/page.tsx index c30340eaa..c40c209a6 100644 --- a/web/src/app/wizard/page.tsx +++ b/web/src/app/wizard/page.tsx @@ -1201,11 +1201,24 @@ function WizardModelScan({ }); }; + const getExistingModelNames = async (): Promise> => { + if (!providerUuid) return new Set(); + try { + const resp = await httpClient.getProviderLLMModels(providerUuid); + return new Set((resp.models ?? []).map((m: { name: string }) => m.name)); + } catch { + return new Set(); + } + }; + const handleAddSelected = async () => { if (!providerUuid || selectedModels.size === 0) return; setAdding(true); try { + const existing = await getExistingModelNames(); + let added = 0; for (const name of selectedModels) { + if (existing.has(name)) continue; const model = scannedModels.find((m) => m.name === name); await httpClient.createProviderLLMModel({ name, @@ -1215,10 +1228,12 @@ function WizardModelScan({ context_length: model?.context_length ?? null, extra_args: {}, } as never); + existing.add(name); + added++; + } + if (added > 0) { + toast.success(t('wizard.provider.modelsAdded', { count: added })); } - toast.success( - t('wizard.provider.modelsAdded', { count: selectedModels.size }), - ); setAddedModelNames((prev) => { const next = new Set(prev); for (const name of selectedModels) next.add(name); @@ -1238,6 +1253,12 @@ function WizardModelScan({ if (!providerUuid || !name) return; setManualAdding(true); try { + const existing = await getExistingModelNames(); + if (existing.has(name)) { + toast.error(t('wizard.provider.modelAlreadyExists', { name })); + setManualAdding(false); + return; + } await httpClient.createProviderLLMModel({ name, provider_uuid: providerUuid, diff --git a/web/src/i18n/locales/en-US.ts b/web/src/i18n/locales/en-US.ts index 968f4a67d..861c02c78 100644 --- a/web/src/i18n/locales/en-US.ts +++ b/web/src/i18n/locales/en-US.ts @@ -1874,6 +1874,7 @@ const enUS = { addManual: 'Add', saveAndNext: 'Save & Next', alreadyAdded: 'Added', + modelAlreadyExists: 'Model "{{name}}" already exists', }, modelSource: { title: 'Choose Model Source', diff --git a/web/src/i18n/locales/es-ES.ts b/web/src/i18n/locales/es-ES.ts index 6895579e6..9a6421b21 100644 --- a/web/src/i18n/locales/es-ES.ts +++ b/web/src/i18n/locales/es-ES.ts @@ -1732,6 +1732,7 @@ const esES = { addManual: 'Agregar', saveAndNext: 'Guardar y siguiente', alreadyAdded: 'Agregado', + modelAlreadyExists: 'El modelo "{{name}}" ya existe', }, modelSource: { title: 'Elegir fuente del modelo', diff --git a/web/src/i18n/locales/ja-JP.ts b/web/src/i18n/locales/ja-JP.ts index 1404b9996..3f91feea4 100644 --- a/web/src/i18n/locales/ja-JP.ts +++ b/web/src/i18n/locales/ja-JP.ts @@ -1793,6 +1793,7 @@ const jaJP = { addManual: '追加', saveAndNext: '保存して次へ', alreadyAdded: '追加済み', + modelAlreadyExists: 'モデル「{{name}}」は既に存在します', }, modelSource: { title: 'モデルソースを選択', diff --git a/web/src/i18n/locales/ru-RU.ts b/web/src/i18n/locales/ru-RU.ts index 07d82b9f8..c85579c2a 100644 --- a/web/src/i18n/locales/ru-RU.ts +++ b/web/src/i18n/locales/ru-RU.ts @@ -1702,6 +1702,7 @@ const ruRU = { addManual: 'Добавить', saveAndNext: 'Сохранить и далее', alreadyAdded: 'Добавлено', + modelAlreadyExists: 'Модель "{{name}}" уже существует', }, modelSource: { title: 'Выберите источник модели', diff --git a/web/src/i18n/locales/th-TH.ts b/web/src/i18n/locales/th-TH.ts index 9e591db36..06eaa0574 100644 --- a/web/src/i18n/locales/th-TH.ts +++ b/web/src/i18n/locales/th-TH.ts @@ -1666,6 +1666,7 @@ const thTH = { addManual: 'เพิ่ม', saveAndNext: 'บันทึกและถัดไป', alreadyAdded: 'เพิ่มแล้ว', + modelAlreadyExists: 'โมเดล "{{name}}" มีอยู่แล้ว', }, modelSource: { title: 'เลือกแหล่งโมเดล', diff --git a/web/src/i18n/locales/vi-VN.ts b/web/src/i18n/locales/vi-VN.ts index 057512422..9f7f200cd 100644 --- a/web/src/i18n/locales/vi-VN.ts +++ b/web/src/i18n/locales/vi-VN.ts @@ -1692,6 +1692,7 @@ const viVN = { addManual: 'Thêm', saveAndNext: 'Lưu & Tiếp theo', alreadyAdded: 'Đã thêm', + modelAlreadyExists: 'Mô hình "{{name}}" đã tồn tại', }, modelSource: { title: 'Chọn nguồn mô hình', diff --git a/web/src/i18n/locales/zh-Hans.ts b/web/src/i18n/locales/zh-Hans.ts index c02ff3fa8..23866fb14 100644 --- a/web/src/i18n/locales/zh-Hans.ts +++ b/web/src/i18n/locales/zh-Hans.ts @@ -1790,6 +1790,7 @@ const zhHans = { addManual: '添加', saveAndNext: '保存并下一步', alreadyAdded: '已添加', + modelAlreadyExists: '模型 "{{name}}" 已存在', }, modelSource: { title: '选择模型来源', diff --git a/web/src/i18n/locales/zh-Hant.ts b/web/src/i18n/locales/zh-Hant.ts index a7c096a8a..ce8568374 100644 --- a/web/src/i18n/locales/zh-Hant.ts +++ b/web/src/i18n/locales/zh-Hant.ts @@ -1613,6 +1613,7 @@ const zhHant = { addManual: '新增', saveAndNext: '儲存並下一步', alreadyAdded: '已新增', + modelAlreadyExists: '模型「{{name}}」已存在', }, modelSource: { title: '選擇模型來源',