diff --git a/src/views/AI-new/components/chat-new.vue b/src/views/AI-new/components/chat-new.vue index d8b7fe5..a2e4920 100644 --- a/src/views/AI-new/components/chat-new.vue +++ b/src/views/AI-new/components/chat-new.vue @@ -164,12 +164,14 @@ export default { this.$emit('update:isSearching', !this.isSearching) }, startNewConversation() { + this.cancelSend() this.$emit('initBotMessage') - // this.$emit('update:messages', []) + this.$emit('update:messages', []) this.$emit('update:conversationId', '') this.$emit('update:productName', '') this.$emit('update:messageStatus', 'stop') this.typingQueue = [] + // this.currentMessage = {} }, async startRecording() { if (this.messageStatus === 'send') return @@ -342,7 +344,6 @@ export default { const information = /([^<]*)(?:<\/information>)?/.exec(this.answerMap) const text = /([^<]*)(?:<\/text>)?/.exec(this.answerMap) // console.log(this.answerMap); - console.log(text, 123) this.messageInfo.information = information ? information[1].trim() : this.newMessage this.messageInfo.is_complete = is_complete ? is_complete[1].trim() : 'false' if (is_complete && is_complete[1] === 'true' && text && text[1].trim() === '') { @@ -471,7 +472,28 @@ export default { }, cancelSend() { - this.requestSingle.abort() + this.single = false + if (this.requestSingle) { + try { + this.requestSingle.abort() + this.requestSingle = null + } catch (e) { + console.log('Abort error:', e) + } + } + + // 停止打字机效果 + this.isTyping = false + if (this.typingTimeout) { + clearTimeout(this.typingTimeout) + this.typingTimeout = null + } + + // 清空打字机队列 + this.typingQueue = [] + + // 更新消息状态 + this.$emit('update:messageStatus', 'stop') }, }, }