mirror of
http://112.124.100.131/ebiz-ai/ebiz-base-ai.git
synced 2025-12-07 01:46:48 +08:00
fix(AI-new):优化聊天组件的撤回功能- 完善 startNewConversation 方法,添加取消发送操作- 清理消息列表和相关状态-优化 cancelSend 方法,增加错误处理和状态重置- 移除无用的日志输出
This commit is contained in:
@@ -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>([^<]*)(?:<\/information>)?/.exec(this.answerMap)
|
||||
const text = /<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')
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user