Skip to content

Commit

Permalink
fixing bug for custom html loading messages where they were not appre…
Browse files Browse the repository at this point in the history
…nded to the chat element correctly
  • Loading branch information
OvidijusParsiunas committed Sep 11, 2024
1 parent d591ebf commit f2d0e10
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions component/src/views/chat/messages/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,22 +245,22 @@ 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;
}

public addLoadingMessage() {
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);
Expand Down

0 comments on commit f2d0e10

Please sign in to comment.