mirror of
https://github.com/jackhh66/ChatGPT_Web_accessToken.git
synced 2026-12-03 21:29:32 +00:00
feat: 优化多会话内容
This commit is contained in:
1 parent
701ef0e6e1
commit
cf8e2dd7b6
3 files changed
+37
-14
No files matched your search
@@ -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)
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user