ciyidogan commited on
Commit
74d4ba8
·
verified ·
1 Parent(s): 71db8c3

Update flare-ui/src/app/dialogs/version-edit-dialog/version-edit-dialog.component.html

Browse files
flare-ui/src/app/dialogs/version-edit-dialog/version-edit-dialog.component.html CHANGED
@@ -1,151 +1,161 @@
1
- <h2 mat-dialog-title>
2
- Manage Versions - {{ project.name }}
3
- <mat-chip-listbox class="title-chips">
4
- <mat-chip-option>{{ project.caption }}</mat-chip-option>
5
- <mat-chip-option>{{ versions.length }} versions</mat-chip-option>
6
- </mat-chip-listbox>
7
- </h2>
 
 
 
8
 
9
- <mat-dialog-content>
10
- <div class="version-management-container">
11
-
12
  <!-- Version Selector -->
13
  <div class="version-selector">
14
- <mat-form-field appearance="outline" class="version-select">
15
  <mat-label>Select Version</mat-label>
16
- <mat-select [(value)]="selectedVersion" (selectionChange)="loadVersion($event.value)">
17
  <mat-option *ngFor="let version of versions" [value]="version">
18
- Version {{ version.no }} - {{ version.caption }}
19
- <span class="version-status" *ngIf="version.published">(Published)</span>
20
  </mat-option>
21
  </mat-select>
22
  </mat-form-field>
23
 
24
  <div class="version-actions">
25
- <button mat-raised-button color="primary" (click)="createVersion()" [disabled]="creating">
26
  <mat-icon>add</mat-icon>
27
  New Version
28
  </button>
 
 
 
 
29
  <button mat-button (click)="compareVersions()" [disabled]="versions.length < 2">
30
  <mat-icon>compare_arrows</mat-icon>
31
  Compare
32
  </button>
 
 
 
 
 
33
  </div>
34
  </div>
35
 
36
- <mat-progress-bar *ngIf="loading" mode="indeterminate"></mat-progress-bar>
37
-
38
- <!-- Warning for published version -->
39
  <div class="alert alert-warning" *ngIf="selectedVersion?.published">
40
- <mat-icon>info</mat-icon>
41
- This version is published and cannot be edited. Create a new version or unpublish to make changes.
 
 
 
 
 
 
42
  </div>
43
 
44
  <!-- Version Editor -->
45
  <div class="version-editor" *ngIf="selectedVersion && !loading">
46
  <form [formGroup]="versionForm">
47
- <mat-tab-group [(selectedIndex)]="selectedTabIndex" dynamicHeight>
48
  <!-- General Tab -->
49
  <mat-tab label="General">
50
  <div class="tab-content">
51
- <div class="metadata-info">
52
- <mat-chip-listbox>
53
- <mat-chip-option>Version {{ selectedVersion.no }}</mat-chip-option>
54
- <mat-chip-option *ngIf="selectedVersion.published" selected>Published</mat-chip-option>
55
- <mat-chip-option *ngIf="!selectedVersion.published">Draft</mat-chip-option>
56
- <mat-chip-option *ngIf="selectedVersion.last_update_date">
57
- Last updated: {{ selectedVersion.last_update_date | date:'short' }}
58
- </mat-chip-option>
59
- </mat-chip-listbox>
60
- </div>
61
 
62
- <mat-form-field appearance="outline" class="full-width">
63
- <mat-label>Caption</mat-label>
64
- <input matInput formControlName="caption" placeholder="Version description" [readonly]="!canEdit">
 
65
  </mat-form-field>
66
 
67
- <mat-form-field appearance="outline" class="full-width">
68
- <mat-label>General System Prompt</mat-label>
69
- <textarea matInput
70
- class="code-textarea"
71
- formControlName="general_prompt"
72
- rows="10"
73
- placeholder="Define the assistant's behavior and capabilities..."
74
- [readonly]="!canEdit"></textarea>
75
- <mat-hint>This prompt defines the overall behavior of your assistant</mat-hint>
76
  </mat-form-field>
77
 
78
- <div class="action-buttons">
79
- <button mat-raised-button color="warn"
80
- (click)="deleteVersion()"
81
- [disabled]="selectedVersion.published"
82
- *ngIf="!selectedVersion.published">
83
- <mat-icon>delete</mat-icon>
84
- Delete Version
85
- </button>
 
 
 
86
  </div>
87
  </div>
88
  </mat-tab>
89
 
