Skip to content

Commit

Permalink
fixing bug with message class dependency inversion
Browse files Browse the repository at this point in the history
  • Loading branch information
OvidijusParsiunas committed Dec 11, 2024
1 parent 49d7411 commit f94c280
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ export class SubmitButton extends InputButton<Styles> {
if (this._customStyles?.submit?.svg
|| this._customStyles?.loading?.svg?.content || this._customStyles?.loading?.text?.content) return;
if (deepChat.displayLoadingBubble === undefined || deepChat.displayLoadingBubble === true) {
// this gets triggered when alwaysEnabled is set to true
const styleElement = document.createElement('style');
styleElement.textContent = `
.loading-button > * {
Expand Down
4 changes: 3 additions & 1 deletion component/src/views/chat/messages/messages.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {MessageContentI, Overwrite} from '../../../types/messagesInternal';
import {MessageBody, MessageContentI, Overwrite} from '../../../types/messagesInternal';
import {MessageFile, MessageFileType} from '../../../types/messageFile';
import {CustomErrors, ServiceIO} from '../../../services/serviceIO';
import {LoadingStyle} from '../../../utils/loading/loadingStyle';
Expand All @@ -17,6 +17,7 @@ import {IntroMessage} from '../../../types/messages';
import {MessageStream} from './stream/messageStream';
import {IntroPanel} from '../introPanel/introPanel';
import {WebModel} from '../../../webModel/webModel';
import {UpdateMessage} from './utils/updateMessage';
import {CustomStyle} from '../../../types/styles';
import {MessageUtils} from './utils/messageUtils';
import {HTMLMessages} from './html/htmlMessages';
Expand Down Expand Up @@ -65,6 +66,7 @@ export class Messages extends MessagesBase {
deepChat.addMessage = (message: ResponseI, isUpdate?: boolean) => {
this.addAnyMessage({...message, sendUpdate: !!isUpdate}, !isUpdate);
};
deepChat.updateMessage = (index: number, messageBody: MessageBody) => UpdateMessage.update(this, index, messageBody);
// interface - setUpMessagesForService
if (serviceIO.isWebModel()) (serviceIO as WebModel).setUpMessages(this);
if (demo) this.prepareDemo(demo);
Expand Down
4 changes: 1 addition & 3 deletions component/src/views/chat/messages/messagesBase.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {MessageElementsStyles, MessageRoleStyles, MessageStyles, UserContent} from '../../../types/messages';
import {MessageBody, MessageContentI, MessageToElements, Overwrite} from '../../../types/messagesInternal';
import {MessageContentI, MessageToElements, Overwrite} from '../../../types/messagesInternal';
import {ProcessedTextToSpeechConfig} from './textToSpeech/textToSpeech';
import {ElementUtils} from '../../../utils/element/elementUtils';
import {HTMLDeepChatElements} from './html/htmlDeepChatElements';
Expand All @@ -11,7 +11,6 @@ import {LoadingHistory} from './history/loadingHistory';
import {HTMLClassUtilities} from '../../../types/html';
import {IntroPanel} from '../introPanel/introPanel';
import {Legacy} from '../../../utils/legacy/legacy';
import {UpdateMessage} from './utils/updateMessage';
import {MessageUtils} from './utils/messageUtils';
import {Response} from '../../../types/response';
import {Avatars} from '../../../types/avatars';
Expand Down Expand Up @@ -43,7 +42,6 @@ export class MessagesBase {
this._names = deepChat.names;
this._onMessage = FireEvents.onMessage.bind(this, deepChat);
if (deepChat.htmlClassUtilities) this.htmlClassUtilities = deepChat.htmlClassUtilities;
deepChat.updateMessage = (index: number, messageBody: MessageBody) => UpdateMessage.update(this, index, messageBody);
setTimeout(() => {
this.submitUserMessage = deepChat.submitUserMessage; // wait for it to be available in input.ts
});
Expand Down

0 comments on commit f94c280

Please sign in to comment.