ciyidogan commited on
Commit
23e3af0
·
verified ·
1 Parent(s): 1e38a52

Update flare-ui/src/app/dialogs/intent-edit-dialog/intent-edit-dialog.component.ts

Browse files
flare-ui/src/app/dialogs/intent-edit-dialog/intent-edit-dialog.component.ts CHANGED
@@ -128,7 +128,12 @@ export default class IntentEditDialogComponent implements OnInit {
128
  }
129
 
130
  get parameters() {
131
- return this.form.get('parameters') as FormArray;
 
 
 
 
 
132
  }
133
 
134
  addExample() {
@@ -194,16 +199,22 @@ export default class IntentEditDialogComponent implements OnInit {
194
  this.snackBar.open('Please fix all validation errors', 'Close', { duration: 3000 });
195
  return;
196
  }
197
-
198
  const formValue = this.form.value;
199
 
200
- // Examples array'ini düzgün formatta döndür
201
  const result = {
202
- ...formValue,
203
- examples: formValue.examples || [],
204
- parameters: formValue.parameters || []
 
 
 
 
 
 
205
  };
206
-
207
  this.dialogRef.close(result);
208
  }
209
 
 
128
  }
129
 
130
  get parameters() {
131
+ const paramsArray = this.form.get('parameters') as FormArray;
132
+ if (!paramsArray) {
133
+ // Form henüz hazır değilse boş array döndür
134
+ return this.fb.array([]);
135
+ }
136
+ return paramsArray;
137
  }
138
 
139
  addExample() {
 
199
  this.snackBar.open('Please fix all validation errors', 'Close', { duration: 3000 });
200
  return;
201
  }
202
+
203
  const formValue = this.form.value;
204
 
205
+ // Form değerlerini güvenli bir şekilde al
206
  const result = {
207
+ name: formValue.name || '',
208
+ caption: formValue.caption || '',
209
+ locale: formValue.locale || 'tr-TR',
210
+ detection_prompt: formValue.detection_prompt || '',
211
+ action: formValue.action || '',
212
+ fallback_timeout_prompt: formValue.fallback_timeout_prompt || '',
213
+ fallback_error_prompt: formValue.fallback_error_prompt || '',
214
+ examples: Array.isArray(formValue.examples) ? formValue.examples : [],
215
+ parameters: Array.isArray(formValue.parameters) ? formValue.parameters : []
216
  };
217
+
218
  this.dialogRef.close(result);
219
  }
220