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 }}
- +