Spaces:
Paused
Paused
Update flare-ui/src/app/dialogs/intent-edit-dialog/intent-edit-dialog.component.html
Browse files
flare-ui/src/app/dialogs/intent-edit-dialog/intent-edit-dialog.component.html
CHANGED
|
@@ -1,236 +1,239 @@
|
|
| 1 |
-
<h2 mat-dialog-title>
|
| 2 |
-
{{ data.intent ? 'Edit Intent' : 'Create Intent' }}
|
| 3 |
-
</h2>
|
| 4 |
-
|
| 5 |
-
<mat-dialog-content>
|
| 6 |
-
<form [formGroup]="form">
|
| 7 |
-
<mat-tab-group>
|
| 8 |
-
<!-- General Tab -->
|
| 9 |
-
<mat-tab label="General">
|
| 10 |
-
<div class="tab-content">
|
| 11 |
-
<mat-form-field appearance="outline" class="full-width">
|
| 12 |
-
<mat-label>Intent Name*</mat-label>
|
| 13 |
-
<input matInput formControlName="name"
|
| 14 |
-
placeholder="e.g., flight-booking">
|
| 15 |
-
<mat-hint>Use lowercase with hyphens, no spaces</mat-hint>
|
| 16 |
-
<mat-error *ngIf="form.get('name')?.hasError('required')">Name is required</mat-error>
|
| 17 |
-
<mat-error *ngIf="form.get('name')?.hasError('pattern')">Invalid format</mat-error>
|
| 18 |
-
</mat-form-field>
|
| 19 |
-
|
| 20 |
-
<mat-form-field appearance="outline" class="full-width">
|
| 21 |
-
<mat-label>Caption</mat-label>
|
| 22 |
-
<input matInput formControlName="caption"
|
| 23 |
-
placeholder="e.g., Flight Booking Intent">
|
| 24 |
-
</mat-form-field>
|
| 25 |
-
|
| 26 |
-
<mat-form-field appearance="outline">
|
| 27 |
-
<mat-label>Locale</mat-label>
|
| 28 |
-
<mat-select formControlName="locale">
|
| 29 |
-
<mat-option value="tr-TR">Turkish (tr-TR)</mat-option>
|
| 30 |
-
<mat-option value="en-US">English (en-US)</mat-option>
|
| 31 |
-
</mat-select>
|
| 32 |
-
</mat-form-field>
|
| 33 |
-
|
| 34 |
-
<mat-form-field appearance="outline" class="full-width">
|
| 35 |
-
<mat-label>Detection Prompt*</mat-label>
|
| 36 |
-
<textarea matInput formControlName="detection_prompt"
|
| 37 |
-
rows="4"
|
| 38 |
-
placeholder="Describe when this intent should be detected..."></textarea>
|
| 39 |
-
<mat-hint>Explain to the LLM when to detect this intent</mat-hint>
|
| 40 |
-
</mat-form-field>
|
| 41 |
-
|
| 42 |
-
<mat-form-field appearance="outline" class="full-width">
|
| 43 |
-
<mat-label>API Action*</mat-label>
|
| 44 |
-
<mat-select formControlName="action">
|
| 45 |
-
<mat-option *ngFor="let api of availableAPIs" [value]="api.name">
|
| 46 |
-
{{ api.name }} - {{ api.method }} {{ api.url }}
|
| 47 |
-
</mat-option>
|
| 48 |
-
</mat-select>
|
| 49 |
-
<mat-hint>Select the API to call when this intent is triggered</mat-hint>
|
| 50 |
-
</mat-form-field>
|
| 51 |
-
|
| 52 |
-
<mat-divider></mat-divider>
|
| 53 |
-
|
| 54 |
-
<h4>Fallback Messages</h4>
|
| 55 |
-
|
| 56 |
-
<mat-form-field appearance="outline" class="full-width">
|
| 57 |
-
<mat-label>Timeout Message</mat-label>
|
| 58 |
-
<textarea matInput formControlName="fallback_timeout_prompt"
|
| 59 |
-
rows="2"
|
| 60 |
-
placeholder="Message when API times out..."></textarea>
|
| 61 |
-
</mat-form-field>
|
| 62 |
-
|
| 63 |
-
<mat-form-field appearance="outline" class="full-width">
|
| 64 |
-
<mat-label>Error Message</mat-label>
|
| 65 |
-
<textarea matInput formControlName="fallback_error_prompt"
|
| 66 |
-
rows="2"
|
| 67 |
-
placeholder="Message when API returns error..."></textarea>
|
| 68 |
-
</mat-form-field>
|
| 69 |
-
</div>
|
| 70 |
-
</mat-tab>
|
| 71 |
-
|
| 72 |
-
<!-- Examples Tab -->
|
| 73 |
-
<mat-tab label="Examples">
|
| 74 |
-
<div class="tab-content">
|
| 75 |
-
<div class="examples-section">
|
| 76 |
-
<h4>Example Sentences</h4>
|
| 77 |
-
<p>Add example sentences that should trigger this intent</p>
|
| 78 |
-
|
| 79 |
-
<div class="add-example">
|
| 80 |
-
<mat-form-field appearance="outline" class="example-input">
|
| 81 |
-
<mat-label>New Example</mat-label>
|
| 82 |
-
<input matInput
|
| 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 |
-
<mat-panel-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
<mat-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
<mat-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
<
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
<mat-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
</mat-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
|
|
|
|
|
|
|
|
|
| 236 |
</mat-dialog-actions>
|
|
|
|
| 1 |
+
<h2 mat-dialog-title>
|
| 2 |
+
{{ data.intent ? 'Edit Intent' : 'Create Intent' }}
|
| 3 |
+
</h2>
|
| 4 |
+
|
| 5 |
+
<mat-dialog-content>
|
| 6 |
+
<form [formGroup]="form">
|
| 7 |
+
<mat-tab-group>
|
| 8 |
+
<!-- General Tab -->
|
| 9 |
+
<mat-tab label="General">
|
| 10 |
+
<div class="tab-content">
|
| 11 |
+
<mat-form-field appearance="outline" class="full-width">
|
| 12 |
+
<mat-label>Intent Name*</mat-label>
|
| 13 |
+
<input matInput formControlName="name"
|
| 14 |
+
placeholder="e.g., flight-booking">
|
| 15 |
+
<mat-hint>Use lowercase with hyphens, no spaces</mat-hint>
|
| 16 |
+
<mat-error *ngIf="form.get('name')?.hasError('required')">Name is required</mat-error>
|
| 17 |
+
<mat-error *ngIf="form.get('name')?.hasError('pattern')">Invalid format</mat-error>
|
| 18 |
+
</mat-form-field>
|
| 19 |
+
|
| 20 |
+
<mat-form-field appearance="outline" class="full-width">
|
| 21 |
+
<mat-label>Caption</mat-label>
|
| 22 |
+
<input matInput formControlName="caption"
|
| 23 |
+
placeholder="e.g., Flight Booking Intent">
|
| 24 |
+
</mat-form-field>
|
| 25 |
+
|
| 26 |
+
<mat-form-field appearance="outline">
|
| 27 |
+
<mat-label>Locale</mat-label>
|
| 28 |
+
<mat-select formControlName="locale">
|
| 29 |
+
<mat-option value="tr-TR">Turkish (tr-TR)</mat-option>
|
| 30 |
+
<mat-option value="en-US">English (en-US)</mat-option>
|
| 31 |
+
</mat-select>
|
| 32 |
+
</mat-form-field>
|
| 33 |
+
|
| 34 |
+
<mat-form-field appearance="outline" class="full-width">
|
| 35 |
+
<mat-label>Detection Prompt*</mat-label>
|
| 36 |
+
<textarea matInput formControlName="detection_prompt"
|
| 37 |
+
rows="4"
|
| 38 |
+
placeholder="Describe when this intent should be detected..."></textarea>
|
| 39 |
+
<mat-hint>Explain to the LLM when to detect this intent</mat-hint>
|
| 40 |
+
</mat-form-field>
|
| 41 |
+
|
| 42 |
+
<mat-form-field appearance="outline" class="full-width">
|
| 43 |
+
<mat-label>API Action*</mat-label>
|
| 44 |
+
<mat-select formControlName="action">
|
| 45 |
+
<mat-option *ngFor="let api of availableAPIs" [value]="api.name">
|
| 46 |
+
{{ api.name }} - {{ api.method }} {{ api.url }}
|
| 47 |
+
</mat-option>
|
| 48 |
+
</mat-select>
|
| 49 |
+
<mat-hint>Select the API to call when this intent is triggered</mat-hint>
|
| 50 |
+
</mat-form-field>
|
| 51 |
+
|
| 52 |
+
<mat-divider></mat-divider>
|
| 53 |
+
|
| 54 |
+
<h4>Fallback Messages</h4>
|
| 55 |
+
|
| 56 |
+
<mat-form-field appearance="outline" class="full-width">
|
| 57 |
+
<mat-label>Timeout Message</mat-label>
|
| 58 |
+
<textarea matInput formControlName="fallback_timeout_prompt"
|
| 59 |
+
rows="2"
|
| 60 |
+
placeholder="Message when API times out..."></textarea>
|
| 61 |
+
</mat-form-field>
|
| 62 |
+
|
| 63 |
+
<mat-form-field appearance="outline" class="full-width">
|
| 64 |
+
<mat-label>Error Message</mat-label>
|
| 65 |
+
<textarea matInput formControlName="fallback_error_prompt"
|
| 66 |
+
rows="2"
|
| 67 |
+
placeholder="Message when API returns error..."></textarea>
|
| 68 |
+
</mat-form-field>
|
| 69 |
+
</div>
|
| 70 |
+
</mat-tab>
|
| 71 |
+
|
| 72 |
+
<!-- Examples Tab -->
|
| 73 |
+
<mat-tab label="Examples">
|
| 74 |
+
<div class="tab-content">
|
| 75 |
+
<div class="examples-section">
|
| 76 |
+
<h4>Example Sentences</h4>
|
| 77 |
+
<p>Add example sentences that should trigger this intent</p>
|
| 78 |
+
|
| 79 |
+
<div class="add-example">
|
| 80 |
+
<mat-form-field appearance="outline" class="example-input">
|
| 81 |
+
<mat-label>New Example</mat-label>
|
| 82 |
+
<input matInput
|
| 83 |
+
[(ngModel)]="newExample"
|
| 84 |
+
[ngModelOptions]="{standalone: true}"
|
| 85 |
+
(keyup.enter)="addExample()"
|
| 86 |
+
placeholder="e.g., I want to book a flight">
|
| 87 |
+
</mat-form-field>
|
| 88 |
+
<button mat-raised-button color="primary"
|
| 89 |
+
(click)="addExample()"
|
| 90 |
+
[disabled]="!newExample || !newExample.trim()">
|
| 91 |
+
<mat-icon>add</mat-icon>
|
| 92 |
+
Add
|
| 93 |
+
</button>
|
| 94 |
+
</div>
|
| 95 |
+
|
| 96 |
+
<mat-list class="examples-list" *ngIf="examples.length > 0">
|
| 97 |
+
<mat-list-item *ngFor="let example of examples.controls; let i = index">
|
| 98 |
+
<mat-icon matListItemIcon>format_quote</mat-icon>
|
| 99 |
+
<div matListItemTitle>{{ example.value }}</div>
|
| 100 |
+
<button mat-icon-button matListItemMeta (click)="removeExample(i)">
|
| 101 |
+
<mat-icon>delete</mat-icon>
|
| 102 |
+
</button>
|
| 103 |
+
</mat-list-item>
|
| 104 |
+
</mat-list>
|
| 105 |
+
|
| 106 |
+
<div class="empty-state" *ngIf="examples.length === 0">
|
| 107 |
+
<p>No examples added yet. Examples help improve intent detection accuracy.</p>
|
| 108 |
+
</div>
|
| 109 |
+
</div>
|
| 110 |
+
</div>
|
| 111 |
+
</mat-tab>
|
| 112 |
+
|
| 113 |
+
<!-- Parameters Tab -->
|
| 114 |
+
<mat-tab label="Parameters">
|
| 115 |
+
<div class="tab-content">
|
| 116 |
+
<div class="parameters-header">
|
| 117 |
+
<h4>Intent Parameters</h4>
|
| 118 |
+
<button mat-raised-button color="primary" (click)="addParameter()">
|
| 119 |
+
<mat-icon>add</mat-icon>
|
| 120 |
+
Add Parameter
|
| 121 |
+
</button>
|
| 122 |
+
</div>
|
| 123 |
+
|
| 124 |
+
<div formArrayName="parameters" class="parameters-list">
|
| 125 |
+
<mat-expansion-panel *ngFor="let param of parameters.controls; let i = index"
|
| 126 |
+
[formGroupName]="i">
|
| 127 |
+
<mat-expansion-panel-header>
|
| 128 |
+
<mat-panel-title>
|
| 129 |
+
{{ param.get('name')?.value || 'New Parameter' }}
|
| 130 |
+
</mat-panel-title>
|
| 131 |
+
<mat-panel-description>
|
| 132 |
+
<mat-chip-listbox>
|
| 133 |
+
<mat-chip-option>{{ param.get('type')?.value }}</mat-chip-option>
|
| 134 |
+
<mat-chip-option *ngIf="param.get('required')?.value" selected>Required</mat-chip-option>
|
| 135 |
+
<mat-chip-option *ngIf="!param.get('required')?.value">Optional</mat-chip-option>
|
| 136 |
+
</mat-chip-listbox>
|
| 137 |
+
</mat-panel-description>
|
| 138 |
+
</mat-expansion-panel-header>
|
| 139 |
+
|
| 140 |
+
<div class="parameter-content">
|
| 141 |
+
<div class="parameter-grid">
|
| 142 |
+
<mat-form-field appearance="outline">
|
| 143 |
+
<mat-label>Parameter Name*</mat-label>
|
| 144 |
+
<input matInput formControlName="name"
|
| 145 |
+
placeholder="e.g., origin_city">
|
| 146 |
+
<mat-hint>Use snake_case</mat-hint>
|
| 147 |
+
</mat-form-field>
|
| 148 |
+
|
| 149 |
+
<mat-form-field appearance="outline">
|
| 150 |
+
<mat-label>Display Name</mat-label>
|
| 151 |
+
<input matInput formControlName="caption"
|
| 152 |
+
placeholder="e.g., Origin City">
|
| 153 |
+
</mat-form-field>
|
| 154 |
+
|
| 155 |
+
<mat-form-field appearance="outline">
|
| 156 |
+
<mat-label>Type*</mat-label>
|
| 157 |
+
<mat-select formControlName="type">
|
| 158 |
+
<mat-option *ngFor="let type of parameterTypes" [value]="type">
|
| 159 |
+
{{ type }}
|
| 160 |
+
</mat-option>
|
| 161 |
+
</mat-select>
|
| 162 |
+
</mat-form-field>
|
| 163 |
+
|
| 164 |
+
<mat-form-field appearance="outline">
|
| 165 |
+
<mat-label>Variable Name*</mat-label>
|
| 166 |
+
<input matInput formControlName="variable_name"
|
| 167 |
+
placeholder="e.g., origin">
|
| 168 |
+
<mat-hint>Session variable name</mat-hint>
|
| 169 |
+
</mat-form-field>
|
| 170 |
+
</div>
|
| 171 |
+
|
| 172 |
+
<mat-checkbox formControlName="required">Required Parameter</mat-checkbox>
|
| 173 |
+
|
| 174 |
+
<mat-form-field appearance="outline" class="full-width">
|
| 175 |
+
<mat-label>Extraction Prompt</mat-label>
|
| 176 |
+
<textarea matInput formControlName="extraction_prompt"
|
| 177 |
+
rows="3"
|
| 178 |
+
placeholder="Instructions for extracting this parameter..."></textarea>
|
| 179 |
+
</mat-form-field>
|
| 180 |
+
|
| 181 |
+
<mat-form-field appearance="outline" class="full-width">
|
| 182 |
+
<mat-label>Validation Regex</mat-label>
|
| 183 |
+
<input matInput formControlName="validation_regex"
|
| 184 |
+
placeholder="e.g., ^[A-Z]{3}$">
|
| 185 |
+
<button mat-icon-button matSuffix (click)="testRegex(i)" type="button">
|
| 186 |
+
<mat-icon>bug_report</mat-icon>
|
| 187 |
+
</button>
|
| 188 |
+
<mat-hint>Optional regex pattern for validation</mat-hint>
|
| 189 |
+
</mat-form-field>
|
| 190 |
+
|
| 191 |
+
<mat-form-field appearance="outline" class="full-width">
|
| 192 |
+
<mat-label>Invalid Value Message</mat-label>
|
| 193 |
+
<input matInput formControlName="invalid_prompt"
|
| 194 |
+
placeholder="Message when value doesn't match regex...">
|
| 195 |
+
</mat-form-field>
|
| 196 |
+
|
| 197 |
+
<mat-form-field appearance="outline" class="full-width">
|
| 198 |
+
<mat-label>Type Error Message</mat-label>
|
| 199 |
+
<input matInput formControlName="type_error_prompt"
|
| 200 |
+
placeholder="Message when value has wrong type...">
|
| 201 |
+
</mat-form-field>
|
| 202 |
+
|
| 203 |
+
<div class="parameter-actions">
|
| 204 |
+
<button mat-button color="warn" (click)="removeParameter(i)">
|
| 205 |
+
<mat-icon>delete</mat-icon>
|
| 206 |
+
Remove
|
| 207 |
+
</button>
|
| 208 |
+
<div class="spacer"></div>
|
| 209 |
+
<button mat-icon-button (click)="moveParameter(i, 'up')"
|
| 210 |
+
[disabled]="i === 0">
|
| 211 |
+
<mat-icon>arrow_upward</mat-icon>
|
| 212 |
+
</button>
|
| 213 |
+
<button mat-icon-button (click)="moveParameter(i, 'down')"
|
| 214 |
+
[disabled]="i === parameters.length - 1">
|
| 215 |
+
<mat-icon>arrow_downward</mat-icon>
|
| 216 |
+
</button>
|
| 217 |
+
</div>
|
| 218 |
+
</div>
|
| 219 |
+
</mat-expansion-panel>
|
| 220 |
+
</div>
|
| 221 |
+
|
| 222 |
+
<div class="empty-state" *ngIf="parameters.length === 0">
|
| 223 |
+
<mat-icon>input</mat-icon>
|
| 224 |
+
<p>No parameters defined. Add parameters that need to be extracted from user input.</p>
|
| 225 |
+
</div>
|
| 226 |
+
</div>
|
| 227 |
+
</mat-tab>
|
| 228 |
+
</mat-tab-group>
|
| 229 |
+
</form>
|
| 230 |
+
</mat-dialog-content>
|
| 231 |
+
|
| 232 |
+
<mat-dialog-actions align="end">
|
| 233 |
+
<button mat-button (click)="cancel()">Cancel</button>
|
| 234 |
+
<button mat-raised-button color="primary"
|
| 235 |
+
(click)="save()"
|
| 236 |
+
[disabled]="form.invalid">
|
| 237 |
+
Save
|
| 238 |
+
</button>
|
| 239 |
</mat-dialog-actions>
|