ciyidogan commited on
Commit
6a0c67b
·
verified ·
1 Parent(s): 9a94981

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
@@ -34,6 +34,12 @@
34
  </div>
35
 
36
  <mat-progress-bar *ngIf="loading" mode="indeterminate"></mat-progress-bar>
 
 
 
 
 
 
37
 
38
  <!-- Version Editor -->
39
  <div class="version-editor" *ngIf="selectedVersion && !loading">
@@ -44,7 +50,7 @@
44
  <div class="tab-content">
45
  <div class="metadata-info">
46
  <mat-chip-listbox>
47
- <mat-chip-option>Version ID: {{ versionForm.get('id')?.value }}</mat-chip-option>
48
  <mat-chip-option *ngIf="selectedVersion.published" selected>Published</mat-chip-option>
49
  <mat-chip-option *ngIf="!selectedVersion.published">Draft</mat-chip-option>
50
  <mat-chip-option *ngIf="selectedVersion.last_update_date">
@@ -55,7 +61,7 @@
55
 
56
  <mat-form-field appearance="outline" class="full-width">
57
  <mat-label>Caption</mat-label>
58
- <input matInput formControlName="caption" placeholder="Version description">
59
  </mat-form-field>
60
 
61
  <mat-form-field appearance="outline" class="full-width">
@@ -64,7 +70,8 @@
64
  class="code-textarea"
65
  formControlName="general_prompt"
66
  rows="10"
67
- placeholder="Define the assistant's behavior and capabilities..."></textarea>
 
68
  <mat-hint>This prompt defines the overall behavior of your assistant</mat-hint>
69
  </mat-form-field>
70
 
@@ -86,7 +93,8 @@
86
  <mat-form-field appearance="outline" class="full-width">
87
  <mat-label>Model Repository ID</mat-label>
88
  <input matInput formControlName="repo_id"
89
- placeholder="e.g., ytu-ce-cosmos/Turkish-Llama-8b-Instruct-v0.1">
 
90
  <mat-hint>HuggingFace model repository ID</mat-hint>
91
  </mat-form-field>
92
 
@@ -94,25 +102,25 @@
94
  <div formGroupName="generation_config" class="generation-config">
95
  <mat-form-field appearance="outline">
96
  <mat-label>Max New Tokens</mat-label>
97
- <input matInput type="number" formControlName="max_new_tokens">
98
  <mat-hint>Maximum tokens to generate (1-2048)</mat-hint>
99
  </mat-form-field>
100
 
101
  <mat-form-field appearance="outline">
102
  <mat-label>Temperature</mat-label>
103
- <input matInput type="number" step="0.1" formControlName="temperature">
104
  <mat-hint>Controls randomness (0-2)</mat-hint>
105
  </mat-form-field>
106
 
107
  <mat-form-field appearance="outline">
108
  <mat-label>Top P</mat-label>
109
- <input matInput type="number" step="0.1" formControlName="top_p">
110
  <mat-hint>Nucleus sampling (0-1)</mat-hint>
111
  </mat-form-field>
112
 
113
  <mat-form-field appearance="outline">
114
  <mat-label>Repetition Penalty</mat-label>
115
- <input matInput type="number" step="0.1" formControlName="repetition_penalty">
116
  <mat-hint>Penalty for repetition (1-2)</mat-hint>
117
  </mat-form-field>
118
  </div>
@@ -120,7 +128,7 @@
120
  <mat-divider></mat-divider>
121
 
122
  <div class="fine-tune-section">
123
- <mat-checkbox formControlName="use_fine_tune">
124
  Use Fine-Tuned Model
125
  </mat-checkbox>
126
 
@@ -128,7 +136,8 @@
128
  *ngIf="versionForm.get('llm.use_fine_tune')?.value">
129
  <mat-label>Fine-Tune ZIP URL</mat-label>
130
  <input matInput formControlName="fine_tune_zip"
131
- placeholder="https://example.com/lora-adapter.zip">
 