90
- <!-- LLM Configuration Tab -->
91
  <mat-tab label="LLM">
92
- <div class="tab-content" formGroupName="llm">
93
- <mat-form-field appearance="outline" class="full-width">
94
- <mat-label>Model Repository ID</mat-label>
95
- <input matInput formControlName="repo_id"
96
- placeholder="e.g., ytu-ce-cosmos/Turkish-Llama-8b-Instruct-v0.1"
97
- [readonly]="!canEdit">
98
- <mat-hint>HuggingFace model repository ID</mat-hint>
 
 
99
  </mat-form-field>
100
 
101
- <h4>Generation Configuration</h4>
102
- <div formGroupName="generation_config" class="generation-config">
103
- <mat-form-field appearance="outline">
104
- <mat-label>Max New Tokens</mat-label>
105
- <input matInput type="number" formControlName="max_new_tokens" [readonly]="!canEdit">
106
- <mat-hint>Maximum tokens to generate (1-2048)</mat-hint>
107
- </mat-form-field>
 
 
 
108
 
109
- <mat-form-field appearance="outline">
110
- <mat-label>Temperature</mat-label>
111
- <input matInput type="number" step="0.1" formControlName="temperature" [readonly]="!canEdit">
112
- <mat-hint>Controls randomness (0-2)</mat-hint>
113
- </mat-form-field>
114
 
115
- <mat-form-field appearance="outline">
116
- <mat-label>Top P</mat-label>
117
- <input matInput type="number" step="0.1" formControlName="top_p" [readonly]="!canEdit">
118
- <mat-hint>Nucleus sampling (0-1)</mat-hint>
119
- </mat-form-field>
120
 
121
- <mat-form-field appearance="outline">
122
- <mat-label>Repetition Penalty</mat-label>
123
- <input matInput type="number" step="0.1" formControlName="repetition_penalty" [readonly]="!canEdit">
124
- <mat-hint>Penalty for repetition (1-2)</mat-hint>
125
- </mat-form-field>
126
- </div>
127
 
128
- <mat-divider></mat-divider>
 
 
 
 
129
 
130
- <div class="fine-tune-section">
131
- <mat-checkbox formControlName="use_fine_tune" [disabled]="!canEdit">
132
- Use Fine-Tuned Model
133
  </mat-checkbox>
134
 
135
- <mat-form-field appearance="outline" class="full-width"
136
- *ngIf="versionForm.get('llm.use_fine_tune')?.value">
137
- <mat-label>Fine-Tune ZIP URL</mat-label>
138
- <input matInput formControlName="fine_tune_zip"
139
- placeholder="https://example.com/lora-adapter.zip"
140
- [readonly]="!canEdit">
141
- <mat-hint>URL to LoRA adapter ZIP file</mat-hint>
142
  </mat-form-field>
143
  </div>
144
  </div>
145
  </mat-tab>
146
 
147
  <!-- Intents Tab -->
148
- <mat-tab label="Intents">
149
  <div class="tab-content">
150
  <div class="intents-header">
151
  <h3>Intent Definitions</h3>
@@ -155,17 +165,17 @@
155
  </button>
156
  </div>
157
 
158
- <!-- Locale selector for examples display -->
159
- <mat-form-field appearance="outline" class="locale-selector">
160
  <mat-label>Example Language</mat-label>
161
  <mat-select [(value)]="selectedExampleLocale">
162
- <mat-option *ngFor="let locale of project.supported_locales" [value]="locale">
163
- {{ locale }}
164
  </mat-option>
165
  </mat-select>
166
  </mat-form-field>
167
 
168
- <div formArrayName="intents" class="intents-list">
169
  <mat-expansion-panel *ngFor="let intent of intents.controls; let i = index"
170
  [formGroupName]="i">
171
  <mat-expansion-panel-header>
@@ -201,29 +211,10 @@
201
  </div>
202
 
203
  <div class="summary-item" *ngIf="getLocalizedExamples(intent.get('examples')?.value, selectedExampleLocale).length > 0">
204
- <strong>Examples ({{ selectedExampleLocale }}):</strong>
205
- <mat-chip-listbox>
206
- <mat-chip-option *ngFor="let example of getLocalizedExamples(intent.get('examples')?.value, selectedExampleLocale)">
207
- {{ example.example }}
208
- </mat-chip-option>
209
- </mat-chip-listbox>
210
- </div>
211
-
212
- <div class="summary-item" *ngIf="canEdit">
213
- <strong>Examples ({{ selectedExampleLocale }}):</strong>
214
  <div class="examples-display">
