optimize the title for new chat, fixed bug for clear chat history

This commit is contained in:
RockYang 2023-04-19 19:14:34 +08:00
parent c08cef0765
commit 673cdada5a
2 changed files with 5 additions and 0 deletions

View File

@ -55,6 +55,7 @@ export function appendChatHistory(chatId, message) {
export function clearChatHistory() {
Storage.remove(ChatHistoryKey);
Storage.remove(ChatListKey);
}
// 获取指定会话的历史记录

View File

@ -514,6 +514,8 @@ export default defineComponent({
}
).then(() => {
clearChatHistory();
this.chatData = [];
this.chatList = [];
ElMessage.success("当前角色会话已清空");
}).catch(() => {
})
@ -552,6 +554,7 @@ export default defineComponent({
if (chatHistory === null) {
return;
}
this.curChat.title = chatHistory[0].content;
//
setChat(this.curChat);
}
@ -591,6 +594,7 @@ export default defineComponent({
}
},
//
cancel: function (chat) {
chat.edit = false;
chat.removing = false;