Skip to content

Commit e22b504

Browse files
feat(assistant): additional view and handled error message for files
1 parent a4d399c commit e22b504

27 files changed

+284
-140
lines changed

apps/spa/src/app/app.routes.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,13 @@ export const routes: Routes = [
66
children: [
77
{
88
path: '',
9-
pathMatch: 'full',
10-
redirectTo: '/chat',
11-
},
12-
{
13-
path: 'chat',
149
loadChildren: () =>
1510
import('./modules/+chat/chat.routes').then(m => m.routes),
1611
},
1712
],
1813
},
1914
{
2015
path: '**',
21-
redirectTo: '/chat',
16+
redirectTo: '/',
2217
},
2318
];
Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
<ai-card-footer>
22
<ai-controls>
33
@if (isTranscriptionEnabled) {
4-
<ai-recorder
5-
(send$)="sendAudio$.emit($event)"
6-
[isDisabled]="isDisabled"
7-
[matTooltip]="!isDisabled ? 'Record audio' : ''"
8-
/>
9-
} @if (isAttachmentEnabled) {
10-
<ai-files
11-
[matTooltip]="!isDisabled ? 'Add files' : ''"
12-
[isDisabled]="isDisabled"
13-
/>
4+
<ai-recorder
5+
(send$)="sendAudio$.emit($event)"
6+
[isDisabled]="isDisabled"
7+
[matTooltip]="!isDisabled ? 'Record audio' : ''" />
8+
}
9+
@if (isAttachmentEnabled) {
10+
<ai-files
11+
[matTooltip]="!isDisabled ? 'Add files' : ''"
12+
[isDisabled]="isDisabled" />
1413
}
1514
</ai-controls>
1615

1716
<ai-input
1817
(send$)="!isDisabled && sendMessage$.emit($event)"
19-
[isDisabled]="isDisabled"
20-
/>
18+
[isDisabled]="isDisabled" />
2119
</ai-card-footer>