215
- <mat-form-field appearance="outline" class="full-width">
216
- <mat-label>Add Example</mat-label>
217
- <input matInput #exampleInput
218
- placeholder="Type an example and press Enter"
219
- (keyup.enter)="addLocalizedExample(i, exampleInput.value); exampleInput.value=''"
220
- [disabled]="!canEdit">
221
- </mat-form-field>
222
- <mat-chip-row *ngFor="let example of getLocalizedExamples(intent.get('examples')?.value, selectedExampleLocale)"
223
- (removed)="removeLocalizedExample(i, example)"
224
- [removable]="canEdit">
225
- {{ example.example }}
226
- <mat-icon matChipRemove *ngIf="canEdit">cancel</mat-icon>
227
  </mat-chip-row>
228
  </div>
229
  </div>
@@ -232,9 +223,14 @@
232
  <strong>Parameters:</strong>
233
  <mat-list>
234
  <mat-list-item *ngFor="let param of getIntentParameters(i).controls">
235
- <mat-icon matListItemIcon>{{ param.get('required')?.value ? 'check_box' : 'check_box_outline_blank' }}</mat-icon>
 
 
236
  <div matListItemTitle>{{ param.get('name')?.value }}</div>
237
- <div matListItemLine>{{ param.get('type')?.value }} - {{ param.get('caption')?.value }}</div>
 
 
 
238
  </mat-list-item>
239
  </mat-list>
240
  </div>
@@ -242,36 +238,22 @@
242
  </div>
243
  </mat-expansion-panel>
244
  </div>
245
-
246
- <div class="empty-state" *ngIf="intents.length === 0">
247
- <mat-icon>psychology</mat-icon>
248
- <p>No intents defined yet.</p>
249
- <button mat-raised-button color="primary" (click)="addIntent()" [disabled]="!canEdit">
250
- Add First Intent
251
- </button>
252
- </div>
253
  </div>
254
  </mat-tab>
255
 
256
  <!-- Test Tab -->
257
  <mat-tab label="Test">
258
  <div class="tab-content">
259
- <h3>Test Intent Detection</h3>
260
- <p>Enter a user message to test which intent would be detected.</p>
261
-
262
- <mat-form-field appearance="outline" class="full-width">
263
- <mat-label>User Message</mat-label>
264
- <textarea matInput
265
- [(ngModel)]="testUserMessage"
266
- [ngModelOptions]="{standalone: true}"
267
- rows="3"
268
- placeholder="e.g., I want to book a flight from Istanbul to Ankara"></textarea>
269
  </mat-form-field>
270
 
271
- <button mat-raised-button color="accent"
272
- (click)="testIntentDetection()"
273
- [disabled]="testing || !testUserMessage">
274
- <mat-icon>play_arrow</mat-icon>
275
  {{ testing ? 'Testing...' : 'Test Intent Detection' }}
276
  </button>
277
 
 
1
+ <mat-dialog-content class="version-management-container">
2
+ <h2 mat-dialog-title>
3
+ {{ project.name }} - Version Management
4
+ <mat-chip-listbox class="title-chips">
5
+ <mat-chip-option [disabled]="true">
6
+ <mat-icon>layers</mat-icon>
7
+ {{ versions.length }} versions
8
+ </mat-chip-option>
9
+ </mat-chip-listbox>
10
+ </h2>
11
 
12
+ <div class="dialog-content">
 
 
13
  <!-- Version Selector -->
14
  <div class="version-selector">
15
+ <mat-form-field class="version-select">
16
  <mat-label>Select Version</mat-label>
17
+ <mat-select [(value)]="selectedVersion" (selectionChange)="onVersionChange($event.value)">
18
  <mat-option *ngFor="let version of versions" [value]="version">
19
+ Version {{ version.no }} - {{ version.caption || 'No description' }}
20
+ <span class="version-status" *ngIf="version.published">[Published]</span>
21
  </mat-option>
22
  </mat-select>
23
  </mat-form-field>
24
 
25
  <div class="version-actions">
26
+ <button mat-raised-button color="primary" (click)="createVersion()">
27
  <mat-icon>add</mat-icon>
28
  New Version
29
  </button>
30
+ <button mat-button (click)="copyVersion()" [disabled]="!selectedVersion">
31
+ <mat-icon>content_copy</mat-icon>
32
+ Copy
33
+ </button>
34
  <button mat-button (click)="compareVersions()" [disabled]="versions.length < 2">
