summaryrefslogtreecommitdiffstats
path: root/usecaseui-portal/src/app/views/maas/use/use-application.component.html
blob: 6509fbbee3cb5fc8fa1371259e170c488dc730a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!--
    Copyright (C) 2019 CMCC, Inc. and others. All rights reserved.

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

            http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->
<div class="container">
    <div class="fixed-select-wrapper">
        <nz-select nzPlaceHolder="Select Application" style="width: 200px;" [(ngModel)]="selectedName">
            <nz-option *ngFor="let option of options" [nzValue]="option.nzValue" [nzLabel]="option.nzLabel"></nz-option>
        </nz-select>
    </div>
    <div class="chat-container">
        <div *ngFor="let chat of chatHistory">
            <div class="question">
                <div class="question-icon">
                    <div class="question-icon-actions">
                        <span class="anticon anticon-copy question-action" (click)="copy(chat.question)"
                            [nz-tooltip]="'maas.copy' | translate"></span>
                        <span *ngIf="chat.status==='finished'" class="anticon anticon-delete question-action" (click)="deleteQuestion(chat.questionId)"
                            [nz-tooltip]="'maas.delete' | translate"></span>
                    </div>
                    <div>
                        <img src="assets/images/user.png">
                    </div>
                </div>
                <div class="question-container">
                    <markdown class="question-text" [data]="chat.question"></markdown>
                </div>
            </div>
            <br>
            <div>
                <div class="answer-icon">
                    <img src="assets/images/answer.png">
                    <span class="anticon anticon-copy answer-action" (click)="copy(chat.answer)"
                        [nz-tooltip]="'maas.copy' | translate"></span>
                </div>
                <span class="answer-text">
                    <markdown appCodeBlock class="markdown answer-markdown" [ngClass]="{'hidden-cursor': chat.status==='finished'}" *ngIf="chat.answer else default" [data]="chat.answer"></markdown>
                    <ng-template #default>
                        <span class="answer default" [ngClass]="{'hidden-cursor': chat.status==='finished'}" #answerText>
                        </span>
                    </ng-template>
                </span>
            </div>
            <br>
        </div>
    </div>

    <div class="input-wrapper">
        <textarea nzAutosize nz-input [(ngModel)]="question" class="text-input question-input"></textarea>
        <div class="send-wrapper" [ngClass]="{'stop-wrapper': isGeneratingAnswer}">
            <div class="icon" (click)="doAction()"
                [ngClass]="{'send-disabled': !isGeneratingAnswer &&!question, 'send-enabled': question && !isGeneratingAnswer, 'stop-generating': isGeneratingAnswer}"
                [nz-tooltip]="isGeneratingAnswer ? stopGenerating : send">
                <img [src]="isGeneratingAnswer ? 'assets/images/stop-generating.svg' : 'assets/images/send.svg'"
                    [alt]="isGeneratingAnswer ? stopGenerating : send">
            </div>
        </div>
    </div>
</div>