-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e3ac46c
commit fe69a93
Showing
27 changed files
with
319 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
module.exports = { | ||
extends: [ | ||
'@commitlint/config-conventional', | ||
], | ||
extends: ['@commitlint/config-conventional'], | ||
rules: { | ||
'header-max-length': [0, 'always', 120], | ||
} | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
22 changes: 22 additions & 0 deletions
22
apps/spa/src/app/components/chat/chat-iframe-wrapper/chat-iframe-wrapper.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { ChatIframeWrapperComponent } from './chat-iframe-wrapper.component'; | ||
|
||
describe('ChatIframeWrapperComponent', () => { | ||
let component: ChatIframeWrapperComponent; | ||
let fixture: ComponentFixture<ChatIframeWrapperComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [ChatIframeWrapperComponent], | ||
}).compileComponents(); | ||
|
||
fixture = TestBed.createComponent(ChatIframeWrapperComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
9 changes: 9 additions & 0 deletions
9
apps/spa/src/app/components/chat/chat-iframe-wrapper/chat-iframe-wrapper.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'ai-chat-iframe-wrapper', | ||
standalone: true, | ||
templateUrl: './chat-iframe-wrapper.component.html', | ||
styleUrl: './chat-iframe-wrapper.component.scss', | ||
}) | ||
export class ChatIframeWrapperComponent {} |
9 changes: 0 additions & 9 deletions
9
apps/spa/src/app/components/chat/chat-iframe/chat-iframe.component.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,32 @@ | ||
import { Routes } from '@angular/router'; | ||
import { ChatComponent } from './containers/chat/chat.component'; | ||
|
||
export const routes: Routes = [ | ||
{ | ||
path: '', | ||
loadComponent: () => | ||
import('./containers/chat-example/chat-example.component').then( | ||
mod => mod.ChatExampleComponent, | ||
), | ||
component: ChatComponent, | ||
children: [ | ||
{ | ||
path: '', | ||
loadComponent: () => | ||
import('./containers/chat-home/chat-home.component').then( | ||
mod => mod.ChatHomeComponent, | ||
), | ||
}, | ||
{ | ||
path: 'integration', | ||
loadComponent: () => | ||
import( | ||
'./containers/chat-integration/chat-integration.component' | ||
).then(mod => mod.ChatIntegrationComponent), | ||
}, | ||
], | ||
}, | ||
{ | ||
path: 'iframe', | ||
loadComponent: () => | ||
import('./containers/chat/chat.component').then(mod => mod.ChatComponent), | ||
import('./containers/chat-iframe/chat-iframe.component').then( | ||
mod => mod.ChatIframeComponent, | ||
), | ||
}, | ||
]; |
2 changes: 2 additions & 0 deletions
2
apps/spa/src/app/modules/+chat/containers/chat-home/chat-home.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
A NestJS library for building efficient, scalable, and quick solutions based on | ||
the OpenAI Assistant API (chatbots) 🤖 🚀 |
10 changes: 10 additions & 0 deletions
10
apps/spa/src/app/modules/+chat/containers/chat-home/chat-home.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
:host { | ||
max-width: 600px; | ||
margin-top: 40px; | ||
color: var(--color-grey-600); | ||
font-size: 18px; | ||
text-align: center; | ||
letter-spacing: 0.03em; | ||
line-height: 1.6; | ||
font-weight: 300; | ||
} |
12 changes: 6 additions & 6 deletions
12
...at-example/chat-example.component.spec.ts → ...ers/chat-home/chat-home.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
apps/spa/src/app/modules/+chat/containers/chat-home/chat-home.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'ai-chat-home', | ||
standalone: true, | ||
templateUrl: './chat-home.component.html', | ||
styleUrl: './chat-home.component.scss', | ||
}) | ||
export class ChatHomeComponent {} |
26 changes: 26 additions & 0 deletions
26
apps/spa/src/app/modules/+chat/containers/chat-iframe/chat-iframe.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<ai-card class="chat"> | ||
<ai-chat-header | ||
[isRefreshEnabled]="isRefreshEnabled && !!threadId()" | ||
[isConfigEnabled]="isConfigEnabled && !!threadId()" | ||
(refresh$)="chatService.refresh()" | ||
(close$)="chatService.toggle()" | ||
(config$)="chatService.clear()"></ai-chat-header> | ||
|
||
<ai-spinner [isActive]="isLoading()" /> | ||
@if (isConfigEnabled && !threadId()) { | ||
<ai-configuration-form class="chat__content" /> | ||
} @else { | ||
<ai-chat-messages | ||
[messages]="messages()" | ||
[isTyping]="isTyping()" | ||
[tips]="tips" | ||
(tipSelected$)="chatService.sendMessage($event)" | ||
class="chat__content" /> | ||
<ai-chat-footer | ||
[isDisabled]="isTyping()" | ||
[isTranscriptionEnabled]="isTranscriptionEnabled" | ||
[isAttachmentEnabled]="isAttachmentEnabled" | ||
(sendMessage$)="chatService.sendMessage($event)" | ||
(sendAudio$)="chatService.sendAudio($event)" /> | ||
} | ||
</ai-card> |
16 changes: 16 additions & 0 deletions
16
apps/spa/src/app/modules/+chat/containers/chat-iframe/chat-iframe.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
:host { | ||
display: flex; | ||
height: 100vh; | ||
max-height: 600px; | ||
background-color: var(--color-white); | ||
border-radius: var(--border-radius-medium); | ||
} | ||
|
||
.chat { | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
.chat__content { | ||
flex: 1 1 100%; | ||
} |
10 changes: 9 additions & 1 deletion
10
...chat-iframe/chat-iframe.component.spec.ts → ...chat-iframe/chat-iframe.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
apps/spa/src/app/modules/+chat/containers/chat-iframe/chat-iframe.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { toSignal } from '@angular/core/rxjs-interop'; | ||
import { environment } from '../../../../../environments/environment'; | ||
import { ChatService } from '../../shared/chat.service'; | ||
import { ThreadService } from '../../shared/thread.service'; | ||
import { CardComponent } from '../../../../components/cards'; | ||
import { ChatHeaderComponent } from '../../../../components/chat/chat-header/chat-header.component'; | ||
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'; | ||
|
||
@Component({ | ||
selector: 'ai-chat-iframe', | ||
standalone: true, | ||
imports: [ | ||
CardComponent, | ||
ChatHeaderComponent, | ||
ChatMessagesComponent, | ||
ChatFooterComponent, | ||
ConfigurationFormComponent, | ||
SpinnerComponent, | ||
], | ||
templateUrl: './chat-iframe.component.html', | ||
styleUrl: './chat-iframe.component.scss', | ||
}) | ||
export class ChatIframeComponent implements OnInit { | ||
messages = toSignal(this.chatService.messages$, { initialValue: [] }); | ||
isTyping = toSignal(this.chatService.isTyping$, { initialValue: false }); | ||
isLoading = toSignal(this.chatService.isLoading$, { initialValue: false }); | ||
threadId = toSignal(this.threadService.threadId$, { initialValue: '' }); | ||
isTranscriptionEnabled = environment.isTranscriptionEnabled; | ||
isAttachmentEnabled = environment.isAttachmentEnabled; | ||
isRefreshEnabled = environment.isRefreshEnabled; | ||
isConfigEnabled = environment.isConfigEnabled; | ||
tips = [ | ||
'Hello there! 👋', | ||
'Could you please tell me your name?', | ||
'Hello! How can you help me?', | ||
'Hello! 👋 How are you?', | ||
]; | ||
|
||
constructor( | ||
private readonly threadService: ThreadService, | ||
public readonly chatService: ChatService, | ||
) {} | ||
|
||
ngOnInit() { | ||
if (!this.isConfigEnabled && !this.threadService.threadId$.value) { | ||
this.threadService.start().pipe(take(1)).subscribe(); | ||
} | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
28 changes: 28 additions & 0 deletions
28
.../spa/src/app/modules/+chat/containers/chat-integration/chat-integration.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { ChatIntegrationComponent } from './chat-integration.component'; | ||
import { HttpClientTestingModule } from '@angular/common/http/testing'; | ||
import { MarkdownModule } from 'ngx-markdown'; | ||
|
||
describe('ChatIntegrationComponent', () => { | ||
let component: ChatIntegrationComponent; | ||
let fixture: ComponentFixture<ChatIntegrationComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [ | ||
ChatIntegrationComponent, | ||
HttpClientTestingModule, | ||
MarkdownModule.forRoot(), | ||
], | ||
}).compileComponents(); | ||
|
||
fixture = TestBed.createComponent(ChatIntegrationComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.