35
  <mat-icon>compare_arrows</mat-icon>
36
  Compare
37
  </button>
38
+ <button mat-button color="warn" (click)="deleteVersion()"
39
+ [disabled]="!selectedVersion || selectedVersion.published">
40
+ <mat-icon>delete</mat-icon>
41
+ Delete
42
+ </button>
43
  </div>
44
  </div>
45
 
46
+ <!-- Published Version Warning -->
 
 
47
  <div class="alert alert-warning" *ngIf="selectedVersion?.published">
48
+ <mat-icon>warning</mat-icon>
49
+ <span>This version is published and cannot be edited. Create a copy to make changes.</span>
50
+ </div>
51
+
52
+ <!-- Loading State -->
53
+ <div class="loading-container" *ngIf="loading">
54
+ <mat-progress-spinner mode="indeterminate" diameter="40"></mat-progress-spinner>
55
+ <p>Loading version details...</p>
56
  </div>
57
 
58
  <!-- Version Editor -->
59
  <div class="version-editor" *ngIf="selectedVersion && !loading">
60
  <form [formGroup]="versionForm">
61
+ <mat-tab-group>
62
  <!-- General Tab -->
63
  <mat-tab label="General">
64
  <div class="tab-content">
65
+ <mat-form-field class="full-width">
66
+ <mat-label>Version Caption</mat-label>
67
+ <input matInput formControlName="caption" [readonly]="!canEdit">
68
+ <mat-hint>Brief description of this version</mat-hint>
69
+ </mat-form-field>
 
 
 
 
 
70
 
71
+ <mat-form-field class="full-width">
72
+ <mat-label>General Prompt</mat-label>
73
+ <textarea matInput formControlName="prompt" rows="8" [readonly]="!canEdit"></textarea>
74
+ <mat-hint>System prompt that defines the assistant's behavior</mat-hint>
75
  </mat-form-field>
76
 
77
+ <mat-form-field class="full-width">
78
+ <mat-label>Welcome Prompt</mat-label>
79
+ <textarea matInput formControlName="welcome_prompt" rows="4" [readonly]="!canEdit"></textarea>
80
+ <mat-hint>Initial greeting message (use {{variables.user_name}} for personalization)</mat-hint>
 
 
 
 
 
81
  </mat-form-field>
82
 
83
+ <div class="metadata-info">
84
+ <mat-chip-listbox>
85
+ <mat-chip-option [disabled]="true">
86
+ <mat-icon>schedule</mat-icon>
87
+ Last updated: {{ selectedVersion.last_update_date | date:'short' }}
88
+ </mat-chip-option>
89
+ <mat-chip-option [disabled]="true" *ngIf="selectedVersion.last_update_user">
90
+ <mat-icon>person</mat-icon>
91
+ By: {{ selectedVersion.last_update_user }}
92
+ </mat-chip-option>
93
+ </mat-chip-listbox>
94
  </div>
95
  </div>
96
  </mat-tab>
97
 
98
+ <!-- LLM Tab -->
99
  <mat-tab label="LLM">
100
+ <div class="tab-content">
101
+ <mat-form-field class="full-width">
102
+ <mat-label>Model</mat-label>
103
+ <mat-select formControlName="model" [disabled]="!canEdit">
104
+ <mat-option value="gpt-3.5-turbo">GPT-3.5 Turbo</mat-option>
105
+ <mat-option value="gpt-4">GPT-4</mat-option>
106
+ <mat-option value="claude-2">Claude 2</mat-option>
107
+ <mat-option value="llama-2">Llama 2</mat-option>
108
+ </mat-select>
109
  </mat-form-field>
110
 
111
+ <mat-expansion-panel>
112
+ <mat-expansion-panel-header>
113
+ <mat-panel-title>Generation Configuration</mat-panel-title>
114
+ </mat-expansion-panel-header>
115
+
116
+ <div class="generation-config" formGroupName="generation_config">
117
+ <mat-form-field>
118
+ <mat-label>Max Tokens</mat-label>
119
+ <input matInput type="number" formControlName="max_new_tokens" [readonly]="!canEdit">
120
+ </mat-form-field>
121
 
122
+ <mat-form-field>
123
+ <mat-label>Temperature</mat-label>
124
+ <input matInput type="number" step="0.1" formControlName="temperature" [readonly]="!canEdit">
125
+ </mat-form-field>
 
126
 
