perf: 主agent对话交互调整
This commit is contained in:
@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user