fix: reset history title on clear (#453)

This commit is contained in:
RyanzeX 2023-03-10 05:24:36 +00:00 committed by GitHub
parent 076c56d1d9
commit 7e8e15a628
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -165,6 +165,7 @@ export const useChatStore = defineStore('chat-store', {
if (!uuid || uuid === 0) { if (!uuid || uuid === 0) {
if (this.chat.length) { if (this.chat.length) {
this.chat[0].data = [] this.chat[0].data = []
this.history[0].title = 'New Chat'
this.recordState() this.recordState()
} }
return return
@ -173,6 +174,7 @@ export const useChatStore = defineStore('chat-store', {
const index = this.chat.findIndex(item => item.uuid === uuid) const index = this.chat.findIndex(item => item.uuid === uuid)
if (index !== -1) { if (index !== -1) {
this.chat[index].data = [] this.chat[index].data = []
this.history[index].title = 'New Chat'
this.recordState() this.recordState()
} }
}, },