From 3ba394123ef2bc6b5823d3412e230afc8fb12767 Mon Sep 17 00:00:00 2001 From: aixianling Date: Thu, 18 May 2023 15:38:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=AF=B9=E8=AF=9D=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E6=BB=9A=E5=8A=A8=E5=88=B0=E5=BA=95=E9=83=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/chat.vue | 10 +++++++--- src/components/chatContent.vue | 10 +++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/components/chat.vue b/src/components/chat.vue index 0ffdbe3..5b6348e 100644 --- a/src/components/chat.vue +++ b/src/components/chat.vue @@ -9,7 +9,7 @@ - + 发送 @@ -65,16 +65,20 @@ export default { } this.chatHistory.push(aiMsg) if (this.config.stream) { - ai.chatStream(this.chatHistory).then(reader => ai.streamOutput(reader, this.chatHistory.at(-1))).finally(() => this.loading = false) + ai.chatStream(this.chatHistory).then(reader => ai.streamOutput(reader, this.chatHistory.at(-1))).finally(this.handleAfterSend) } else { ai.chat(this.chatHistory).then(reply => { const decodeArr = reply.split("") decodeArr.forEach(e => this.chatHistory.at(-1).msg += e) - }).finally(() => this.loading = false) + }).finally(this.handleAfterSend) } } else { this.$message.error("请不要发送空消息!") } + }, + handleAfterSend() { + this.loading = false + this.$refs.chatContent.scrollBottom() } } } diff --git a/src/components/chatContent.vue b/src/components/chatContent.vue index 2d5cd66..7e19fa8 100644 --- a/src/components/chatContent.vue +++ b/src/components/chatContent.vue @@ -1,12 +1,5 @@