From a1ddd1c3e287c4aeff2dd8a626e5979a6ab498f6 Mon Sep 17 00:00:00 2001 From: Gsh <15170702455@163.com> Date: Sun, 11 Jan 2026 19:42:33 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=A8=A1=E5=9E=8B=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/ModelSelect/index.vue | 57 ++++++++++++++----- 1 file changed, 43 insertions(+), 14 deletions(-) diff --git a/Yi.Ai.Vue3/src/components/ModelSelect/index.vue b/Yi.Ai.Vue3/src/components/ModelSelect/index.vue index e5137632..0bb91a84 100644 --- a/Yi.Ai.Vue3/src/components/ModelSelect/index.vue +++ b/Yi.Ai.Vue3/src/components/ModelSelect/index.vue @@ -92,9 +92,32 @@ watch(activeTab, () => { }); }); +// 检查是否为当前选中的模型 +function isCurrentModel(item: GetSessionListVO) { + const current = modelStore.currentModelInfo; + if (!current) + return false; + + // 优先使用唯一 ID 匹配 + if (item.id && current.id) { + return item.id === current.id; + } + + // 降级使用组合键匹配 + return item.modelId === current.modelId + && item.modelApiType === current.modelApiType + && item.providerName === current.providerName; +} + // 定位到当前模型 function scrollToCurrentModel() { - const currentId = modelStore.currentModelInfo?.modelId; + const current = modelStore.currentModelInfo; + if (!current) + return; + + // 使用 item.id 构建 ID (假设 modelData.ts 中的 id 是唯一的) + // 如果没有 id,则无法精确定位,这里假设都有 id + const currentId = current.id; if (!currentId) return; @@ -166,7 +189,7 @@ function getModelStyleClass(mode: any) { const isPremiumPackage = mode.isPremiumPackage; - // 规则3:彩色流光 + // 规则3:彩色流光 (尊享) if (isPremiumPackage) { return ` text-transparent bg-clip-text @@ -180,7 +203,7 @@ function getModelStyleClass(mode: any) { return 'text-gray-700'; } - // 规则1:金色光泽 + // 规则1:金色光泽 (VIP) return ` text-[#B38728] font-semibold relative overflow-hidden before:content-[''] before:absolute before:-inset-2 before:-z-10 @@ -192,7 +215,7 @@ function getModelStyleClass(mode: any) { 外层卡片样式(选中态 + hover 动效) -------------------------------- */ function getWrapperClass(item: GetSessionListVO) { - const isSelected = item.modelId === modelStore.currentModelInfo?.modelId; + const isSelected = isCurrentModel(item); const available = isModelAvailable(item); return [ @@ -254,7 +277,7 @@ function getWrapperClass(item: GetSessionListVO) {
-
+
{{ item.modelName }} 免费 - VIP + 尊享 + VIP + + {{ item.modelApiType }}
-
+
{{ item.modelDescribe }}
@@ -283,7 +309,7 @@ function getWrapperClass(item: GetSessionListVO) {
- + @@ -306,7 +332,7 @@ function getWrapperClass(item: GetSessionListVO) {
-
+
{{ item.modelName }} 免费 - VIP + 尊享 + VIP + + {{ item.providerName }}
-
+
{{ item.modelDescribe }}
- +