diff --git a/src/views/AI/components/message.vue b/src/views/AI/components/message.vue index c7341a9..57bf6e3 100644 --- a/src/views/AI/components/message.vue +++ b/src/views/AI/components/message.vue @@ -26,7 +26,7 @@
- +
@@ -76,6 +76,10 @@ export default { } }, methods: { + setProductName(e){ + this.$emit('setProductName',e) + }, + showThink(message) { this.$set(message, 'showThink', !message.showThink) diff --git a/src/views/AI/components/treasureBox.vue b/src/views/AI/components/treasureBox.vue index 34e2bf7..caa4b40 100644 --- a/src/views/AI/components/treasureBox.vue +++ b/src/views/AI/components/treasureBox.vue @@ -51,7 +51,11 @@ export default { this.getTreasureBox() } else { this.setList(this.item.detail) + this.$emit('setProductName',this.item.detail.productName) + } + + }, immediate: true, }, @@ -86,6 +90,7 @@ export default { productDetail({ productName: this.item.text }).then((res) => { if(res){ this.$set(this.item,'detail',res.content) + this.$emit('setProductName',res.content.productName) this.setList() } }) diff --git a/src/views/AI/index.vue b/src/views/AI/index.vue index 120381e..064b5e4 100644 --- a/src/views/AI/index.vue +++ b/src/views/AI/index.vue @@ -4,7 +4,7 @@
- +
@@ -53,6 +53,7 @@ export default { data() { return { + productName:'', answerMap:'', timer:null, answerIndex:0, @@ -79,6 +80,7 @@ export default { startNewConversation() { this.messages = [] this.conversationId = '' + this.productName = '' }, hasTreasureBox() { @@ -88,6 +90,8 @@ export default { this.messages.push({ type: 'box', text: this.newMessage,detail:res.content }) this.newMessage = '' } + }).catch(()=>{ + this.messageStatus = 'stop' }) }, @@ -136,7 +140,9 @@ export default { } }) }, - + setProductName(e){ + console.log(e) + }, handleScroll() { const messageArea = this.$refs.messageArea if (!messageArea) return @@ -169,6 +175,7 @@ export default { isOnline: this.isSearching ? 1 : 0, user: 'chenyuda', conversationId: this.conversationId, + productName:this.productName, } fetch(chat(), { @@ -181,7 +188,9 @@ export default { this.newMessage = '' await this.processStreamResponse(res) }) - .catch((err) => console.error('请求错误:', err)) + .catch((err) => { + this.messageStatus = 'stop' + }) }, async processStreamResponse(response) {