apps/spa/src/app/components/chat/chat-header/chat-header.component.html

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,30 @@
11
<header class="chat-header">
22
<div class="chat-header__logo">
3-
<img [src]="'/assets/ai-assistant-v2.svg'" alt="logo" class="chat-header__img" />
3+
<img
4+
[src]="'/assets/ai-assistant-v2.svg'"
5+
alt="logo"
6+
class="chat-header__img" />
47
</div>
58
<div class="chat-header__controls">
6-
@if (isConfigEnabled) {
7-
<button
8-
mat-icon-button
9-
matTooltip="Settings"
10-
(click)="config$.emit()"
11-
>
12-
<mat-icon class="char-header__icon">settings</mat-icon>
13-
</button>
14-
} @if (isRefreshEnabled) {
159
<button
1610
mat-icon-button
17-
matTooltip="Refresh"
18-
(click)="refresh$.emit()"
19-
[disabled]="isResponding"
20-
>
21-
<mat-icon class="char-header__icon">refresh</mat-icon>
11+
matTooltip="Change view"
12+
(click)="changeView$.emit()">
13+
<mat-icon class="char-header__icon">fullscreen</mat-icon>
2214
</button>
15+
@if (isConfigEnabled) {
16+
<button mat-icon-button matTooltip="Settings" (click)="config$.emit()">
17+
<mat-icon class="char-header__icon">settings</mat-icon>
18+
</button>
19+
}
20+
@if (isRefreshEnabled) {
21+
<button
22+
mat-icon-button
23+
matTooltip="Refresh"
24+
(click)="refresh$.emit()"
25+
[disabled]="isResponding">
26+
<mat-icon class="char-header__icon">refresh</mat-icon>
27+
</button>
2328
}
2429
<button
2530
class="ai-assistant-toggle"

apps/spa/src/app/components/chat/chat-header/chat-header.component.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
.chat-header__img {
2424
display: block;
2525
max-height: 100px;
26-
height: 18px;
26+
height: 16px;
2727
}
2828

2929
.char-header__icon {

apps/spa/src/app/components/chat/chat-header/chat-header.component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,20 @@ import { Component, EventEmitter, Input, Output } from '@angular/core';
22
import { MatIcon } from '@angular/material/icon';
33
import { MatIconButton } from '@angular/material/button';
44
import { MatTooltip } from '@angular/material/tooltip';
5+
import { RouterLink } from '@angular/router';
56

67
@Component({
78
selector: 'ai-chat-header',
89
standalone: true,
9-
imports: [MatIcon, MatIconButton, MatTooltip],
10+
imports: [MatIcon, MatIconButton, MatTooltip, RouterLink],
1011
templateUrl: './chat-header.component.html',
1112
styleUrl: './chat-header.component.scss',
1213
})
1314
export class ChatHeaderComponent {
1415
@Output() close$ = new EventEmitter();
1516
@Output() refresh$ = new EventEmitter();
1617
@Output() config$ = new EventEmitter();
18+
@Output() changeView$ = new EventEmitter();
1719
@Input() isResponding = false;
1820
@Input() isRefreshEnabled = true;
1921
@Input() isConfigEnabled = true;

apps/spa/src/app/components/controls/files/files.component.html

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,16 @@
33
(click)="input.click()"
44
(drop$)="addFiles($event)"
55
[files]="files()"
6-
[isDisabled]="isDisabled"
7-
>
6+
[isDisabled]="isDisabled">
87
<ai-control-icon>attach_file</ai-control-icon>
98

109
@if (files().length) {
11-
<span class="files__counter" (click)="clear($event)">
12-
<span class="files__number">
13-
{{ files().length }}
10+
<span class="files__counter" (click)="clear($event)">
11+
<span class="files__number">
12+
{{ files().length }}
13+
</span>
14+
<mat-icon class="files__clear"> close </mat-icon>
1415
</span>
15-
<mat-icon class="files__clear"> close </mat-icon>
16-
</span>
1716
}
1817

1918
<input
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<ai-control-item
22
(click)="onRecord()"
33
[ngClass]="{ 'is-active': recording }"
4-
[isDisabled]="isDisabled"
5-
>
4+
[isDisabled]="isDisabled">
65
<ai-control-icon class="recorder__icon">mic</ai-control-icon>
76
<div class="recorder__circle"></div>
87
</ai-control-item>

apps/spa/src/app/components/spinner/spinner.component.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
opacity: 0;
1515
transition: ease-out opacity 0.3s;
1616
pointer-events: none;
17+
border-radius: var(--border-radius-medium);
1718

1819
&.is-active {
1920
opacity: 1;

apps/spa/src/app/modules/+chat/chat.routes.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ export const routes: Routes = [
1313
mod => mod.ChatHomeComponent,
1414
),
1515
},
16+
{
17+
path: 'chat',
18+
loadComponent: () =>
19+
import('./containers/chat-cloud/chat-cloud.component').then(
20+
mod => mod.ChatCloudComponent,
21+
),
22+
},
1623
{
1724
path: 'integration',
1825
loadComponent: () =>
@@ -23,7 +30,7 @@ export const routes: Routes = [
2330
],
2431
},
2532
{
26-
path: 'iframe',
33+
path: 'chat/iframe',
2734
loadComponent: () =>
2835
import('./containers/chat-iframe/chat-iframe.component').then(
2936
mod => mod.ChatIframeComponent,
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<section class="chat-home__examples">
2+
The following are some examples of what you can do with the demo:
3+
4+
<ul class="chat-home__list">
5+
<li>Speak about the weather (eg. What's the weather in London?)</li>
6+
<li>
7+
Speak about the exchange rate (eg. What's the exchange rate for USD?)
8+
</li>
9+
<li>Speak about the Pokemon (eg. Show me the stats of Pikachu)</li>
10+
</ul>
11+
</section>

0 commit comments

Comments
 (0)