132
  <mat-hint>URL to LoRA adapter ZIP file</mat-hint>
133
  </mat-form-field>
134
  </div>
@@ -140,12 +149,22 @@
140
  <div class="tab-content">
141
  <div class="intents-header">
142
  <h3>Intent Definitions</h3>
143
- <button mat-raised-button color="primary" (click)="addIntent()">
144
  <mat-icon>add</mat-icon>
145
  Add Intent
146
  </button>
147
  </div>
148
 
 
 
 
 
 
 
 
 
 
 
149
  <div formArrayName="intents" class="intents-list">
150
  <mat-expansion-panel *ngFor="let intent of intents.controls; let i = index"
151
  [formGroupName]="i">
@@ -164,11 +183,11 @@
164
 
165
  <div class="intent-content">
166
  <div class="intent-actions">
167
- <button mat-button color="primary" (click)="editIntent(i)">
168
  <mat-icon>edit</mat-icon>
169
  Edit Details
170
  </button>
171
- <button mat-button color="warn" (click)="removeIntent(i)">
172
  <mat-icon>delete</mat-icon>
173
  Delete
174
  </button>
@@ -181,15 +200,34 @@
181
  <p>{{ intent.get('detection_prompt')?.value || 'Not set' }}</p>
182
  </div>
183
 
184
- <div class="summary-item" *ngIf="getIntentExamples(i).length > 0">
185
- <strong>Examples:</strong>
186
  <mat-chip-listbox>
187
- <mat-chip-option *ngFor="let example of getIntentExamples(i).controls">
188
- {{ example.value }}
189
  </mat-chip-option>
190
  </mat-chip-listbox>
191
  </div>
192
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
193
  <div class="summary-item" *ngIf="getIntentParameters(i).length > 0">
194
  <strong>Parameters:</strong>
195
  <mat-list>
@@ -208,7 +246,7 @@
208
  <div class="empty-state" *ngIf="intents.length === 0">
209
  <mat-icon>psychology</mat-icon>
210
  <p>No intents defined yet.</p>
211
- <button mat-raised-button color="primary" (click)="addIntent()">
212
  Add First Intent
213
  </button>
214
  </div>
@@ -292,7 +330,7 @@
292
  <button mat-raised-button
293
  color="primary"
294
  (click)="saveVersion()"
295
- [disabled]="!selectedVersion || selectedVersion.published || versionForm.invalid || saving">
296
  {{ saving ? 'Saving...' : 'Save Changes' }}
297
  </button>
298
  <button mat-raised-button
 
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">
 
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">
 
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">
 
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
 
 
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
 
 
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>
 
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
 
 
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>
 
149
  <div class="tab-content">
150
  <div class="intents-header">
151
  <h3>Intent Definitions</h3>
152
+ <button mat-raised-button color="primary" (click)="addIntent()" [disabled]="!canEdit">
153
  <mat-icon>add</mat-icon>
154
  Add Intent
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">
 
183
 
184
  <div class="intent-content">
185
  <div class="intent-actions">
186
+ <button mat-button color="primary" (click)="editIntent(i)" [disabled]="!canEdit">
187
  <mat-icon>edit</mat-icon>
188
  Edit Details
189
  </button>
190
+ <button mat-button color="warn" (click)="removeIntent(i)" [disabled]="!canEdit">
191
  <mat-icon>delete</mat-icon>
192
  Delete
193
  </button>
 
200
  <p>{{ intent.get('detection_prompt')?.value || 'Not set' }}</p>
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>
230
+
231
  <div class="summary-item" *ngIf="getIntentParameters(i).length > 0">
232
  <strong>Parameters:</strong>
233
  <mat-list>
 
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>
 
330
  <button mat-raised-button
331
  color="primary"
332
  (click)="saveVersion()"
333
+ [disabled]="!selectedVersion || !canEdit || versionForm.invalid || saving">
334
  {{ saving ? 'Saving...' : 'Save Changes' }}
335
  </button>
336
  <button mat-raised-button