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

This commit is contained in:
wizardchen
2025-12-19 22:52:38 +08:00
committed by lyingbug
parent da55707022
commit a20541cd9d
2 changed files with 7 additions and 1 deletions
+5 -1
View File
@@ -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);
+2
View File
@@ -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
}
};