Skip to content

Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.

feat: 新增用户对话模型选择状态管理,支持store双向绑定

wizardchena20541cd9d0a
diff --git a/frontend/src/components/Input-field.vue b/frontend/src/components/Input-field.vue
index 44534ee3a..218bc76cc 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<ModelConfig[]>([]);
-const selectedModelId = ref<string>('');
+// 使用 computed 从 store 读取,并通过 setter 同步回 store
+const selectedModelId = computed({
+ get: () => settingsStore.conversationModels.selectedChatModelId || '',
+ set: (val: string) => settingsStore.updateConversationModels({ selectedChatModelId: val })
+});
const conversationConfig = ref<ConversationConfig | null>(null);
const modelsLoading = ref(false);
const showModelSelector = ref(false);
diff --git a/frontend/src/stores/settings.ts b/frontend/src/stores/settings.ts
index 4e2b1e97e..2f87b20ae 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
}
};