ciyidogan commited on
Commit
e8ac39e
·
verified ·
1 Parent(s): bca1df7

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 [(ngModel)]="newExample"
83
- [ngModelOptions]="{standalone: true}"
84
- (keyup.enter)="addExample()"
85
- placeholder="e.g., I want to book a flight">
86
- </mat-form-field>
87
- <button mat-raised-button color="primary" (click)="addExample()">
88
- <mat-icon>add</mat-icon>
89
- Add
90
- </button>
91
- </div>
92
-
93
- <mat-list class="examples-list" *ngIf="examples.length > 0">
94
- <mat-list-item *ngFor="let example of examples.controls; let i = index">
95
- <mat-icon matListItemIcon>format_quote</mat-icon>
96
- <div matListItemTitle>{{ example.value }}</div>
97
- <button mat-icon-button matListItemMeta (click)="removeExample(i)">
98
- <mat-icon>delete</mat-icon>
99
- </button>
100
- </mat-list-item>
101
- </mat-list>
102
-
103
- <div class="empty-state" *ngIf="examples.length === 0">
104
- <p>No examples added yet. Examples help improve intent detection accuracy.</p>
105
- </div>
106
- </div>
107
- </div>
108
- </mat-tab>
109
-
110
- <!-- Parameters Tab -->
111
- <mat-tab label="Parameters">
112
- <div class="tab-content">
113
- <div class="parameters-header">
114
- <h4>Intent Parameters</h4>
115
- <button mat-raised-button color="primary" (click)="addParameter()">
116
- <mat-icon>add</mat-icon>
117
- Add Parameter
118
- </button>
119
- </div>
120
-
121
- <div formArrayName="parameters" class="parameters-list">
122
- <mat-expansion-panel *ngFor="let param of parameters.controls; let i = index"
123
- [formGroupName]="i">
124
- <mat-expansion-panel-header>
125
- <mat-panel-title>
126
- {{ param.get('name')?.value || 'New Parameter' }}
127
- </mat-panel-title>
128
- <mat-panel-description>
129
- <mat-chip-listbox>
130
- <mat-chip-option>{{ param.get('type')?.value }}</mat-chip-option>
131
- <mat-chip-option *ngIf="param.get('required')?.value" selected>Required</mat-chip-option>
132
- <mat-chip-option *ngIf="!param.get('required')?.value">Optional</mat-chip-option>
133
- </mat-chip-listbox>
134
- </mat-panel-description>
135
- </mat-expansion-panel-header>
136
-
137
- <div class="parameter-content">
138
- <div class="parameter-grid">
139
- <mat-form-field appearance="outline">
140
- <mat-label>Parameter Name*</mat-label>
141
- <input matInput formControlName="name"
142
- placeholder="e.g., origin_city">
143
- <mat-hint>Use snake_case</mat-hint>
144
- </mat-form-field>
145
-
146
- <mat-form-field appearance="outline">
147
- <mat-label>Display Name</mat-label>
148
- <input matInput formControlName="caption"
149
- placeholder="e.g., Origin City">
150
- </mat-form-field>
151
-
152
- <mat-form-field appearance="outline">
153
- <mat-label>Type*</mat-label>
154
- <mat-select formControlName="type">
155
- <mat-option *ngFor="let type of parameterTypes" [value]="type">
156
- {{ type }}
157
- </mat-option>
158
- </mat-select>
159
- </mat-form-field>
160
-
161
- <mat-form-field appearance="outline">
162
- <mat-label>Variable Name*</mat-label>
163
- <input matInput formControlName="variable_name"
164
- placeholder="e.g., origin">
165
- <mat-hint>Session variable name</mat-hint>
166
- </mat-form-field>
167
- </div>
168
-
169
- <mat-checkbox formControlName="required">Required Parameter</mat-checkbox>
170
-
171
- <mat-form-field appearance="outline" class="full-width">
172
- <mat-label>Extraction Prompt</mat-label>
173
- <textarea matInput formControlName="extraction_prompt"
174
- rows="3"
175
- placeholder="Instructions for extracting this parameter..."></textarea>
176
- </mat-form-field>
177
-
178
- <mat-form-field appearance="outline" class="full-width">
179
- <mat-label>Validation Regex</mat-label>
180
- <input matInput formControlName="validation_regex"
181
- placeholder="e.g., ^[A-Z]{3}$">
182
- <button mat-icon-button matSuffix (click)="testRegex(i)" type="button">
183
- <mat-icon>bug_report</mat-icon>
184
- </button>
185
- <mat-hint>Optional regex pattern for validation</mat-hint>
186
- </mat-form-field>
187
-
188
- <mat-form-field appearance="outline" class="full-width">
189
- <mat-label>Invalid Value Message</mat-label>
190
- <input matInput formControlName="invalid_prompt"
191
- placeholder="Message when value doesn't match regex...">
192
- </mat-form-field>
193
-
194
- <mat-form-field appearance="outline" class="full-width">
195
- <mat-label>Type Error Message</mat-label>
196
- <input matInput formControlName="type_error_prompt"
197
- placeholder="Message when value has wrong type...">
198
- </mat-form-field>
199
-
200
- <div class="parameter-actions">
201
- <button mat-button color="warn" (click)="removeParameter(i)">
202
- <mat-icon>delete</mat-icon>
203
- Remove
204
- </button>
205
- <div class="spacer"></div>
206
- <button mat-icon-button (click)="moveParameter(i, 'up')"
207
- [disabled]="i === 0">
208
- <mat-icon>arrow_upward</mat-icon>
209
- </button>
210
- <button mat-icon-button (click)="moveParameter(i, 'down')"
211
- [disabled]="i === parameters.length - 1">
212
- <mat-icon>arrow_downward</mat-icon>
213
- </button>
214
- </div>
215
- </div>
216
- </mat-expansion-panel>
217
- </div>
218
-
219
- <div class="empty-state" *ngIf="parameters.length === 0">
220
- <mat-icon>input</mat-icon>
221
- <p>No parameters defined. Add parameters that need to be extracted from user input.</p>
222
- </div>
223
- </div>
224
- </mat-tab>
225
- </mat-tab-group>
226
- </form>
227
- </mat-dialog-content>
228
-
229
- <mat-dialog-actions align="end">
230
- <button mat-button (click)="cancel()">Cancel</button>
231
- <button mat-raised-button color="primary"
232
- (click)="save()"
233
- [disabled]="form.invalid">
234
- Save
235
- </button>
 
 
 
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>