perf: 主agent对话交互调整

This commit is contained in:
rd
2025-08-28 12:03:52 +08:00
parent ce5bd35e37
commit 10fc946eca
13 changed files with 190 additions and 136 deletions

View File

@ -1,7 +1,8 @@
import { defineStore } from 'pinia';
import { createSession, getAgentInfo } from '@/api/all/chat';
import { createSession, getAgentData } from '@/api/all/chat';
import { handleUserHome } from '@/utils/user';
import { glsWithCatch, slsWithCatch, rlsWithCatch } from '@/utils/stroage';
interface ChatState {
searchValue?: string;
@ -16,7 +17,7 @@ type agentInfo = {
export const useChatStore = defineStore('chat', {
state: (): ChatState => ({
searchValue: '',
agentInfo: {},
agentInfo: (glsWithCatch('agentInfo') && JSON.parse(glsWithCatch('agentInfo') as string)) || {},
}),
actions: {
setSearchValue(searchValue: string) {
@ -26,19 +27,17 @@ export const useChatStore = defineStore('chat', {
this.searchValue = '';
},
async getAgentInfo() {
const { code, data } = await getAgentInfo();
const { code, data } = await getAgentData();
if (code === 200) {
this.setAgentInfo(data);
}
},
setAgentInfo(agentInfo: agentInfo) {
this.agentInfo = agentInfo;
slsWithCatch('agentInfo', JSON.stringify(agentInfo));
},
clearAgentInfo() {
this.agentInfo = {};
},
clearAllAgentInfo() {
this.agentInfo = {};
this.searchValue = '';
},
async onCreateSession() {