Compare commits
1
Commits
747a6405d0
...
57f0c6c8a6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
57f0c6c8a6 |
+11
-2
@@ -282,11 +282,20 @@ Page({
|
|||||||
|
|
||||||
finishAIResponse() {
|
finishAIResponse() {
|
||||||
const isClearRequest = this.activeRequestType === 'clear'
|
const isClearRequest = this.activeRequestType === 'clear'
|
||||||
|
// 清空请求的确认语由服务端下发:只保留这条确认,其余历史随清空一起丢弃
|
||||||
|
const clearReplyId = isClearRequest ? this.activeServerId : ''
|
||||||
this.resetActiveRequest()
|
this.resetActiveRequest()
|
||||||
|
|
||||||
if (isClearRequest) {
|
if (isClearRequest) {
|
||||||
this.setData({ messages: [], isTyping: false })
|
const messages = clearReplyId
|
||||||
wx.removeStorageSync('ai_chat_history')
|
? this.data.messages.filter(item => item.type === 'ai' && item._serverId === clearReplyId)
|
||||||
|
: []
|
||||||
|
this.setData({ messages, isTyping: false })
|
||||||
|
if (messages.length) {
|
||||||
|
this.saveChatHistory(messages)
|
||||||
|
} else {
|
||||||
|
wx.removeStorageSync('ai_chat_history')
|
||||||
|
}
|
||||||
wx.removeStorageSync('ai_session_id')
|
wx.removeStorageSync('ai_session_id')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user