fix:401、403错误提示,对话角色更改assistant,模型选择持久化

This commit is contained in:
Gsh
2025-07-05 15:49:29 +08:00
parent 7e4c835ced
commit 23cecb9360
8 changed files with 25 additions and 19 deletions

View File

@@ -4,21 +4,21 @@ import { getModelList } from '@/api';
// 模型管理
export const useModelStore = defineStore('model', () => {
// 当前模型
// 当前模型(需要持久化)
const currentModelInfo = ref<GetSessionListVO>({});
// 模型菜单列表(不需要持久化)
const modelList = ref<GetSessionListVO[]>([]);
// 设置当前模型
const setCurrentModelInfo = (modelInfo: GetSessionListVO) => {
currentModelInfo.value = modelInfo;
};
// 模型菜单列表
const modelList = ref<GetSessionListVO[]>([]);
// 请求模型菜单列表
const requestModelList = async () => {
try {
const res = await getModelList();
console.log('res', res);
modelList.value = res.data;
}
catch (error) {
@@ -32,4 +32,8 @@ export const useModelStore = defineStore('model', () => {
modelList,
requestModelList,
};
}, {
persist: {
paths: ['currentModelInfo'], // 只持久化 currentModelInfo
},
});