diff --git a/src/components/business/Chat/hooks/useChat.ts b/src/components/business/Chat/hooks/useChat.ts
index 270fe5e..7e7ea5e 100644
--- a/src/components/business/Chat/hooks/useChat.ts
+++ b/src/components/business/Chat/hooks/useChat.ts
@@ -3,14 +3,21 @@ import { useHistoryStore } from '@/store'
export function useChat() {
const historyStore = useHistoryStore()
- function addChat(message: string, args?: { reversal?: boolean; error?: boolean; options?: Chat.ChatOptions }) {
- historyStore.addChat({
- dateTime: new Date().toLocaleString(),
- message,
- reversal: args?.reversal ?? false,
- error: args?.error ?? false,
- options: args?.options ?? undefined,
- })
+ function addChat(
+ message: string,
+ args?: { reversal?: boolean; error?: boolean; options?: Chat.ChatOptions },
+ uuid?: number | null,
+ ) {
+ historyStore.addChat(
+ {
+ dateTime: new Date().toLocaleString(),
+ message,
+ reversal: args?.reversal ?? false,
+ error: args?.error ?? false,
+ options: args?.options ?? undefined,
+ },
+ uuid,
+ )
}
function clearChat() {
diff --git a/src/components/business/Chat/index.vue b/src/components/business/Chat/index.vue
index c22942a..dfdceaf 100644
--- a/src/components/business/Chat/index.vue
+++ b/src/components/business/Chat/index.vue
@@ -1,5 +1,5 @@
diff --git a/src/store/modules/history/index.ts b/src/store/modules/history/index.ts
index 24ea21b..29401b6 100644
--- a/src/store/modules/history/index.ts
+++ b/src/store/modules/history/index.ts
@@ -16,15 +16,16 @@ export const useHistoryStore = defineStore('history-store', {
},
},
actions: {
- addChat(data: Chat.Chat) {
+ addChat(data: Chat.Chat, uuid: number | null = null) {
if (this.active === null) {
this.historyChat.push({ title: data.message, isEdit: false, data: [data] })
this.active = this.historyChat.length - 1
}
else {
- if (this.historyChat[this.active].title === '')
- this.historyChat[this.active].title = data.message
- this.historyChat[this.active].data.push(data)
+ const active = uuid !== null ? uuid : this.active
+ if (this.historyChat[active].title === '')
+ this.historyChat[active].title = data.message
+ this.historyChat[active].data.push(data)
}
setLocalHistory(this.$state)
},