Skip to content

Commit

Permalink
Merge pull request #63 from boldare/feat/initial-message
Browse files Browse the repository at this point in the history
feat(chatbot): allowed to declare the initial messages
  • Loading branch information
sebastianmusial committed May 27, 2024
2 parents 7ab7de7 + c26452a commit ce390cf
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="messages">
@for (message of messages; track message) {
<span #item>
@for (message of initialMessages.concat(messages); track message) {
<span #item>
<ai-chat-message [message]="message"></ai-chat-message>
</span>
} @empty {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { ChatTipsComponent } from '../chat-tips/chat-tips.component';
],
})
export class ChatMessagesComponent implements AfterViewInit, OnChanges {
@Input() initialMessages: ChatMessage[] = [];
@Input() messages: ChatMessage[] = [];
@Input() isTyping = false;
@Input() tips: string[] = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<ai-configuration-form class="chat__content" />
} @else {
<ai-chat-messages
[initialMessages]="initialMessages"
[messages]="messages()"
[isTyping]="isTyping()"
[tips]="tips"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { toSignal } from '@angular/core/rxjs-interop';
import { take } from 'rxjs';
import { environment } from '../../../../../environments/environment';
import { ChatService } from '../../shared/chat.service';
import { ThreadService } from '../../shared/thread.service';
Expand All @@ -8,8 +9,8 @@ import { ChatHeaderComponent } from '../../../../components/chat/chat-header/cha
import { ChatMessagesComponent } from '../../../../components/chat/chat-messages/chat-messages.component';
import { ChatFooterComponent } from '../../../../components/chat/chat-footer/chat-footer.component';
import { ConfigurationFormComponent } from '../../../+configuration/components/configuration-form/configuration-form.component';
import { take } from 'rxjs';
import { SpinnerComponent } from '../../../../components/spinner/spinner.component';
import { ChatMessage } from '../../shared/chat.model';

@Component({
selector: 'ai-chat-iframe',
Expand Down Expand Up @@ -37,6 +38,7 @@ export class ChatIframeComponent implements OnInit {
isAttachmentEnabled = environment.isAttachmentEnabled;
isRefreshEnabled = environment.isRefreshEnabled;
isConfigEnabled = environment.isConfigEnabled;
initialMessages: ChatMessage[] = [];
tips = [
'Hello! 馃憢 How can you help me?',
'What鈥檚 the weather like in Warsaw?',
Expand Down

0 comments on commit ce390cf

Please sign in to comment.