zb 2 роки тому
батько
коміт
b5c83e8275

+ 22 - 0
SEChat-frontend/src/store/modules/agent/helper.ts

@@ -0,0 +1,22 @@
+import { ss } from '@/utils/storage'
+import { t } from '@/locales'
+const LOCAL_NAME = 'agentStorage'
+
+export function defaultState(): Agent.AgentState {
+	const uuid = 1002
+	return {
+		active: uuid,
+		usingContext: true,
+		history: [{ uuid, title: t('chat.newChatTitle'), isEdit: false }],
+		chat: [{ uuid, data: [] }],
+	}
+}
+
+export function getLocalState(): Chat.ChatState {
+	const localState = ss.get(LOCAL_NAME)
+	return { ...defaultState(), ...localState }
+}
+
+export function setLocalState(state: Chat.ChatState) {
+	ss.set(LOCAL_NAME, state)
+}

+ 15 - 0
SEChat-frontend/src/store/modules/agent/index.ts

@@ -0,0 +1,15 @@
+import { defineStore } from 'pinia'
+import type { AgentState } from './helper'
+import { getLocalSetting } from './helper'
+import { store } from '@/store/helper'
+
+export const useAgentStore = defineStore('agent-store', {
+	state: (): AgentState => getLocalSetting(),
+	actions: {
+
+	},
+})
+
+export function useAgentStoreWithOut() {
+	return useAgentStore(store)
+}

+ 1 - 0
SEChat-frontend/src/store/modules/index.ts

@@ -4,3 +4,4 @@ export * from './user'
 export * from './prompt'
 export * from './settings'
 export * from './auth'
+export * from  './agent'

+ 18 - 0
SEChat-frontend/src/typings/agent.d.ts

@@ -0,0 +1,18 @@
+declare namespace Agent{
+	interface Agent{
+		dateTime: string
+		text: string
+		inversion?: boolean
+		error?: boolean
+		loading?: boolean
+		conversationOptions?: ConversationRequest | null
+		requestOptions: { prompt: string; options?: ConversationRequest | null }
+	}
+	interface AgentState{
+		
+
+	}
+
+
+
+}

+ 2 - 1
SEChat-frontend/src/views/chat/layout/sider/Agent.vue

@@ -3,12 +3,13 @@ import type { CSSProperties } from 'vue'
 import { computed, ref, watch } from 'vue'
 import { NButton, NLayoutSider, useDialog } from 'naive-ui'
 import List from './List.vue'
-import { useAppStore, useChatStore } from '@/store'
+import {useAgentStore, useAppStore, useChatStore} from '@/store'
 import { useBasicLayout } from '@/hooks/useBasicLayout'
 import { t } from '@/locales'
 
 const appStore = useAppStore()
 const chatStore = useChatStore()
+const agentStore=useAgentStore()
 
 const dialog = useDialog()