From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Sat, 26 Apr 2025 05:44:31 +0000 (-0700) Subject: Fix partial length in chat X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ebd46f08e5a75e4b7127f93688e6421d97b7fec7;p=thirdparty%2Fpaperless-ngx.git Fix partial length in chat --- 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: () => {