]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Fix partial length in chat
authorshamoon <4887959+shamoon@users.noreply.github.com>
Sat, 26 Apr 2025 05:44:31 +0000 (22:44 -0700)
committershamoon <4887959+shamoon@users.noreply.github.com>
Wed, 2 Jul 2025 18:03:55 +0000 (11:03 -0700)
src-ui/src/app/components/chat/chat/chat.component.ts

index a0144546669d2e4827fb45909daf5dc4ac04b472..0d17f132e223e8628d6bf0c60809f40278d57d3d 100644 (file)
@@ -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: () => {