Spaces:
Paused
Paused
Update flare-ui/src/app/components/chat/chat.component.html
Browse files
flare-ui/src/app/components/chat/chat.component.html
CHANGED
|
@@ -1,61 +1,92 @@
|
|
| 1 |
-
<div
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
<mat-
|
| 5 |
-
<mat-
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
</
|
|
|
|
| 19 |
|
| 20 |
-
|
| 21 |
-
<div *ngIf="!sessionId" class="start-wrapper">
|
| 22 |
-
<button mat-raised-button color="primary" (click)="startChat()">
|
| 23 |
-
<mat-icon>chat</mat-icon>
|
| 24 |
-
Start Chat
|
| 25 |
-
</button>
|
| 26 |
-
</div>
|
| 27 |
|
| 28 |
-
|
| 29 |
-
<
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
|
|
|
|
|
|
| 40 |
</div>
|
| 41 |
-
</div>
|
| 42 |
|
| 43 |
-
|
| 44 |
-
<mat-form-field appearance="outline" class="flex-1">
|
| 45 |
-
<input
|
| 46 |
-
matInput
|
| 47 |
-
placeholder="Type your message…"
|
| 48 |
-
[formControl]="input"
|
| 49 |
-
autocomplete="off"/>
|
| 50 |
-
</mat-form-field>
|
| 51 |
-
|
| 52 |
-
<button
|
| 53 |
-
mat-icon-button
|
| 54 |
-
color="primary"
|
| 55 |
-
type="submit"
|
| 56 |
-
[disabled]="input.invalid">
|
| 57 |
-
<mat-icon>send</mat-icon>
|
| 58 |
-
</button>
|
| 59 |
-
</form>
|
| 60 |
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<div class="chat-container">
|
| 2 |
+
<!-- Project Selection and Start Chat -->
|
| 3 |
+
<div *ngIf="!sessionId" class="start-wrapper">
|
| 4 |
+
<mat-card>
|
| 5 |
+
<mat-card-header>
|
| 6 |
+
<mat-icon mat-card-avatar>chat_bubble_outline</mat-icon>
|
| 7 |
+
<mat-card-title>Start a Chat Session</mat-card-title>
|
| 8 |
+
<mat-card-subtitle>Select a project to begin testing</mat-card-subtitle>
|
| 9 |
+
</mat-card-header>
|
| 10 |
+
|
| 11 |
+
<mat-card-content>
|
| 12 |
+
<mat-form-field appearance="outline" class="project-select">
|
| 13 |
+
<mat-label>Select Project</mat-label>
|
| 14 |
+
<mat-select [(ngModel)]="selectedProject" required>
|
| 15 |
+
<mat-option *ngFor="let p of projects" [value]="p">{{ p }}</mat-option>
|
| 16 |
+
</mat-select>
|
| 17 |
+
<mat-hint>Choose an enabled project with published version</mat-hint>
|
| 18 |
+
</mat-form-field>
|
| 19 |
+
</mat-card-content>
|
| 20 |
+
|
| 21 |
+
<mat-card-actions align="end">
|
| 22 |
+
<button
|
| 23 |
+
mat-raised-button
|
| 24 |
+
color="primary"
|
| 25 |
+
(click)="startChat()"
|
| 26 |
+
[disabled]="!selectedProject"
|
| 27 |
+
>
|
| 28 |
+
<mat-icon>chat</mat-icon>
|
| 29 |
+
Start Chat
|
| 30 |
+
</button>
|
| 31 |
+
</mat-card-actions>
|
| 32 |
+
</mat-card>
|
| 33 |
+
</div>
|
| 34 |
|
| 35 |
+
<!-- Chat Panel -->
|
| 36 |
+
<mat-card *ngIf="sessionId" class="chat-card">
|
| 37 |
+
<mat-card-header>
|
| 38 |
+
<mat-icon mat-card-avatar>smart_toy</mat-icon>
|
| 39 |
+
<mat-card-title>{{ selectedProject }}</mat-card-title>
|
| 40 |
+
<mat-card-subtitle>Session: {{ sessionId.substring(0, 8) }}...</mat-card-subtitle>
|
| 41 |
+
<div class="spacer"></div>
|
| 42 |
+
<button mat-icon-button (click)="endSession()" matTooltip="End Session">
|
| 43 |
+
<mat-icon>close</mat-icon>
|
| 44 |
+
</button>
|
| 45 |
+
</mat-card-header>
|
| 46 |
|
| 47 |
+
<mat-divider></mat-divider>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
+
<div class="chat-history" #scrollMe>
|
| 50 |
+
<div
|
| 51 |
+
*ngFor="let msg of messages"
|
| 52 |
+
[ngClass]="{
|
| 53 |
+
'msg-row': true,
|
| 54 |
+
'me': msg.author === 'user',
|
| 55 |
+
'bot': msg.author === 'assistant'
|
| 56 |
+
}"
|
| 57 |
+
>
|
| 58 |
+
<mat-icon class="msg-icon">
|
| 59 |
+
{{ msg.author === 'user' ? 'person' : 'smart_toy' }}
|
| 60 |
+
</mat-icon>
|
| 61 |
+
<span class="bubble">{{ msg.text }}</span>
|
| 62 |
+
</div>
|
| 63 |
</div>
|
|
|
|
| 64 |
|
| 65 |
+
<mat-divider></mat-divider>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
|
| 67 |
+
<form (ngSubmit)="send()" class="input-row">
|
| 68 |
+
<mat-form-field appearance="outline" class="flex-1">
|
| 69 |
+
<mat-label>Type your message</mat-label>
|
| 70 |
+
<input
|
| 71 |
+
matInput
|
| 72 |
+
placeholder="Ask something..."
|
| 73 |
+
[formControl]="input"
|
| 74 |
+
autocomplete="off"
|
| 75 |
+
cdkTextareaAutosize
|
| 76 |
+
#autosize="cdkTextareaAutosize"
|
| 77 |
+
cdkAutosizeMinRows="1"
|
| 78 |
+
cdkAutosizeMaxRows="3"/>
|
| 79 |
+
<mat-hint>Press Enter to send</mat-hint>
|
| 80 |
+
</mat-form-field>
|
| 81 |
+
|
| 82 |
+
<button
|
| 83 |
+
mat-fab
|
| 84 |
+
color="primary"
|
| 85 |
+
type="submit"
|
| 86 |
+
[disabled]="input.invalid || !input.value?.trim()"
|
| 87 |
+
class="send-button">
|
| 88 |
+
<mat-icon>send</mat-icon>
|
| 89 |
+
</button>
|
| 90 |
+
</form>
|
| 91 |
+
</mat-card>
|
| 92 |
+
</div>
|