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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
<!-- Version Selector -->
|
12 |
+
<div class="version-selector">
|
13 |
+
<mat-form-field appearance="outline" class="version-select">
|
14 |
+
<mat-label>Select Version</mat-label>
|
15 |
+
<mat-select [(value)]="selectedVersion" (selectionChange)="loadVersion($event.value)">
|
16 |
+
<mat-option *ngFor="let version of versions" [value]="version">
|
17 |
+
Version {{ version.id }} - {{ version.caption }}
|
18 |
+
<span class="version-status" *ngIf="version.published">(Published)</span>
|
19 |
+
</mat-option>
|
20 |
+
</mat-select>
|
21 |
+
</mat-form-field>
|
22 |
+
|
23 |
+
<div class="version-actions">
|
24 |
+
<button mat-raised-button color="primary" (click)="createVersion()" [disabled]="creating">
|
25 |
+
<mat-icon>add</mat-icon>
|
26 |
+
New Version
|
27 |
+
</button>
|
28 |
+
<button mat-button (click)="compareVersions()" [disabled]="versions.length < 2">
|
29 |
+
<mat-icon>compare_arrows</mat-icon>
|
30 |
+
Compare
|
31 |
+
</button>
|
32 |
+
</div>
|
33 |
+
</div>
|
34 |
+
|
35 |
+
<mat-progress-bar *ngIf="loading" mode="indeterminate"></mat-progress-bar>
|
36 |
+
|
37 |
+
<!-- Version Editor -->
|
38 |
+
<div class="version-editor" *ngIf="selectedVersion && !loading">
|
39 |
+
<form [formGroup]="versionForm">
|
40 |
+
<mat-tab-group [(selectedIndex)]="selectedTabIndex" dynamicHeight>
|
41 |
+
<!-- General Tab -->
|
42 |
+
<mat-tab label="General">
|
43 |
+
<div class="tab-content">
|
44 |
+
<div class="metadata-info">
|
45 |
+
<mat-chip-listbox>
|
46 |
+
<mat-chip-option>Version ID: {{ versionForm.get('id')?.value }}</mat-chip-option>
|
47 |
+
<mat-chip-option *ngIf="selectedVersion.published" selected>Published</mat-chip-option>
|
48 |
+
<mat-chip-option *ngIf="!selectedVersion.published">Draft</mat-chip-option>
|
49 |
+
<mat-chip-option *ngIf="selectedVersion.created_date">
|
50 |
+
Created: {{ selectedVersion.created_date | date:'short' }}
|
51 |
+
</mat-chip-option>
|
52 |
+
</mat-chip-listbox>
|
53 |
+
</div>
|
54 |
+
|
55 |
+
<mat-form-field appearance="outline" class="full-width">
|
56 |
+
<mat-label>Caption</mat-label>
|
57 |
+
<input matInput formControlName="caption" placeholder="Version description">
|
58 |
+
</mat-form-field>
|
59 |
+
|
60 |
+
<mat-form-field appearance="outline" class="full-width">
|
61 |
+
<mat-label>General System Prompt</mat-label>
|
62 |
+
<textarea matInput formControlName="general_prompt"
|
63 |
+
rows="10"
|
64 |
+
placeholder="Define the assistant's behavior and capabilities..."></textarea>
|
65 |
+
<mat-hint>This prompt defines the overall behavior of your assistant</mat-hint>
|
66 |
+
</mat-form-field>
|
67 |
+
|
68 |
+
<div class="action-buttons">
|
69 |
+
<button mat-raised-button color="warn"
|
70 |
+
(click)="deleteVersion()"
|
71 |
+
[disabled]="selectedVersion.published"
|
72 |
+
*ngIf="!selectedVersion.published">
|
73 |
+
<mat-icon>delete</mat-icon>
|
74 |
+
Delete Version
|
75 |
+
</button>
|
76 |
+
</div>
|
77 |
+
</div>
|
78 |
+
</mat-tab>
|
79 |
+
|
80 |
+
<!-- LLM Configuration Tab -->
|
81 |
+
<mat-tab label="LLM">
|
82 |
+
<div class="tab-content" formGroupName="llm">
|
83 |
+
<mat-form-field appearance="outline" class="full-width">
|
84 |
+
<mat-label>Model Repository ID</mat-label>
|
85 |
+
<input matInput formControlName="repo_id"
|
86 |
+
placeholder="e.g., ytu-ce-cosmos/Turkish-Llama-8b-Instruct-v0.1">
|
87 |
+
<mat-hint>HuggingFace model repository ID</mat-hint>
|
88 |
+
</mat-form-field>
|
89 |
+
|
90 |
+
<h4>Generation Configuration</h4>
|
91 |
+
<div formGroupName="generation_config" class="generation-config">
|
92 |
+
<mat-form-field appearance="outline">
|
93 |
+
<mat-label>Max New Tokens</mat-label>
|
94 |
+
<input matInput type="number" formControlName="max_new_tokens">
|
95 |
+
<mat-hint>Maximum tokens to generate (1-2048)</mat-hint>
|
96 |
+
</mat-form-field>
|
97 |
+
|
98 |
+
<mat-form-field appearance="outline">
|
99 |
+
<mat-label>Temperature</mat-label>
|
100 |
+
<input matInput type="number" step="0.1" formControlName="temperature">
|
101 |
+
<mat-hint>Controls randomness (0-2)</mat-hint>
|
102 |
+
</mat-form-field>
|
103 |
+
|
104 |
+
<mat-form-field appearance="outline">
|
105 |
+
<mat-label>Top P</mat-label>
|
106 |
+
<input matInput type="number" step="0.1" formControlName="top_p">
|
107 |
+
<mat-hint>Nucleus sampling (0-1)</mat-hint>
|
108 |
+
</mat-form-field>
|
109 |
+
|
110 |
+
<mat-form-field appearance="outline">
|
111 |
+
<mat-label>Repetition Penalty</mat-label>
|
112 |
+
<input matInput type="number" step="0.1" formControlName="repetition_penalty">
|
113 |
+
<mat-hint>Penalty for repetition (1-2)</mat-hint>
|
114 |
+
</mat-form-field>
|
115 |
+
</div>
|
116 |
+
|
117 |
+
<mat-divider></mat-divider>
|
118 |
+
|
119 |
+
<div class="fine-tune-section">
|
120 |
+
<mat-checkbox formControlName="use_fine_tune">
|
121 |
+
Use Fine-Tuned Model
|
122 |
+
</mat-checkbox>
|
123 |
+
|
124 |
+
<mat-form-field appearance="outline" class="full-width"
|
125 |
+
*ngIf="versionForm.get('llm.use_fine_tune')?.value">
|
126 |
+
<mat-label>Fine-Tune ZIP URL</mat-label>
|
127 |
+
<input matInput formControlName="fine_tune_zip"
|
128 |
+
placeholder="https://example.com/lora-adapter.zip">
|
129 |
+
<mat-hint>URL to LoRA adapter ZIP file</mat-hint>
|
130 |
+
</mat-form-field>
|
131 |
+
</div>
|
132 |
+
</div>
|
133 |
+
</mat-tab>
|
134 |
+
|
135 |
+
<!-- Intents Tab -->
|
136 |
+
<mat-tab label="Intents">
|
137 |
+
<div class="tab-content">
|
138 |
+
<div class="intents-header">
|
139 |
+
<h3>Intent Definitions</h3>
|
140 |
+
<button mat-raised-button color="primary" (click)="addIntent()">
|
141 |
+
<mat-icon>add</mat-icon>
|
142 |
+
Add Intent
|
143 |
+
</button>
|
144 |
+
</div>
|
145 |
+
|
146 |
+
<div formArrayName="intents" class="intents-list">
|
147 |
+
<mat-expansion-panel *ngFor="let intent of intents.controls; let i = index"
|
148 |
+
[formGroupName]="i">
|
149 |
+
<mat-expansion-panel-header>
|
150 |
+
<mat-panel-title>
|
151 |
+
{{ intent.get('name')?.value || 'New Intent' }}
|
152 |
+
</mat-panel-title>
|
153 |
+
<mat-panel-description>
|
154 |
+
{{ intent.get('caption')?.value || 'No description' }}
|
155 |
+
<mat-chip-listbox class="intent-chips">
|
156 |
+
<mat-chip-option>{{ getIntentParameters(i).length }} params</mat-chip-option>
|
157 |
+
<mat-chip-option>{{ intent.get('action')?.value || 'No API' }}</mat-chip-option>
|
158 |
+
</mat-chip-listbox>
|
159 |
+
</mat-panel-description>
|
160 |
+
</mat-expansion-panel-header>
|
161 |
+
|
162 |
+
<div class="intent-content">
|
163 |
+
<div class="intent-actions">
|
164 |
+
<button mat-button color="primary" (click)="editIntent(i)">
|
165 |
+
<mat-icon>edit</mat-icon>
|
166 |
+
Edit Details
|
167 |
+
</button>
|
168 |
+
<button mat-button color="warn" (click)="removeIntent(i)">
|
169 |
+
<mat-icon>delete</mat-icon>
|
170 |
+
Delete
|
171 |
+
</button>
|
172 |
+
</div>
|
173 |
+
|
174 |
+
<!-- Quick view of intent details -->
|
175 |
+
<div class="intent-summary">
|
176 |
+
<div class="summary-item">
|
177 |
+
<strong>Detection Prompt:</strong>
|
178 |
+
<p>{{ intent.get('detection_prompt')?.value || 'Not set' }}</p>
|
179 |
+
</div>
|
180 |
+
|
181 |
+
<div class="summary-item" *ngIf="getIntentExamples(i).length > 0">
|
182 |
+
<strong>Examples:</strong>
|
183 |
+
<mat-chip-listbox>
|
184 |
+
<mat-chip-option *ngFor="let example of getIntentExamples(i).controls">
|
185 |
+
{{ example.value }}
|
186 |
+
</mat-chip-option>
|
187 |
+
</mat-chip-listbox>
|
188 |
+
</div>
|
189 |
+
|
190 |
+
<div class="summary-item" *ngIf="getIntentParameters(i).length > 0">
|
191 |
+
<strong>Parameters:</strong>
|
192 |
+
<mat-list>
|
193 |
+
<mat-list-item *ngFor="let param of getIntentParameters(i).controls">
|
194 |
+
<mat-icon matListItemIcon>{{ param.get('required')?.value ? 'check_box' : 'check_box_outline_blank' }}</mat-icon>
|
195 |
+
<div matListItemTitle>{{ param.get('name')?.value }}</div>
|
196 |
+
<div matListItemLine>{{ param.get('type')?.value }} - {{ param.get('caption')?.value }}</div>
|
197 |
+
</mat-list-item>
|
198 |
+
</mat-list>
|
199 |
+
</div>
|
200 |
+
</div>
|
201 |
+
</div>
|
202 |
+
</mat-expansion-panel>
|
203 |
+
</div>
|
204 |
+
|
205 |
+
<div class="empty-state" *ngIf="intents.length === 0">
|
206 |
+
<mat-icon>psychology</mat-icon>
|
207 |
+
<p>No intents defined yet.</p>
|
208 |
+
<button mat-raised-button color="primary" (click)="addIntent()">
|
209 |
+
Add First Intent
|
210 |
+
</button>
|
211 |
+
</div>
|
212 |
+
</div>
|
213 |
+
</mat-tab>
|
214 |
+
|
215 |
+
<!-- Test Tab -->
|
216 |
+
<mat-tab label="Test">
|
217 |
+
<div class="tab-content">
|
218 |
+
<h3>Test Intent Detection</h3>
|
219 |
+
<p>Enter a user message to test which intent would be detected.</p>
|
220 |
+
|
221 |
+
<mat-form-field appearance="outline" class="full-width">
|
222 |
+
<mat-label>User Message</mat-label>
|
223 |
+
<textarea matInput
|
224 |
+
[(ngModel)]="testUserMessage"
|
225 |
+
[ngModelOptions]="{standalone: true}"
|
226 |
+
rows="3"
|
227 |
+
placeholder="e.g., I want to book a flight from Istanbul to Ankara"></textarea>
|
228 |
+
</mat-form-field>
|
229 |
+
|
230 |
+
<button mat-raised-button color="accent"
|
231 |
+
(click)="testIntentDetection()"
|
232 |
+
[disabled]="testing || !testUserMessage">
|
233 |
+
<mat-icon>play_arrow</mat-icon>
|
234 |
+
{{ testing ? 'Testing...' : 'Test Intent Detection' }}
|
235 |
+
</button>
|
236 |
+
|
237 |
+
<div class="test-result" *ngIf="testResult">
|
238 |
+
<h4>Test Result:</h4>
|
239 |
+
|
240 |
+
<div class="result-card" [class.success]="testResult.intent" [class.no-match]="!testResult.intent">
|
241 |
+
<div class="result-header">
|
242 |
+
<mat-icon>{{ testResult.intent ? 'check_circle' : 'info' }}</mat-icon>
|
243 |
+
<span *ngIf="testResult.intent">Intent Detected: <strong>{{ testResult.intent }}</strong></span>
|
244 |
+
<span *ngIf="!testResult.intent">No intent matched</span>
|
245 |
+
</div>
|
246 |
+
|
247 |
+
<div class="result-details" *ngIf="testResult.intent">
|
248 |
+
<div class="confidence">
|
249 |
+
Confidence: {{ (testResult.confidence * 100).toFixed(0) }}%
|
250 |
+
<mat-progress-bar [value]="testResult.confidence * 100"></mat-progress-bar>
|
251 |
+
</div>
|
252 |
+
|
253 |
+
<div class="parameters" *ngIf="testResult.parameters.length > 0">
|
254 |
+
<h5>Parameters that would be extracted:</h5>
|
255 |
+
<mat-list>
|
256 |
+
<mat-list-item *ngFor="let param of testResult.parameters">
|
257 |
+
<mat-icon matListItemIcon [color]="param.extracted ? 'primary' : ''">
|
258 |
+
{{ param.extracted ? 'check_circle' : 'radio_button_unchecked' }}
|
259 |
+
</mat-icon>
|
260 |
+
<div matListItemTitle>{{ param.name }}</div>
|
261 |
+
<div matListItemLine>
|
262 |
+
{{ param.extracted ? 'Value: ' + param.value : 'Missing - would ask user' }}
|
263 |
+
</div>
|
264 |
+
</mat-list-item>
|
265 |
+
</mat-list>
|
266 |
+
</div>
|
267 |
+
</div>
|
268 |
+
</div>
|
269 |
+
</div>
|
270 |
+
</div>
|
271 |
+
</tab>
|
272 |
+
</mat-tab-group>
|
273 |
+
</form>
|
274 |
+
</div>
|
275 |
+
|
276 |
+
<!-- No Version Selected -->
|
277 |
+
<div class="empty-state" *ngIf="!selectedVersion && !loading">
|
278 |
+
<mat-icon>layers</mat-icon>
|
279 |
+
<p>No version selected. Create a new version to get started.</p>
|
280 |
+
<button mat-raised-button color="primary" (click)="createVersion()">
|
281 |
+
Create First Version
|
282 |
+
</button>
|
283 |
+
</div>
|
284 |
+
</div>
|
285 |
+
</mat-dialog-content>
|
286 |
+
|
287 |
+
<mat-dialog-actions align="end">
|
288 |
+
<button mat-button (click)="close()">Close</button>
|
289 |
+
<button mat-raised-button
|
290 |
+
color="primary"
|
291 |
+
(click)="saveVersion()"
|
292 |
+
[disabled]="!selectedVersion || selectedVersion.published || versionForm.invalid || saving">
|
293 |
+
{{ saving ? 'Saving...' : 'Save Changes' }}
|
294 |
+
</button>
|
295 |
+
<button mat-raised-button
|
296 |
+
color="accent"
|
297 |
+
(click)="publishVersion()"
|
298 |
+
[disabled]="!selectedVersion || selectedVersion.published || publishing">
|
299 |
+
{{ publishing ? 'Publishing...' : 'Publish Version' }}
|
300 |
+
</button>
|
301 |
+
</mat-dialog-actions>
|