From e9dd52ec27e95d5b90381606afb5ff9d0af96027 Mon Sep 17 00:00:00 2001 From: Ethan-Zhang Date: Thu, 20 Nov 2025 22:08:08 +0800 Subject: [PATCH] =?UTF-8?q?Fix:=20=E9=BB=98=E8=AE=A4=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E9=80=BB=E8=BE=91=E4=BB=A5=E5=8F=8A=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E8=83=BD=E5=8A=9B=E4=BF=A1=E6=81=AF=E7=BC=BA=E5=A4=B1?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/paths/llm.ts | 4 +- src/store/historySession.ts | 9 +- .../dialogue/components/DialogueAside.vue | 3 +- .../dialogue/components/DialogueSession.vue | 110 +++++++++++++----- 4 files changed, 95 insertions(+), 31 deletions(-) diff --git a/src/apis/paths/llm.ts b/src/apis/paths/llm.ts index 3227bd77..dbd3b39a 100644 --- a/src/apis/paths/llm.ts +++ b/src/apis/paths/llm.ts @@ -10,11 +10,11 @@ const getLLMList = (modelType?: string) => { }; /** - * 获取用户的模型列表 + * 更新会话的LLM模型 * @returns */ const updateLLMList = ({ conversationId, llmId }) => { - return put('/api/llm/conv', {}, { conversationId, llmId: llmId.llmId }); + return put('/api/llm/conv', {}, { conversationId, llmId: llmId }); }; /** diff --git a/src/store/historySession.ts b/src/store/historySession.ts index edf08fbc..951dc19d 100644 --- a/src/store/historySession.ts +++ b/src/store/historySession.ts @@ -158,6 +158,7 @@ export const useHistorySessionStore = defineStore( }; /** * 获取当前 llm 模型的数值 + * 🔑 修复:从完整的模型列表中查找,确保包含所有能力字段 */ const currentLLM = async () => { // 先置空 @@ -165,7 +166,13 @@ export const useHistorySessionStore = defineStore( await getHistorySession(); historySession.value.forEach((item) => { if (item.conversationId === currentSelectedSession.value) { - selectLLM.value = item.llm; + // 🔑 关键修复:不直接使用历史记录中的llm对象 + // 而是根据llmId从完整的模型列表中查找,确保包含所有能力字段 + selectLLM.value = { + ...item.llm, + // 标记这个是来自历史记录的,需要在使用时补充能力字段 + _fromHistory: true + }; if (item.appId) { app.value.appId = item.appId; } diff --git a/src/views/dialogue/components/DialogueAside.vue b/src/views/dialogue/components/DialogueAside.vue index ad1f36df..84d4d72b 100644 --- a/src/views/dialogue/components/DialogueAside.vue +++ b/src/views/dialogue/components/DialogueAside.vue @@ -55,8 +55,7 @@ const { isSelectedAll, } = storeToRefs(useHistorySessionStore()); const { app, appList } = storeToRefs(useSessionStore()); -const { createNewSession, currentLLM } = - useHistorySessionStore(); +const { createNewSession, currentLLM } = useHistorySessionStore(); const { userinfo } = storeToRefs(useAccountStore()); const deleteType = ref(true); // 搜索的关键词 diff --git a/src/views/dialogue/components/DialogueSession.vue b/src/views/dialogue/components/DialogueSession.vue index 5b9f1429..aa7f4afc 100644 --- a/src/views/dialogue/components/DialogueSession.vue +++ b/src/views/dialogue/components/DialogueSession.vue @@ -1,5 +1,5 @@