@memberjunction/ng-chat 6.2.0-edge.3 → 6.2.0-edge.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.component.d.ts","sourceRoot":"","sources":["../../../src/lib/chat/chat.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAa,UAAU,EAAE,YAAY,EAA4B,MAAM,eAAe,CAAC;AAChI,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;;AAI9D,qBAAa,mBAAmB;IACvB,OAAO,EAAE,MAAM,CAAI;IACnB,UAAU,EAAE,MAAM,CAAI;IACtB,MAAM,EAAE,MAAM,CAAI;CAC1B;AACD,qBAAa,WAAW;IACf,OAAO,EAAG,MAAM,CAAC;IACjB,UAAU,EAAG,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAU;IACnC,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACnC,0DAA0D;IACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;IACzB,sDAAsD;IAC/C,UAAU,CAAC,EAAE,OAAO,CAAC;IAC5B,6CAA6C;IACtC,SAAS,EAAE,IAAI,CAAc;gBAExB,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,EAAE,EAAE,GAAE,MAAM,GAAG,MAAM,GAAG,IAAW;CAO9G;AAED,qBAMa,aAAc,YAAW,aAAa;IAkFrC,OAAO,CAAC,eAAe;IAAmB,OAAO,CAAC,EAAE;IAjFvD,cAAc,EAAE,MAAM,CAAM;IAC5B,QAAQ,EAAE,WAAW,EAAE,CAAM;IACtC;;OAEG;IACM,UAAU,EAAE,MAAM,CAAM;IACxB,eAAe,EAAE,MAAM,CAAM;IAEtC;;;OAGG;IACM,gBAAgB,EAAE,mBAAmB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AE,SAAS,GAAE,OAAc,GAAG,IAAI;IAKrH,eAAe,CAAC,OAAO,EAAE,MAAM;IAI/B,eAAe;IAIf,gBAAgB;IAYvB,SAAS,CAAC,aAAa;cAIP,aAAa,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,GAAE,OAAc;IA2C7E,SAAS,CAAC,sBAAsB,CAAC,OAAO,GAAE,OAAc,GAAG,IAAI;IAgBxD,wBAAwB,EAAE,OAAO,CAAS;IAEjD,iBAAiB,IAAI,IAAI;IASzB,iDAAiD;IACjD,iBAAiB,IAAI,IAAI;yCAxNd,aAAa;2CAAb,aAAa;CA2NzB"}
|
|
@@ -316,6 +316,7 @@ export class ChatComponent {
|
|
|
316
316
|
messageElement.classList.add('chat-message-ai');
|
|
317
317
|
}
|
|
318
318
|
messageWrapElement.appendChild(messageElement);
|
|
319
|
+
void this.markdownService.RenderMath(messageElement);
|
|
319
320
|
this.Messages.push(message);
|
|
320
321
|
if (this.Messages.length === 1) {
|
|
321
322
|
// clear out the default message
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.component.js","sourceRoot":"","sources":["../../../src/lib/chat/chat.component.ts","../../../src/lib/chat/chat.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAoC,SAAS,EAAc,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAEhI,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;;;;;;;ICG3B,0BAA8B;;;IAAzB,8DAAuB;;;;IAOxB,+BAAoF;IAAtD,6LAAS,+CAAiC,CAAC,SAAS,KAAC;IAC/E,gCAAsC;IAAA,YAA+B;IAAA,iBAAO;IAC5E,4BAAM;IAAA,YAAkC;IAC5C,AAD4C,iBAAO,EAC7C;;;IAFoC,eAA+B;IAA/B,wDAA+B;IAC/D,eAAkC;IAAlC,2DAAkC;;;;IAI5C,+BAAoF;IAAtD,6LAAS,+CAAiC,CAAC,SAAS,KAAC;IAC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CAAC,iBAAiB,EAAE,CAAC;IAClC,CAAC;uGAzNU,aAAa;6DAAb,aAAa;;;;;;;;YCrC1B,8BAA2B;YACvB,gFAAqD;YAyCrD,iCAEoC;YAA/B,yFAAU,uBAAmB,IAAC;YAE/B,4BAAM;YAAA,YAAkB;YAC5B,AAD4B,iBAAO,EAC7B;YACN,gFAAgC;YAIhC,+EAA4B;YAWpB,AADJ,AADJ,8BAA+B,aACI,sBAMuB;YAJtC,8PAA4B;YAI5B,AADA,mGAAS,6BAAyB,IAAC,4FACpB,wBAAoB,IAAC;YAChD,6BAAA;YACJ,AADI,iBAAW,EACT;YACN,mCAG2B;YADnB,uHAAiC,IAAI,IAAC;YAE1C,yBAAqC;YACzC,iBAAS;YACT,mCAG6B;YADrB,2FAAS,wBAAoB,IAAC;YAElC,yBAAoC;YAGhD,AADI,AADI,iBAAS,EACP,EACJ;YACN,kFAA6B;;YApFzB,cAuCC;YAvCD,iFAuCC;YAMS,eAAkB;YAAlB,wCAAkB;YAE5B,cAEC;YAFD,uDAEC;YAED,cAOC;YAPD,mDAOC;YAKmB,eAA4B;YAA5B,kDAA4B;YAE5B,AADA,mDAAiC,gCACN;YAMnC,eAA0D;YAA1D,gFAA0D;YAM1D,eAAsF;YAAtF,gHAAsF;YAOtG,eAUC;YAVD,qDAUC;;;iFD1DY,aAAa;cANzB,SAAS;6BACI,KAAK,YACP,SAAS;;kBAKlB,KAAK;;kBACL,KAAK;;kBAIL,KAAK;;kBACL,KAAK;;kBAML,KAAK;;kBAKL,KAAK;;kBAML,KAAK;;kBAKL,KAAK;;kBAGL,KAAK;;kBAeL,MAAM;;kBACN,MAAM;;kBAEN,SAAS;mBAAC,mBAAmB,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;;kBAC/C,SAAS;mBAAC,UAAU;;kFAnDV,aAAa","sourcesContent":["import { AfterViewInit, ChangeDetectorRef, Component, ElementRef, EventEmitter, Input, Output, ViewChild } from '@angular/core';\nimport { MarkdownService } from '@memberjunction/ng-markdown';\nimport { LogError } from '@memberjunction/core'\n\n\nexport class ChatWelcomeQuestion {\n public topLine: string=\"\"; // case-violation-ok-legacy-back-compat: object literals are assigned to this class, so an accessor stub changes what they must supply\n public bottomLine: string=\"\"; // case-violation-ok-legacy-back-compat: object literals are assigned to this class, so an accessor stub changes what they must supply\n public prompt: string=\"\"; // case-violation-ok-legacy-back-compat: object literals are assigned to this class, so an accessor stub changes what they must supply\n}\nexport class ChatMessage {\n public message!: string; // case-violation-ok-legacy-back-compat: object literals are assigned to this class, so an accessor stub changes what they must supply\n public senderName!: string; // case-violation-ok-legacy-back-compat: object literals are assigned to this class, so an accessor stub changes what they must supply\n public senderType: 'user' | 'ai' = 'user'; // case-violation-ok-legacy-back-compat: object literals are assigned to this class, so an accessor stub changes what they must supply\n public id?: string | number | null; // case-violation-ok-legacy-back-compat: an accessor cannot be optional, so a stub would turn this into a required member\n /** Optional: indicates a tool execution is in progress */\n public toolName?: string; // case-violation-ok-legacy-back-compat: an accessor cannot be optional, so a stub would turn this into a required member\n /** Optional: indicates a thinking/processing state */\n public isThinking?: boolean; // case-violation-ok-legacy-back-compat: an accessor cannot be optional, so a stub would turn this into a required member\n /** Timestamp when the message was created */\n public timestamp: Date = new Date(); // case-violation-ok-legacy-back-compat: object literals are assigned to this class, so an accessor stub changes what they must supply\n\n constructor(message: string, senderName: string, senderType: 'user' | 'ai', id: string | number | null = null) {\n this.message = message;\n this.senderName = senderName;\n this.senderType = senderType;\n this.id = id;\n this.timestamp = new Date();\n }\n}\n\n@Component({\n standalone: false,\n selector: 'mj-chat',\n templateUrl: './chat.component.html',\n styleUrl: './chat.component.css'\n})\nexport class ChatComponent implements AfterViewInit {\n @Input() InitialMessage: string = '';\n @Input() Messages: ChatMessage[] = [];\n /**\n * Optional, provide this to show an image for the AI. If not provided, a default robot icon will be shown.\n */\n @Input() AIImageURL: string = '';\n @Input() AILargeImageURL: string = '';\n\n /**\n * Optional, provide up to 4 welcome questions with example prompts. \n * These will be shown to the user when the chat is first opened and there are no messages.\n */\n @Input() WelcomeQuestions: ChatWelcomeQuestion[] = [];\n\n /**\n * Optional, provide a prompt for the user when they click the clear all messages button.\n */\n @Input() ClearAllMessagesPrompt: string = 'Are you sure you want to clear all messages?';\n\n /**\n * Set this to enable/disable sending of a message. Whenever the input is empty, this field will be\n * ignored and the send button will be disabled.\n */\n @Input() AllowSend: boolean = true;\n public InternalAllowSend: boolean = true;\n /**\n * The placeholder text for the input field\n */\n @Input() public Placeholder: string = 'Type a message...';\n\n private _showWaitingIndicator: boolean = false;\n @Input() public get ShowWaitingIndicator(): boolean {\n return this._showWaitingIndicator;\n }\n public set ShowWaitingIndicator(value: boolean) {\n this._showWaitingIndicator = value;\n this.cd?.detectChanges(); // Manually trigger change detection\n if (!value) {\n this.FocusTextArea();\n }\n }\n\n ngAfterViewInit(): void {\n this.FocusTextArea();\n }\n\n @Output() MessageAdded = new EventEmitter<ChatMessage>();\n @Output() ClearChatRequested = new EventEmitter<void>();\n\n @ViewChild('messagesContainer', { static: true }) private messagesContainer!: ElementRef;\n @ViewChild('theInput') TheInput: ElementRef | undefined;\n\n /** @deprecated Use {@link TheInput}. */\n get theInput(): ElementRef | undefined {\n return this.TheInput;\n }\n /** @deprecated Use {@link TheInput}. */\n set theInput(value: ElementRef | undefined) {\n this.TheInput = value;\n }\n\n public CurrentMessage: string = '';\n\n /** @deprecated Use {@link CurrentMessage}. */\n public get currentMessage(): string {\n return this.CurrentMessage;\n }\n /** @deprecated Use {@link CurrentMessage}. */\n public set currentMessage(value: string) {\n this.CurrentMessage = value;\n }\n public ShowingClearAllDialog: boolean = false;\n\n /** @deprecated Use {@link ShowingClearAllDialog}. */\n public get showingClearAllDialog(): boolean {\n return this.ShowingClearAllDialog;\n }\n /** @deprecated Use {@link ShowingClearAllDialog}. */\n public set showingClearAllDialog(value: boolean) {\n this.ShowingClearAllDialog = value;\n }\n constructor(private markdownService: MarkdownService, private cd: ChangeDetectorRef) {}\n\n public SendCurrentMessage(): void {\n if (this.CurrentMessage.trim() !== '') {\n this.SendMessage(this.CurrentMessage, 'User', 'user', null);\n this.CurrentMessage = ''; // Clear the input field\n }\n }\n\n public HandleInputChange(event: any) {\n const val = this.TheInput?.nativeElement.value;\n this.InternalAllowSend = this.AllowSend && (val ? val.length > 0 : false);\n this.resizeTextInput();\n }\n\n /** @deprecated Use {@link HandleInputChange}. */\n public handleInputChange(event: any) {\n return this.HandleInputChange(event);\n }\n\n protected resizeTextInput() {\n try {\n const textarea = this.TheInput?.nativeElement;\n if (textarea) {\n textarea.style.height = 'auto'; // Reset height to recalculate\n textarea.style.height = `${textarea.scrollHeight}px`; // Set to scrollHeight \n }\n }\n catch (e) {\n LogError(e);\n }\n }\n\n\n public SendMessage(message: string, senderName: string, senderType: 'user' | 'ai', id: any, fireEvent: boolean = true): void {\n const newMessage = new ChatMessage(message, senderName, senderType, id);\n this.AppendMessage(newMessage, fireEvent); \n }\n\n public SendUserMessage(message: string) {\n this.SendMessage(message, 'User', 'user', null);\n }\n\n public HandleClearChat() {\n this.ClearChatRequested.emit();\n }\n\n public ClearAllMessages() {\n this.Messages = [];\n this.messagesContainer.nativeElement.innerHTML = `<span>${this.InitialMessage}</span>`;\n\n this.ScrollMessagesToBottom();\n\n this.cd.detectChanges(); // Manually trigger change detection\n\n this.FocusTextArea();\n this.ShowingClearAllDialog = false;\n }\n\n protected FocusTextArea() {\n setTimeout(() => this.TheInput?.nativeElement.focus(), 0); // use a timeout to ensure that angular has updated the DOM\n }\n\n protected async AppendMessage(message: ChatMessage, fireEvent: boolean = true) {\n const messageWrapElement = document.createElement('div');\n messageWrapElement.className = \"chat-message-wrap\";\n const imageElement = document.createElement('span');\n if (message.senderType === 'ai') {\n if (this.AIImageURL) {\n const img = document.createElement('img');\n img.src = this.AIImageURL;\n img.style.maxWidth = '24px';\n imageElement.appendChild(img);\n }\n else\n imageElement.classList.add('fa-solid', 'fa-robot');\n }\n else {\n imageElement.classList.add('fa-solid', 'fa-user');\n }\n imageElement.classList.add(\"chat-message-image\");\n\n messageWrapElement.appendChild(imageElement);\n const messageElement = document.createElement('div');\n messageElement.innerHTML = await this.markdownService.parse(message.message);\n messageElement.className = \"chat-message\"; \n if (message.senderType === 'ai') {\n messageElement.classList.add('chat-message-ai');\n }\n messageWrapElement.appendChild(messageElement);\n\n this.Messages.push(message);\n if (this.Messages.length === 1) {\n // clear out the default message\n this.messagesContainer.nativeElement.innerHTML = '';\n }\n this.messagesContainer.nativeElement.appendChild(messageWrapElement); \n if (fireEvent)\n this.MessageAdded.emit(message); \n\n this.ScrollMessagesToBottom(false);\n\n this.cd.detectChanges(); // Manually trigger change detection\n }\n\n protected ScrollMessagesToBottom(animate: boolean = true): void {\n try {\n if (animate) {\n const element = this.messagesContainer.nativeElement;\n element.scrollTo({\n top: element.scrollHeight,\n behavior: 'smooth' // This enables the smooth scrolling\n }); \n }\n else {\n this.messagesContainer.nativeElement.scrollTop = this.messagesContainer.nativeElement.scrollHeight;\n }\n } catch(err) {}\n }\n\n\n public ShowScrollToBottomButton: boolean = false;\n\n HandleCheckScroll(): void {\n const element = this.messagesContainer.nativeElement;\n if (element.scrollHeight - element.scrollTop > element.clientHeight) {\n this.ShowScrollToBottomButton = true;\n } else {\n this.ShowScrollToBottomButton = false;\n }\n }\n\n /** @deprecated Use {@link HandleCheckScroll}. */\n handleCheckScroll(): void {\n return this.HandleCheckScroll();\n }\n}\n","<div class=\"chat-wrapper\">\n @if(Messages.length === 0 && !ShowWaitingIndicator) {\n <div class=\"welcome-wrapper\">\n <div class='welcome-message'>\n @if(AILargeImageURL) {\n <img [src]=\"AILargeImageURL\"/>\n }\n <div class=\"welcome-header-text\">What can I help with today?</div>\n </div>\n <div class='welcome-suggested-questions'>\n <div class=\"welcome-suggested-questions-col\">\n @if (WelcomeQuestions.length > 0) {\n <div class=\"welcome-question\" (click)=\"SendUserMessage(WelcomeQuestions[0].prompt)\">\n <span class=\"welcome-question-header\">{{WelcomeQuestions[0].topLine}}</span>\n <span>{{WelcomeQuestions[0].bottomLine}}</span>\n </div>\n }\n @if (WelcomeQuestions.length > 1) {\n <div class=\"welcome-question\" (click)=\"SendUserMessage(WelcomeQuestions[1].prompt)\">\n <span class=\"welcome-question-header\">{{WelcomeQuestions[1].topLine}}</span>\n <span>{{WelcomeQuestions[1].bottomLine}}</span>\n </div> \n }\n </div>\n <div class=\"welcome-suggested-questions-col\">\n @if (WelcomeQuestions.length > 2) {\n <div class=\"welcome-question\" (click)=\"SendUserMessage(WelcomeQuestions[2].prompt)\">\n <span class=\"welcome-question-header\">{{WelcomeQuestions[2].topLine}}</span>\n <span>{{WelcomeQuestions[2].bottomLine}}</span>\n </div> \n }\n @if (WelcomeQuestions.length > 3) {\n <div class=\"welcome-question\" (click)=\"SendUserMessage(WelcomeQuestions[3].prompt)\">\n <span class=\"welcome-question-header\">{{WelcomeQuestions[3].topLine}}</span>\n <span>{{WelcomeQuestions[3].bottomLine}}</span>\n </div> \n }\n </div>\n </div>\n </div> \n }\n\n <div class=\"chat-messages\" \n #messagesContainer \n (scroll)=\"handleCheckScroll()\">\n <!-- messages go here -->\n <span>{{InitialMessage}}</span>\n </div>\n @if (ShowScrollToBottomButton) {\n <span class=\"scroll-to-bottom fas fa-arrow-down\" (click)=\"ScrollMessagesToBottom()\"></span>\n }\n\n @if (ShowWaitingIndicator) {\n <div class=\"typing-indicator\">\n <div class=\"typing-dot\"></div>\n <div class=\"typing-dot\"></div>\n <div class=\"typing-dot\"></div>\n <span class=\"typing-text\">Thinking...</span>\n </div>\n }\n\n <div class = \"chat-input-area\">\n <div class=\"text-area-wrapper\">\n <textarea #theInput \n [(ngModel)]=\"currentMessage\" \n [disabled]=\"ShowWaitingIndicator\" \n [placeholder]=\"Placeholder\" \n (input)=\"handleInputChange($event)\"\n (keyup.enter)=\"SendCurrentMessage()\" >\n </textarea>\n </div>\n <button class=\"chat-action-btn\"\n [disabled]=\"Messages.length === 0 || ShowWaitingIndicator\"\n (click)=\"showingClearAllDialog = true\"\n title=\"Clear Chat\">\n <i class=\"fa-solid fa-trash-can\"></i>\n </button>\n <button class=\"chat-action-btn chat-send-btn\"\n [disabled]=\"!InternalAllowSend || currentMessage.length === 0 || ShowWaitingIndicator\"\n (click)=\"SendCurrentMessage()\"\n title=\"Send Message\">\n <i class=\"fa-solid fa-arrow-up\"></i>\n </button>\n </div>\n</div>\n@if (showingClearAllDialog) {\n <div class=\"chat-dialog-overlay\" (click)=\"showingClearAllDialog = false\">\n <div class=\"chat-dialog\" (click)=\"$event.stopPropagation()\">\n <p class=\"chat-dialog-message\">{{ClearAllMessagesPrompt}}</p>\n <div class=\"chat-dialog-actions\">\n <button class=\"chat-dialog-btn chat-dialog-btn-primary\" (click)=\"HandleClearChat()\">Yes</button>\n <button class=\"chat-dialog-btn\" (click)=\"showingClearAllDialog = false\">No</button>\n </div>\n </div>\n </div>\n}\n"]}
|
|
1
|
+
{"version":3,"file":"chat.component.js","sourceRoot":"","sources":["../../../src/lib/chat/chat.component.ts","../../../src/lib/chat/chat.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAoC,SAAS,EAAc,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAEhI,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;;;;;;;ICG3B,0BAA8B;;;IAAzB,8DAAuB;;;;IAOxB,+BAAoF;IAAtD,6LAAS,+CAAiC,CAAC,SAAS,KAAC;IAC/E,gCAAsC;IAAA,YAA+B;IAAA,iBAAO;IAC5E,4BAAM;IAAA,YAAkC;IAC5C,AAD4C,iBAAO,EAC7C;;;IAFoC,eAA+B;IAA/B,wDAA+B;IAC/D,eAAkC;IAAlC,2DAAkC;;;;IAI5C,+BAAoF;IAAtD,6LAAS,+CAAiC,CAAC,SAAS,KAAC;IAC/E,gCAAsC;IAAA,YAA+B;IAAA,iBAAO;IAC5E,4BAAM;IAAA,YAAkC;IAC5C,AAD4C,iBAAO,EAC7C;;;IAFoC,eAA+B;IAA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Aa;6DAAb,aAAa;;;;;;;;YCrC1B,8BAA2B;YACvB,gFAAqD;YAyCrD,iCAEoC;YAA/B,yFAAU,uBAAmB,IAAC;YAE/B,4BAAM;YAAA,YAAkB;YAC5B,AAD4B,iBAAO,EAC7B;YACN,gFAAgC;YAIhC,+EAA4B;YAWpB,AADJ,AADJ,8BAA+B,aACI,sBAMuB;YAJtC,8PAA4B;YAI5B,AADA,mGAAS,6BAAyB,IAAC,4FACpB,wBAAoB,IAAC;YAChD,6BAAA;YACJ,AADI,iBAAW,EACT;YACN,mCAG2B;YADnB,uHAAiC,IAAI,IAAC;YAE1C,yBAAqC;YACzC,iBAAS;YACT,mCAG6B;YADrB,2FAAS,wBAAoB,IAAC;YAElC,yBAAoC;YAGhD,AADI,AADI,iBAAS,EACP,EACJ;YACN,kFAA6B;;YApFzB,cAuCC;YAvCD,iFAuCC;YAMS,eAAkB;YAAlB,wCAAkB;YAE5B,cAEC;YAFD,uDAEC;YAED,cAOC;YAPD,mDAOC;YAKmB,eAA4B;YAA5B,kDAA4B;YAE5B,AADA,mDAAiC,gCACN;YAMnC,eAA0D;YAA1D,gFAA0D;YAM1D,eAAsF;YAAtF,gHAAsF;YAOtG,eAUC;YAVD,qDAUC;;;iFD1DY,aAAa;cANzB,SAAS;6BACI,KAAK,YACP,SAAS;;kBAKlB,KAAK;;kBACL,KAAK;;kBAIL,KAAK;;kBACL,KAAK;;kBAML,KAAK;;kBAKL,KAAK;;kBAML,KAAK;;kBAKL,KAAK;;kBAGL,KAAK;;kBAeL,MAAM;;kBACN,MAAM;;kBAEN,SAAS;mBAAC,mBAAmB,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;;kBAC/C,SAAS;mBAAC,UAAU;;kFAnDV,aAAa","sourcesContent":["import { AfterViewInit, ChangeDetectorRef, Component, ElementRef, EventEmitter, Input, Output, ViewChild } from '@angular/core';\nimport { MarkdownService } from '@memberjunction/ng-markdown';\nimport { LogError } from '@memberjunction/core'\n\n\nexport class ChatWelcomeQuestion {\n public topLine: string=\"\"; // case-violation-ok-legacy-back-compat: object literals are assigned to this class, so an accessor stub changes what they must supply\n public bottomLine: string=\"\"; // case-violation-ok-legacy-back-compat: object literals are assigned to this class, so an accessor stub changes what they must supply\n public prompt: string=\"\"; // case-violation-ok-legacy-back-compat: object literals are assigned to this class, so an accessor stub changes what they must supply\n}\nexport class ChatMessage {\n public message!: string; // case-violation-ok-legacy-back-compat: object literals are assigned to this class, so an accessor stub changes what they must supply\n public senderName!: string; // case-violation-ok-legacy-back-compat: object literals are assigned to this class, so an accessor stub changes what they must supply\n public senderType: 'user' | 'ai' = 'user'; // case-violation-ok-legacy-back-compat: object literals are assigned to this class, so an accessor stub changes what they must supply\n public id?: string | number | null; // case-violation-ok-legacy-back-compat: an accessor cannot be optional, so a stub would turn this into a required member\n /** Optional: indicates a tool execution is in progress */\n public toolName?: string; // case-violation-ok-legacy-back-compat: an accessor cannot be optional, so a stub would turn this into a required member\n /** Optional: indicates a thinking/processing state */\n public isThinking?: boolean; // case-violation-ok-legacy-back-compat: an accessor cannot be optional, so a stub would turn this into a required member\n /** Timestamp when the message was created */\n public timestamp: Date = new Date(); // case-violation-ok-legacy-back-compat: object literals are assigned to this class, so an accessor stub changes what they must supply\n\n constructor(message: string, senderName: string, senderType: 'user' | 'ai', id: string | number | null = null) {\n this.message = message;\n this.senderName = senderName;\n this.senderType = senderType;\n this.id = id;\n this.timestamp = new Date();\n }\n}\n\n@Component({\n standalone: false,\n selector: 'mj-chat',\n templateUrl: './chat.component.html',\n styleUrl: './chat.component.css'\n})\nexport class ChatComponent implements AfterViewInit {\n @Input() InitialMessage: string = '';\n @Input() Messages: ChatMessage[] = [];\n /**\n * Optional, provide this to show an image for the AI. If not provided, a default robot icon will be shown.\n */\n @Input() AIImageURL: string = '';\n @Input() AILargeImageURL: string = '';\n\n /**\n * Optional, provide up to 4 welcome questions with example prompts. \n * These will be shown to the user when the chat is first opened and there are no messages.\n */\n @Input() WelcomeQuestions: ChatWelcomeQuestion[] = [];\n\n /**\n * Optional, provide a prompt for the user when they click the clear all messages button.\n */\n @Input() ClearAllMessagesPrompt: string = 'Are you sure you want to clear all messages?';\n\n /**\n * Set this to enable/disable sending of a message. Whenever the input is empty, this field will be\n * ignored and the send button will be disabled.\n */\n @Input() AllowSend: boolean = true;\n public InternalAllowSend: boolean = true;\n /**\n * The placeholder text for the input field\n */\n @Input() public Placeholder: string = 'Type a message...';\n\n private _showWaitingIndicator: boolean = false;\n @Input() public get ShowWaitingIndicator(): boolean {\n return this._showWaitingIndicator;\n }\n public set ShowWaitingIndicator(value: boolean) {\n this._showWaitingIndicator = value;\n this.cd?.detectChanges(); // Manually trigger change detection\n if (!value) {\n this.FocusTextArea();\n }\n }\n\n ngAfterViewInit(): void {\n this.FocusTextArea();\n }\n\n @Output() MessageAdded = new EventEmitter<ChatMessage>();\n @Output() ClearChatRequested = new EventEmitter<void>();\n\n @ViewChild('messagesContainer', { static: true }) private messagesContainer!: ElementRef;\n @ViewChild('theInput') TheInput: ElementRef | undefined;\n\n /** @deprecated Use {@link TheInput}. */\n get theInput(): ElementRef | undefined {\n return this.TheInput;\n }\n /** @deprecated Use {@link TheInput}. */\n set theInput(value: ElementRef | undefined) {\n this.TheInput = value;\n }\n\n public CurrentMessage: string = '';\n\n /** @deprecated Use {@link CurrentMessage}. */\n public get currentMessage(): string {\n return this.CurrentMessage;\n }\n /** @deprecated Use {@link CurrentMessage}. */\n public set currentMessage(value: string) {\n this.CurrentMessage = value;\n }\n public ShowingClearAllDialog: boolean = false;\n\n /** @deprecated Use {@link ShowingClearAllDialog}. */\n public get showingClearAllDialog(): boolean {\n return this.ShowingClearAllDialog;\n }\n /** @deprecated Use {@link ShowingClearAllDialog}. */\n public set showingClearAllDialog(value: boolean) {\n this.ShowingClearAllDialog = value;\n }\n constructor(private markdownService: MarkdownService, private cd: ChangeDetectorRef) {}\n\n public SendCurrentMessage(): void {\n if (this.CurrentMessage.trim() !== '') {\n this.SendMessage(this.CurrentMessage, 'User', 'user', null);\n this.CurrentMessage = ''; // Clear the input field\n }\n }\n\n public HandleInputChange(event: any) {\n const val = this.TheInput?.nativeElement.value;\n this.InternalAllowSend = this.AllowSend && (val ? val.length > 0 : false);\n this.resizeTextInput();\n }\n\n /** @deprecated Use {@link HandleInputChange}. */\n public handleInputChange(event: any) {\n return this.HandleInputChange(event);\n }\n\n protected resizeTextInput() {\n try {\n const textarea = this.TheInput?.nativeElement;\n if (textarea) {\n textarea.style.height = 'auto'; // Reset height to recalculate\n textarea.style.height = `${textarea.scrollHeight}px`; // Set to scrollHeight \n }\n }\n catch (e) {\n LogError(e);\n }\n }\n\n\n public SendMessage(message: string, senderName: string, senderType: 'user' | 'ai', id: any, fireEvent: boolean = true): void {\n const newMessage = new ChatMessage(message, senderName, senderType, id);\n this.AppendMessage(newMessage, fireEvent); \n }\n\n public SendUserMessage(message: string) {\n this.SendMessage(message, 'User', 'user', null);\n }\n\n public HandleClearChat() {\n this.ClearChatRequested.emit();\n }\n\n public ClearAllMessages() {\n this.Messages = [];\n this.messagesContainer.nativeElement.innerHTML = `<span>${this.InitialMessage}</span>`;\n\n this.ScrollMessagesToBottom();\n\n this.cd.detectChanges(); // Manually trigger change detection\n\n this.FocusTextArea();\n this.ShowingClearAllDialog = false;\n }\n\n protected FocusTextArea() {\n setTimeout(() => this.TheInput?.nativeElement.focus(), 0); // use a timeout to ensure that angular has updated the DOM\n }\n\n protected async AppendMessage(message: ChatMessage, fireEvent: boolean = true) {\n const messageWrapElement = document.createElement('div');\n messageWrapElement.className = \"chat-message-wrap\";\n const imageElement = document.createElement('span');\n if (message.senderType === 'ai') {\n if (this.AIImageURL) {\n const img = document.createElement('img');\n img.src = this.AIImageURL;\n img.style.maxWidth = '24px';\n imageElement.appendChild(img);\n }\n else\n imageElement.classList.add('fa-solid', 'fa-robot');\n }\n else {\n imageElement.classList.add('fa-solid', 'fa-user');\n }\n imageElement.classList.add(\"chat-message-image\");\n\n messageWrapElement.appendChild(imageElement);\n const messageElement = document.createElement('div');\n messageElement.innerHTML = await this.markdownService.parse(message.message);\n messageElement.className = \"chat-message\"; \n if (message.senderType === 'ai') {\n messageElement.classList.add('chat-message-ai');\n }\n messageWrapElement.appendChild(messageElement);\n void this.markdownService.RenderMath(messageElement);\n\n this.Messages.push(message);\n if (this.Messages.length === 1) {\n // clear out the default message\n this.messagesContainer.nativeElement.innerHTML = '';\n }\n this.messagesContainer.nativeElement.appendChild(messageWrapElement); \n if (fireEvent)\n this.MessageAdded.emit(message); \n\n this.ScrollMessagesToBottom(false);\n\n this.cd.detectChanges(); // Manually trigger change detection\n }\n\n protected ScrollMessagesToBottom(animate: boolean = true): void {\n try {\n if (animate) {\n const element = this.messagesContainer.nativeElement;\n element.scrollTo({\n top: element.scrollHeight,\n behavior: 'smooth' // This enables the smooth scrolling\n }); \n }\n else {\n this.messagesContainer.nativeElement.scrollTop = this.messagesContainer.nativeElement.scrollHeight;\n }\n } catch(err) {}\n }\n\n\n public ShowScrollToBottomButton: boolean = false;\n\n HandleCheckScroll(): void {\n const element = this.messagesContainer.nativeElement;\n if (element.scrollHeight - element.scrollTop > element.clientHeight) {\n this.ShowScrollToBottomButton = true;\n } else {\n this.ShowScrollToBottomButton = false;\n }\n }\n\n /** @deprecated Use {@link HandleCheckScroll}. */\n handleCheckScroll(): void {\n return this.HandleCheckScroll();\n }\n}\n","<div class=\"chat-wrapper\">\n @if(Messages.length === 0 && !ShowWaitingIndicator) {\n <div class=\"welcome-wrapper\">\n <div class='welcome-message'>\n @if(AILargeImageURL) {\n <img [src]=\"AILargeImageURL\"/>\n }\n <div class=\"welcome-header-text\">What can I help with today?</div>\n </div>\n <div class='welcome-suggested-questions'>\n <div class=\"welcome-suggested-questions-col\">\n @if (WelcomeQuestions.length > 0) {\n <div class=\"welcome-question\" (click)=\"SendUserMessage(WelcomeQuestions[0].prompt)\">\n <span class=\"welcome-question-header\">{{WelcomeQuestions[0].topLine}}</span>\n <span>{{WelcomeQuestions[0].bottomLine}}</span>\n </div>\n }\n @if (WelcomeQuestions.length > 1) {\n <div class=\"welcome-question\" (click)=\"SendUserMessage(WelcomeQuestions[1].prompt)\">\n <span class=\"welcome-question-header\">{{WelcomeQuestions[1].topLine}}</span>\n <span>{{WelcomeQuestions[1].bottomLine}}</span>\n </div> \n }\n </div>\n <div class=\"welcome-suggested-questions-col\">\n @if (WelcomeQuestions.length > 2) {\n <div class=\"welcome-question\" (click)=\"SendUserMessage(WelcomeQuestions[2].prompt)\">\n <span class=\"welcome-question-header\">{{WelcomeQuestions[2].topLine}}</span>\n <span>{{WelcomeQuestions[2].bottomLine}}</span>\n </div> \n }\n @if (WelcomeQuestions.length > 3) {\n <div class=\"welcome-question\" (click)=\"SendUserMessage(WelcomeQuestions[3].prompt)\">\n <span class=\"welcome-question-header\">{{WelcomeQuestions[3].topLine}}</span>\n <span>{{WelcomeQuestions[3].bottomLine}}</span>\n </div> \n }\n </div>\n </div>\n </div> \n }\n\n <div class=\"chat-messages\" \n #messagesContainer \n (scroll)=\"handleCheckScroll()\">\n <!-- messages go here -->\n <span>{{InitialMessage}}</span>\n </div>\n @if (ShowScrollToBottomButton) {\n <span class=\"scroll-to-bottom fas fa-arrow-down\" (click)=\"ScrollMessagesToBottom()\"></span>\n }\n\n @if (ShowWaitingIndicator) {\n <div class=\"typing-indicator\">\n <div class=\"typing-dot\"></div>\n <div class=\"typing-dot\"></div>\n <div class=\"typing-dot\"></div>\n <span class=\"typing-text\">Thinking...</span>\n </div>\n }\n\n <div class = \"chat-input-area\">\n <div class=\"text-area-wrapper\">\n <textarea #theInput \n [(ngModel)]=\"currentMessage\" \n [disabled]=\"ShowWaitingIndicator\" \n [placeholder]=\"Placeholder\" \n (input)=\"handleInputChange($event)\"\n (keyup.enter)=\"SendCurrentMessage()\" >\n </textarea>\n </div>\n <button class=\"chat-action-btn\"\n [disabled]=\"Messages.length === 0 || ShowWaitingIndicator\"\n (click)=\"showingClearAllDialog = true\"\n title=\"Clear Chat\">\n <i class=\"fa-solid fa-trash-can\"></i>\n </button>\n <button class=\"chat-action-btn chat-send-btn\"\n [disabled]=\"!InternalAllowSend || currentMessage.length === 0 || ShowWaitingIndicator\"\n (click)=\"SendCurrentMessage()\"\n title=\"Send Message\">\n <i class=\"fa-solid fa-arrow-up\"></i>\n </button>\n </div>\n</div>\n@if (showingClearAllDialog) {\n <div class=\"chat-dialog-overlay\" (click)=\"showingClearAllDialog = false\">\n <div class=\"chat-dialog\" (click)=\"$event.stopPropagation()\">\n <p class=\"chat-dialog-message\">{{ClearAllMessagesPrompt}}</p>\n <div class=\"chat-dialog-actions\">\n <button class=\"chat-dialog-btn chat-dialog-btn-primary\" (click)=\"HandleClearChat()\">Yes</button>\n <button class=\"chat-dialog-btn\" (click)=\"showingClearAllDialog = false\">No</button>\n </div>\n </div>\n </div>\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/ng-chat",
|
|
3
|
-
"version": "6.2.0-edge.
|
|
3
|
+
"version": "6.2.0-edge.4",
|
|
4
4
|
"description": "MemberJunction: Reusable Chat Component - can be used for AI or peer to peer chat applications.",
|
|
5
5
|
"main": "./dist/public-api.js",
|
|
6
6
|
"typings": "./dist/public-api.d.ts",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"@angular/compiler": "21.2.22",
|
|
15
15
|
"@angular/compiler-cli": "21.2.22",
|
|
16
16
|
"vitest": "^4.0.18",
|
|
17
|
-
"@memberjunction/ng-test-utils": "6.2.0-edge.
|
|
17
|
+
"@memberjunction/ng-test-utils": "6.2.0-edge.4"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"@angular/common": "^21.2.22",
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
"@angular/forms": "^21.2.22"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@memberjunction/core": "6.2.0-edge.
|
|
26
|
-
"@memberjunction/ng-container-directives": "6.2.0-edge.
|
|
27
|
-
"@memberjunction/ng-shared-generic": "6.2.0-edge.
|
|
28
|
-
"@memberjunction/ng-ui-components": "6.2.0-edge.
|
|
25
|
+
"@memberjunction/core": "6.2.0-edge.4",
|
|
26
|
+
"@memberjunction/ng-container-directives": "6.2.0-edge.4",
|
|
27
|
+
"@memberjunction/ng-shared-generic": "6.2.0-edge.4",
|
|
28
|
+
"@memberjunction/ng-ui-components": "6.2.0-edge.4",
|
|
29
29
|
"tslib": "^2.8.1",
|
|
30
|
-
"@memberjunction/ng-markdown": "6.2.0-edge.
|
|
30
|
+
"@memberjunction/ng-markdown": "6.2.0-edge.4"
|
|
31
31
|
},
|
|
32
32
|
"sideEffects": false,
|
|
33
33
|
"repository": {
|