From e51bca47a1a7a0120b14c7ae0b27ae36b0396d90 Mon Sep 17 00:00:00 2001 From: Sebastian Musial Date: Thu, 13 Jun 2024 14:03:11 +0200 Subject: [PATCH] fix: displaying multiple annotations in a single message --- apps/spa/src/app/modules/+chat/shared/chat.service.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/spa/src/app/modules/+chat/shared/chat.service.ts b/apps/spa/src/app/modules/+chat/shared/chat.service.ts index f7bc963..758c0ab 100644 --- a/apps/spa/src/app/modules/+chat/shared/chat.service.ts +++ b/apps/spa/src/app/modules/+chat/shared/chat.service.ts @@ -204,10 +204,13 @@ export class ChatService { this.isTyping$.next(false); this.isResponding$.next(false); + const lastChatMessage = this.messages$.value.pop(); + (lastChatMessage?.content?.[0] as TextContentBlock).text.annotations = event.data.text.annotations + this.messages$.next([ - ...this.messages$.value.slice(0, -1), + ...this.messages$.value, { - ...this.messages$.value.pop(), + ...lastChatMessage, annotations: event.annotations, }, ]);