From 95367a19738007563e3a5800b90053863785c7cd Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Fri, 25 Apr 2025 22:44:31 -0700 Subject: [PATCH] Fix partial length in chat --- src-ui/src/app/components/chat/chat/chat.component.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src-ui/src/app/components/chat/chat/chat.component.ts b/src-ui/src/app/components/chat/chat/chat.component.ts index a01445466..0d17f132e 100644 --- a/src-ui/src/app/components/chat/chat/chat.component.ts +++ b/src-ui/src/app/components/chat/chat/chat.component.ts @@ -41,9 +41,12 @@ export class ChatComponent { this.messages.push(assistantMessage) this.loading = true + let lastPartialLength = 0 + this.chatService.streamChat(this.documentId, this.input).subscribe({ next: (chunk) => { - assistantMessage.content += chunk + assistantMessage.content += chunk.substring(lastPartialLength) + lastPartialLength = chunk.length this.scrollToBottom() }, error: () => {