From f2d0e1019893c9663eae1a716229ca083ebaa7a2 Mon Sep 17 00:00:00 2001 From: Ovidijus Parsiunas Date: Wed, 11 Sep 2024 20:41:39 +0900 Subject: [PATCH] fixing bug for custom html loading messages where they were not apprended to the chat element correctly --- component/src/views/chat/messages/messages.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/component/src/views/chat/messages/messages.ts b/component/src/views/chat/messages/messages.ts index e7c99e393..27409c909 100644 --- a/component/src/views/chat/messages/messages.ts +++ b/component/src/views/chat/messages/messages.ts @@ -245,13 +245,12 @@ export class Messages extends MessagesBase { private addDefaultLoadingMessage() { const messageElements = this.createMessageElements('', MessageUtils.AI_ROLE); - const {outerContainer, bubbleElement} = messageElements; + const {bubbleElement} = messageElements; messageElements.bubbleElement.classList.add(LoadingStyle.DOTS_CONTAINER_CLASS); const dotsElement = document.createElement('div'); dotsElement.classList.add('loading-message-dots'); bubbleElement.appendChild(dotsElement); LoadingStyle.setDots(bubbleElement, this.messageStyles); - this.elementRef.appendChild(outerContainer); return messageElements; } @@ -259,8 +258,9 @@ export class Messages extends MessagesBase { if (!this._displayLoadingMessage) return; const html = this.messageStyles?.loading?.message?.html; const messageElements = html - ? HTMLMessages.createElements(this, html, MessageUtils.AI_ROLE, true) + ? HTMLMessages.createElements(this, html, MessageUtils.AI_ROLE, false) : this.addDefaultLoadingMessage(); + this.elementRef.appendChild(messageElements.outerContainer); messageElements.bubbleElement.classList.add(LoadingStyle.BUBBLE_CLASS); this.applyCustomStyles(messageElements, MessageUtils.AI_ROLE, false, this.messageStyles?.loading?.message?.styles); ElementUtils.scrollToBottom(this.elementRef);