127
+ <mat-form-field>
128
+ <mat-label>Top P</mat-label>
129
+ <input matInput type="number" step="0.1" formControlName="top_p" [readonly]="!canEdit">
130
+ </mat-form-field>
 
131
 
132
+ <mat-form-field>
133
+ <mat-label>Top K</mat-label>
134
+ <input matInput type="number" formControlName="top_k" [readonly]="!canEdit">
135
+ </mat-form-field>
 
 
136
 
137
+ <mat-checkbox formControlName="do_sample" [disabled]="!canEdit">
138
+ Do Sample
139
+ </mat-checkbox>
140
+ </div>
141
+ </mat-expansion-panel>
142
 
143
+ <div class="fine-tune-section" formGroupName="fine_tune">
144
+ <mat-checkbox formControlName="enabled" [disabled]="!canEdit">
145
+ Enable Fine-tuning
146
  </mat-checkbox>
147
 
148
+ <mat-form-field class="full-width" *ngIf="versionForm.get('fine_tune.enabled')?.value">
149
+ <mat-label>Adapter Path</mat-label>
150
+ <input matInput formControlName="adapter_path" [readonly]="!canEdit">
151
+ <mat-hint>Path to LoRA adapter</mat-hint>
 
 
 
152
  </mat-form-field>
153
  </div>
154
  </div>
155
  </mat-tab>
156
 
157
  <!-- Intents Tab -->
158
+ <mat-tab label="Intents" [matBadge]="intents.length" matBadgeColor="primary">
159
  <div class="tab-content">
160
  <div class="intents-header">
161
  <h3>Intent Definitions</h3>
 
165
  </button>
166
  </div>
167
 
168
+ <!-- Example Language Selector -->
169
+ <mat-form-field class="locale-selector">
170
  <mat-label>Example Language</mat-label>
171
  <mat-select [(value)]="selectedExampleLocale">
172
+ <mat-option *ngFor="let locale of getAvailableLocales()" [value]="locale.code">
173
+ {{ locale.name }}
174
  </mat-option>
175
  </mat-select>
176
  </mat-form-field>
177
 
178
+ <div class="intents-list">
179
  <mat-expansion-panel *ngFor="let intent of intents.controls; let i = index"
180
  [formGroupName]="i">
181
  <mat-expansion-panel-header>
 
211
  </div>
212
 
213
  <div class="summary-item" *ngIf="getLocalizedExamples(intent.get('examples')?.value, selectedExampleLocale).length > 0">
214
+ <strong>Examples ({{ getLocaleName(selectedExampleLocale) }}):</strong>
 
 
 
 
 
 
 
 
 
215
  <div class="examples-display">
216
+ <mat-chip-row *ngFor="let ex of getLocalizedExamples(intent.get('examples')?.value, selectedExampleLocale)">
217
+ {{ ex.example }}
 
 
 
 
 
 
 
 
 
 
218
  </mat-chip-row>
219
  </div>
220
  </div>
 
223
  <strong>Parameters:</strong>
224
  <mat-list>
225
  <mat-list-item *ngFor="let param of getIntentParameters(i).controls">
226
+ <mat-icon matListItemIcon>
227
+ {{ param.get('required')?.value ? 'check_box' : 'check_box_outline_blank' }}
228
+ </mat-icon>
229
  <div matListItemTitle>{{ param.get('name')?.value }}</div>
230
+ <div matListItemLine>
231
+ {{ getParameterCaptionDisplay(param.get('caption')?.value) }}
232
+ ({{ param.get('type')?.value }})
233
+ </div>
234
  </mat-list-item>
235
  </mat-list>
236
  </div>
 
238
  </div>
239
  </mat-expansion-panel>
240
  </div>
 
 
 
 
 
 
 
 
241
  </div>
242
  </mat-tab>
243
 
244
  <!-- Test Tab -->
245
  <mat-tab label="Test">
246
  <div class="tab-content">
247
+ <mat-form-field class="full-width">
248
+ <mat-label>Test Input</mat-label>
249
+ <textarea matInput [(ngModel)]="testInput" rows="3"
250
+ placeholder="Enter a message to test intent detection..."
251
+ [ngModelOptions]="{standalone: true}"></textarea>
 
 
 
 
 
252
  </mat-form-field>
253
 
254
+ <button mat-raised-button color="primary" (click)="testIntentDetection()"
255
+ [disabled]="!testInput || testing">
256
+ <mat-icon>science</mat-icon>
 
257
  {{ testing ? 'Testing...' : 'Test Intent Detection' }}
258
  </button>
259