From d5694bc269df571db10f987e2ce21902c55d2ddf Mon Sep 17 00:00:00 2001 From: tbphp Date: Sat, 1 Aug 2026 19:03:33 +0800 Subject: [PATCH] =?UTF-8?q?fix(web):=20=E5=AE=8C=E5=96=84=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E7=BB=84=E4=BB=B6=E6=A0=A1=E9=AA=8C=E4=B8=8E=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6=E5=A4=8D=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/components/ui/AppTextInput.vue | 182 +++++++++++++++ .../features/groups/models/GroupModelsTab.vue | 15 +- web/src/features/models/ModelAliasEditor.vue | 208 ++++++++---------- .../features/models/ModelDiscoveryDrawer.vue | 43 +--- web/src/features/models/model-draft.ts | 26 +++ web/src/i18n/locales/en-US/group.ts | 3 + web/src/i18n/locales/ja-JP/group.ts | 3 + web/src/i18n/locales/zh-CN/group.ts | 3 + 8 files changed, 322 insertions(+), 161 deletions(-) create mode 100644 web/src/components/ui/AppTextInput.vue diff --git a/web/src/components/ui/AppTextInput.vue b/web/src/components/ui/AppTextInput.vue new file mode 100644 index 00000000..fce5e538 --- /dev/null +++ b/web/src/components/ui/AppTextInput.vue @@ -0,0 +1,182 @@ + + + + + diff --git a/web/src/features/groups/models/GroupModelsTab.vue b/web/src/features/groups/models/GroupModelsTab.vue index bcca611d..cd87e05a 100644 --- a/web/src/features/groups/models/GroupModelsTab.vue +++ b/web/src/features/groups/models/GroupModelsTab.vue @@ -25,6 +25,7 @@ import ModelDiscoveryDrawer from '@/features/models/ModelDiscoveryDrawer.vue' import { createModelDraft, findModelNameConflicts, + modelDraftValidity, normalizedModels, sameModels, type ModelAliasEditorLabels, @@ -58,14 +59,7 @@ const conflicts = computed(() => ? serverConflicts.value : findModelNameConflicts(normalizedModels(draft.value)), ) -const emptyAliasIndexes = computed( - () => - new Set( - draft.value.flatMap((item, index) => - item.alias_enabled && !item.alias.trim() ? [index] : [], - ), - ), -) +const validity = computed(() => modelDraftValidity(draft.value, conflicts.value)) const dirty = computed(() => !sameModels(saved.value, draft.value)) const empty = computed(() => normalizedModels(draft.value).length === 0) const canSave = computed( @@ -73,7 +67,7 @@ const canSave = computed( dirty.value && pending.value === null && conflicts.value.length === 0 && - emptyAliasIndexes.value.size === 0, + validity.value.emptyAliasIndexes.size === 0, ) const unpriced = computed( () => draft.value.filter((item) => item.pricing_status === 'unpriced').length, @@ -95,7 +89,10 @@ const aliasEditorLabels = computed(() => ({ manualId: t('group.modelEditor.manualId'), add: t('group.modelEditor.add'), empty: t('group.modelEditor.empty'), + noMatches: t('group.modelEditor.noMatches'), conflictSummary: t('group.modelEditor.conflictSummary'), + emptyAliasSummary: t('group.modelEditor.emptyAliasSummary'), + locateFirstInvalid: t('group.modelEditor.locateFirstInvalid'), nameConflict: (name) => t('group.modelEditor.nameConflict', { name }), })) const discoveryDrawerLabels = computed(() => ({ diff --git a/web/src/features/models/ModelAliasEditor.vue b/web/src/features/models/ModelAliasEditor.vue index 05efd234..90dc9bc5 100644 --- a/web/src/features/models/ModelAliasEditor.vue +++ b/web/src/features/models/ModelAliasEditor.vue @@ -1,14 +1,15 @@