mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-16 11:36:39 +01:00
Fix partial length in chat
This commit is contained in:
parent
6f0c6f39b1
commit
ebd46f08e5
1 changed files with 4 additions and 1 deletions
|
|
@ -41,9 +41,12 @@ export class ChatComponent {
|
||||||
this.messages.push(assistantMessage)
|
this.messages.push(assistantMessage)
|
||||||
this.loading = true
|
this.loading = true
|
||||||
|
|
||||||
|
let lastPartialLength = 0
|
||||||
|
|
||||||
this.chatService.streamChat(this.documentId, this.input).subscribe({
|
this.chatService.streamChat(this.documentId, this.input).subscribe({
|
||||||
next: (chunk) => {
|
next: (chunk) => {
|
||||||
assistantMessage.content += chunk
|
assistantMessage.content += chunk.substring(lastPartialLength)
|
||||||
|
lastPartialLength = chunk.length
|
||||||
this.scrollToBottom()
|
this.scrollToBottom()
|
||||||
},
|
},
|
||||||
error: () => {
|
error: () => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue