From 3fecca9369ee511d175963bbfb93a6f6f197b7de Mon Sep 17 00:00:00 2001 From: HCode <71808213+hyf-github-user@users.noreply.github.com> Date: Fri, 16 Aug 2024 01:53:05 +0800 Subject: [PATCH] Hcode/fix chat (#108) --- ...exior-963da0b3-a7d7-46f5-b9f7-c715520b3be3.json | 7 +++++++ src/components/chat/Message.vue | 11 +++++++++-- src/pages/chat/Conversation.vue | 14 +++++++------- 3 files changed, 23 insertions(+), 9 deletions(-) create mode 100644 change/@acedatacloud-nexior-963da0b3-a7d7-46f5-b9f7-c715520b3be3.json diff --git a/change/@acedatacloud-nexior-963da0b3-a7d7-46f5-b9f7-c715520b3be3.json b/change/@acedatacloud-nexior-963da0b3-a7d7-46f5-b9f7-c715520b3be3.json new file mode 100644 index 00000000..082d9c9c --- /dev/null +++ b/change/@acedatacloud-nexior-963da0b3-a7d7-46f5-b9f7-c715520b3be3.json @@ -0,0 +1,7 @@ +{ + "type": "minor", + "comment": "fix chat restart", + "packageName": "@acedatacloud/nexior", + "email": "1348977728@qq.com", + "dependentChangeType": "patch" +} diff --git a/src/components/chat/Message.vue b/src/components/chat/Message.vue index 5c2961a4..fce455ac 100644 --- a/src/components/chat/Message.vue +++ b/src/components/chat/Message.vue @@ -55,10 +55,17 @@
- + message === targetMessage); const problem_message = this.messages[targetIndex - 1]; + // @ts-ignore + let update_messages = []; if (targetIndex !== -1) { - this.messages = this.messages.slice(0, targetIndex - 1); + // @ts-ignore + update_messages = this.messages.slice(0, targetIndex - 1); + this.messages = this.messages.slice(0, targetIndex); // @ts-ignore this.question = problem_message.content; } - // 2. Update the messages const token = this.credential?.token; const question = this.question; @@ -191,7 +194,8 @@ export default defineComponent({ .updateConversation( { id: this.conversationId, - messages: this.messages + // @ts-ignore + messages: update_messages }, { token @@ -203,10 +207,6 @@ export default defineComponent({ messages: this.messages }); console.debug('finished update conversation', this.messages); - this.messages.push({ - content: this.question, - role: ROLE_USER - }); // 3. Send restart questions console.debug('onRestart', this.question); await this.onFetchAnswer();