blob: f83c459ab837d1a903a49bd473d2b81c2cf63624 (
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
|
<!--
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.
-->
<nz-modal [(nzVisible)]="showModal" [nzTitle]="title" nzOkText="Ok" (nzOnCancel)="handleCancel()" [nzFooter]="modalFooter"
(nzOnOk)="handleOk()" nzWidth="648px" nzHeight="800px">
<form nz-form [formGroup]="validateForm" (ngSubmit)="submitForm()">
<nz-form-item>
<nz-form-label [nzSpan]="8" nzFor="name" nzRequired>Application Name</nz-form-label>
<nz-form-control [nzSpan]="12">
<input [ngClass]="{'disabled-input': isEdit}" type="text" nz-input formControlName="name" maxlength="255" placeholder="Please input application name">
<nz-form-explain *ngIf="validateForm.get('name').dirty && validateForm.get('name').errors">
<ng-container *ngIf="validateForm.get('name').hasError('required')">
Please input application name
</ng-container>
<ng-container *ngIf="validateForm.get('name').hasError('duplicated')">
{{ 'maas.nameDuplicateTip' | translate}}
</ng-container>
</nz-form-explain>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="8" nzFor="description" nzRequired>Application Description</nz-form-label>
<nz-form-control [nzSpan]="12">
<textarea #despTextarea class="myTextarea" rows="2" nz-input formControlName="description" maxlength="255" (input)="maasService.updateCharCount(despTextarea,despCharCount)"></textarea>
<div #despCharCount id="charCount">0/255</div>
<nz-form-explain *ngIf="validateForm.get('description').dirty && validateForm.get('description').errors">
<ng-container *ngIf="validateForm.get('description').hasError('required')">
Please input application description
</ng-container>
</nz-form-explain>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="8" nzFor="applicationType" nzRequired>Application Type</nz-form-label>
<nz-form-control [nzSpan]="12" [ngClass]="{'disabled-item': isEdit}">
<nz-select name="applicationType" [ngClass]="{'disabled-select': isEdit}"
nzPlaceHolder="Select Application Type" formControlName="applicationType">
<nz-option nzValue="Knowledge Assistant" nzLabel="Knowledge Assistant"></nz-option>
</nz-select>
<nz-form-explain *ngIf="validateForm.get('applicationType').dirty && validateForm.get('applicationType').errors">
Please select application type!
</nz-form-explain>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="8" nzFor="selectedOperator" nzRequired>Operator Name</nz-form-label>
<nz-form-control [nzSpan]="12" [ngClass]="{'disabled-item': isEdit}">
<nz-select name="selectedOperator" [ngClass]="{'disabled-select': isEdit}"
nzPlaceHolder="Select Operator" formControlName="selectedOperator"
(ngModelChange)="handleOperatorChange($event)">
<nz-option *ngFor="let operator of operators" [nzValue]="operator"
[nzLabel]="operator.operatorName"></nz-option>
</nz-select>
<nz-form-explain *ngIf="validateForm.get('selectedOperator').dirty && validateForm.get('selectedOperator').errors">
Please select operator!
</nz-form-explain>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="8" nzFor="selectedPlatform" nzRequired>MaaS Platform Name</nz-form-label>
<nz-form-control [nzSpan]="12" [ngClass]="{'disabled-item': isEdit}">
<nz-select name="selectedPlatform" [ngClass]="{'disabled-select': isEdit}"
nzPlaceHolder="Select Platform" formControlName="selectedPlatform"
(ngModelChange)="handleMaasChange($event)">
<nz-option *ngFor="let platform of filteredPlatforms" [nzValue]="platform.maaSPlatformId"
[nzLabel]="platform.maaSPlatformName"></nz-option>
</nz-select>
<nz-form-explain *ngIf="validateForm.get('selectedPlatform').dirty && validateForm.get('selectedPlatform').errors">
Please select maas platform!
</nz-form-explain>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="8" nzFor="selectedModel" nzRequired>Model</nz-form-label>
<nz-form-control [nzSpan]="12">
<nz-select name="selectedModel"
nzPlaceHolder="Select Model" formControlName="selectedModel">
<nz-option *ngFor="let model of filteredModels" [nzValue]="model.modelId" [nzLabel]="model.modelName"></nz-option>
</nz-select>
<nz-form-explain *ngIf="validateForm.get('selectedModel').dirty && validateForm.get('selectedModel').errors">
Please select model!
</nz-form-explain>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="8" nzFor="selectKnowledgeBase" nzRequired>KnowLedge Base</nz-form-label>
<nz-form-control [nzSpan]="12">
<nz-select name="selectKnowledgeBase"
nzPlaceHolder="Select KnowLedge Base" formControlName="selectKnowledgeBase">
<nz-option *ngFor="let knowledgeBase of knowledgeBases" [nzValue]="knowledgeBase.knowledgeBaseId"
[nzLabel]="knowledgeBase.knowledgeBaseName"></nz-option>
</nz-select>
<nz-form-explain *ngIf="validateForm.get('selectKnowledgeBase').dirty && validateForm.get('selectKnowledgeBase').errors">
Please select knowLedge base!
</nz-form-explain>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="8" nzFor="prompt" nzRequired>Prompt</nz-form-label>
<nz-form-control [nzSpan]="12">
<textarea #promptTextarea class="myTextarea" rows="2" nz-input formControlName="prompt" [placeholder]="'maas.application.promptTip' | translate" maxlength="1000" minlength="20" (input)="maasService.updateCharCount(promptTextarea,promptCharCount)"></textarea>
<div #promptCharCount id="charCount">0/1000</div>
<nz-form-explain *ngIf="validateForm.get('prompt').dirty && validateForm.get('prompt').errors">
{{ 'maas.application.promptTip' | translate}}
</nz-form-explain>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="8" nzFor="openingRemarks" nzRequired>Opening Remarks</nz-form-label>
<nz-form-control [nzSpan]="12">
<textarea #orTextarea class="myTextarea" rows="2" nz-input formControlName="openingRemarks" maxlength="500" (input)="maasService.updateCharCount(orTextarea,orCharCount)"></textarea>
<div #orCharCount id="charCount">0/500</div>
<nz-form-explain *ngIf="validateForm.get('openingRemarks').dirty && validateForm.get('openingRemarks').errors">
Please input opening remarks!
</nz-form-explain>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="8" nzFor="temperature" nzRequired>temperature</nz-form-label>
<nz-form-control [nzSpan]="12">
<nz-row class="slider-input-container">
<nz-col nzSpan="10">
<nz-slider [nzMin]="0" [nzMax]="10" [nzStep]="1" (nzOnAfterChange)="handleTemperatureSliderChange($event)" formControlName="temperatureSlider" [nzDefaultValue]="temperature"></nz-slider>
</nz-col>
<div nz-col nzSpan="4">
<nz-input-number class="nz-input-number-container" [nzMin]="0" [nzMax]="10"
formControlName="temperature"
(ngModelChange)="handleTemperatureInputChange($event)"
></nz-input-number>
</div>
</nz-row>
<nz-form-explain *ngIf="validateForm.get('temperature').dirty && validateForm.get('temperature').errors">
Please input temperature!
</nz-form-explain>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="8" nzFor="top_p" nzRequired>top_p</nz-form-label>
<nz-form-control [nzSpan]="12">
<nz-row class="slider-input-container">
<nz-col nzSpan="10">
<nz-slider [nzMin]="0" [nzMax]="10" (nzOnAfterChange)="toppSliderChange($event)" [nzStep]="1" formControlName="top_pSlider" [nzDefaultValue]="top_p"></nz-slider>
</nz-col>
<div nz-col nzSpan="4">
<nz-input-number class="nz-input-number-container" [nzMin]="0" [nzMax]="10" formControlName="top_p" (ngModelChange)="toppInputChange($event)"></nz-input-number>
</div>
</nz-row>
<nz-form-explain *ngIf="validateForm.get('top_p').dirty && validateForm.get('top_p').errors">
Please input top_p!
</nz-form-explain>
</nz-form-control>
</nz-form-item>
</form>
<ng-template #modalFooter>
<button nz-button nzType="default" (click)="handleCancel()">Cancel</button>
<button nz-button nzType="primary" (click)="handleOk()" [nzLoading]="loading">OK</button>
</ng-template>
</nz-modal>
|