diff --git a/src/views/AI/components/chat.vue b/src/views/AI/components/chat.vue index 88158ba..e9583ff 100644 --- a/src/views/AI/components/chat.vue +++ b/src/views/AI/components/chat.vue @@ -212,10 +212,10 @@ export default { think: '', isLike: false, isDisLike: false, - }), + }) ) this.messages.push(this.currentMessage) - const params = { + let params = { query: this.newMessage, isDeep: this.isDeep ? 1 : 0, isOnline: this.isSearching ? 1 : 0, @@ -223,6 +223,11 @@ export default { conversationId: this.conversationId, productName: this.productName, } + + if (this.$route.query.compareId) { + params.compareResult = JSON.parse(sessionStorage.getItem('results')) + } + fetch(chat(), { method: 'POST', headers: { 'Content-Type': 'application/json' }, @@ -307,6 +312,8 @@ export default { sendMessage() { if (this.messageStatus === 'send') return if (this.newMessage.trim() === '') return + // 防止xss + this.newMessage = this.newMessage.replace(/<[^>]+>/g, '') this.messages.push({ type: 'user', text: this.newMessage }) this.$emit('update:messageStatus', 'send') // this.messageStatus = 'send' @@ -315,10 +322,10 @@ export default { return } - if (this.newMessage.includes('产品对比')) { - // this.hasTreasureBox() - return - } + // if (this.newMessage.includes('产品对比')) { + // // this.hasTreasureBox() + // return + // } // this.autoScrollEnabled = true this.$emit('update:autoScrollEnabled', true) diff --git a/src/views/AI/components/message.vue b/src/views/AI/components/message.vue index be51e7c..5d4d9d4 100644 --- a/src/views/AI/components/message.vue +++ b/src/views/AI/components/message.vue @@ -3,7 +3,7 @@