mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-05-23 12:58:18 -05:00
Fix partial length in chat
This commit is contained in:
parent
dd3322cb82
commit
95367a1973
@ -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…
x
Reference in New Issue
Block a user