From f02c6f2b4ce0c0e6564b01c28dafa916a2857730 Mon Sep 17 00:00:00 2001 From: oc Date: Mon, 16 Nov 2026 21:12:45 +0800 Subject: [PATCH] fix(ui): expand and remove every model on the channel form The models picker collapsed the ninth tag and later behind a +N label that cannot be clicked, and it had no options at all, so those models could neither be seen nor removed. Every tag now keeps its remove button, and the dropdown lists fetched and configured models. --- CHANGELOG.md | 4 ++++ frontend/src/i18n/messages.ts | 4 ++-- frontend/src/views/Channels.vue | 12 +++++++++--- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b1e65a8..81c5d40 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ ## [Unreleased] +### 修复 + +- 渠道编辑的“可用模型”把第 9 个及之后的模型折叠成 `+2`,这个标签点不开也删不掉;下拉里又没有任何选项,只显示“无数据”,这些模型既看不到也改不了。现在已选模型全部显示为带删除按钮的标签,下拉列出拉取过的和渠道已配置的模型,可直接勾选取消,也仍可输入新模型名回车添加。 + ## [0.6.2] - 2026-11-14 ### 修复 diff --git a/frontend/src/i18n/messages.ts b/frontend/src/i18n/messages.ts index 8cf6137..3d9b0eb 100644 --- a/frontend/src/i18n/messages.ts +++ b/frontend/src/i18n/messages.ts @@ -380,7 +380,7 @@ export const en = { 'channels.apiKeyOptional': 'Optional for self-hosted services', 'channels.apiKeyHint': 'One key per line. Multiple keys rotate; a rate-limited key pauses automatically. Stored encrypted.', 'channels.keyPool': 'Keys {ready}/{total} ready', - 'channels.modelsHint': 'Fetch from /models, or type a model name and press Enter', + 'channels.modelsHint': 'Fetch from /models, or type a model name and press Enter. Remove a model by unchecking it in the list or clicking × on its tag.', 'channels.modelsPlaceholder': 'Enter a model name and press Enter', 'channels.fetch': 'Fetch', 'channels.mapping': 'Model Mapping', @@ -1192,7 +1192,7 @@ export const zh: Record = { 'channels.apiKeyOptional': '自建服务可以留空', 'channels.apiKeyHint': '每行一个 Key,多个 Key 轮流使用,被限流的自动暂停。加密保存。', 'channels.keyPool': 'Key 可用 {ready}/{total}', - 'channels.modelsHint': '从 /models 拉取,或输入模型名后回车', + 'channels.modelsHint': '从 /models 拉取,或输入模型名后回车;下拉里取消勾选,或点标签上的 × 即可移除模型', 'channels.modelsPlaceholder': '输入模型名后回车', 'channels.fetch': '拉取', 'channels.mapping': '模型映射', diff --git a/frontend/src/views/Channels.vue b/frontend/src/views/Channels.vue index ee539e3..3f12137 100644 --- a/frontend/src/views/Channels.vue +++ b/frontend/src/views/Channels.vue @@ -145,11 +145,11 @@ filterable allow-create default-first-option - collapse-tags - :max-collapse-tags="8" :placeholder="t('channels.modelsPlaceholder')" class="grow" - /> + > + + {{ t('channels.fetch') }}
{{ t('channels.modelsHint') }}
@@ -293,6 +293,9 @@ const emptyForm = () => ({ }) const form = ref(emptyForm()) const enabledCount = computed(() => channels.value.filter(channel => channel.is_enabled).length) +/** Candidate models for the picker: fetched from upstream plus the ones already configured on this channel. */ +const fetchedModels = ref([]) +const modelOptions = computed(() => [...new Set([...fetchedModels.value, ...form.value.models])]) const pricingModelOptions = computed(() => [ ...new Set([...form.value.models, ...mappingRows.value.map(row => row.to.trim()).filter(Boolean)]), ]) @@ -417,6 +420,7 @@ async function fetchModels() { added++ } } + fetchedModels.value = [...new Set([...fetchedModels.value, ...res.models])] ElMessage.success(t('channels.fetched', { count: res.models.length, added })) } catch (error) { ElMessage.error(apiError(error, t('channels.fetchFailed'))) @@ -428,6 +432,7 @@ async function fetchModels() { function openCreate() { editingId.value = null form.value = emptyForm() + fetchedModels.value = [] loadRows({}, {}) dialogVisible.value = true } @@ -441,6 +446,7 @@ function openEdit(row: any) { model_mapping: { ...row.model_mapping }, price_overrides: { ...row.price_overrides }, } + fetchedModels.value = [...row.models] loadRows(form.value.model_mapping, form.value.price_overrides) dialogVisible.value = true } -- Gitee