From 1e16ba04972d3f0e7c3599f77afa901c5ae84ef9 Mon Sep 17 00:00:00 2001 From: huangzhe Date: Wed, 30 Jul 2025 16:42:14 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=20conversation=5Fid?= =?UTF-8?q?=20=E4=BB=A5=E8=BF=9E=E7=BB=AD=E5=AF=B9=E8=AF=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/AI-new/components/chat-new.vue | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/views/AI-new/components/chat-new.vue b/src/views/AI-new/components/chat-new.vue index 68cdd98..a3ec546 100644 --- a/src/views/AI-new/components/chat-new.vue +++ b/src/views/AI-new/components/chat-new.vue @@ -115,6 +115,7 @@ export default { isTyping: false, typingSpeed: 30, typingTimeout: null, + conversationId: '' } }, watch: { @@ -223,7 +224,7 @@ export default { this.currentMessage = JSON.parse(JSON.stringify(this.messageInfo)) let params = { appType: "gwcsHelper", - conversationId: "", + conversationId: this.conversationId, message: JSON.stringify(this.messageInfo), user: "gwcs-test", inputs: {}, @@ -242,7 +243,6 @@ export default { if (this.single) { this.messages.length -= 1 - // deubg this.messages.push(this.currentMessage) } else { this.messages.push(this.currentMessage) @@ -302,10 +302,11 @@ export default { }, parseStreamLine(line) { try { - const cleanLine = line.replace(/^data:\s*/, '') if (!cleanLine) return null const data = JSON.parse(cleanLine) + // debugger/ + this.conversationId = data.conversation_id // console.log(data) // console.log(data) if (data.answer) { @@ -314,14 +315,10 @@ export default { const is_complete = /([^<]*)(?:<\/is_complete>)?/.exec(this.answerMap) const information = /([^<]*)(?:<\/information>)?/.exec(this.answerMap) const text = /([^<]*)(?:<\/text>)?/.exec(this.answerMap) - // console.log(`is_complete, information, text`, is_complete, information, text) - - // const isCompleteRes = is_complete.some(item => item === 'true') 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() === '') { - // alert("message end") this.requestSingle.abort() // setTimeout(() => {