From a20541cd9d0a54dbff0b9112f1299c64347370ff Mon Sep 17 00:00:00 2001 From: wizardchen Date: Fri, 19 Dec 2025 22:52:38 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=AF=B9=E8=AF=9D=E6=A8=A1=E5=9E=8B=E9=80=89=E6=8B=A9=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E7=AE=A1=E7=90=86=EF=BC=8C=E6=94=AF=E6=8C=81store?= =?UTF-8?q?=E5=8F=8C=E5=90=91=E7=BB=91=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/Input-field.vue | 6 +++++- frontend/src/stores/settings.ts | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/Input-field.vue b/frontend/src/components/Input-field.vue index 44534ee3..218bc76c 100644 --- a/frontend/src/components/Input-field.vue +++ b/frontend/src/components/Input-field.vue @@ -104,7 +104,11 @@ const removeSelectedItem = (item: { id: string; type: 'kb' | 'file' }) => { // 模型相关状态 const availableModels = ref([]); -const selectedModelId = ref(''); +// 使用 computed 从 store 读取,并通过 setter 同步回 store +const selectedModelId = computed({ + get: () => settingsStore.conversationModels.selectedChatModelId || '', + set: (val: string) => settingsStore.updateConversationModels({ selectedChatModelId: val }) +}); const conversationConfig = ref(null); const modelsLoading = ref(false); const showModelSelector = ref(false); diff --git a/frontend/src/stores/settings.ts b/frontend/src/stores/settings.ts index 4e2b1e97..2f87b20a 100644 --- a/frontend/src/stores/settings.ts +++ b/frontend/src/stores/settings.ts @@ -28,6 +28,7 @@ interface AgentConfig { interface ConversationModels { summaryModelId: string; rerankModelId: string; + selectedChatModelId: string; // 用户当前选择的对话模型ID } // 单个模型项接口 @@ -87,6 +88,7 @@ const defaultSettings: Settings = { conversationModels: { summaryModelId: "", rerankModelId: "", + selectedChatModelId: "", // 用户当前选择的对话模型ID } };