ciyidogan commited on
Commit
06b847d
·
verified ·
1 Parent(s): 39c0997

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

Browse files
flare-ui/src/app/dialogs/version-edit-dialog/version-edit-dialog.component.ts CHANGED
@@ -323,30 +323,30 @@ export default class VersionEditDialogComponent implements OnInit {
323
  });
324
  }
325
 
326
- async saveVersion() {
327
  if (this.versionForm.invalid || !this.selectedVersion) {
328
  this.snackBar.open('Please fix all validation errors', 'Close', { duration: 3000 });
329
  return;
330
  }
331
 
332
  this.saving = true;
333
- try {
334
- const formValue = this.versionForm.getRawValue();
335
-
336
- // Prepare intents data
337
- const intents = formValue.intents.map((intent: any) => ({
338
- ...intent,
339
- examples: intent.examples || []
340
- }));
341
-
342
- const updateData = {
343
- caption: formValue.caption,
344
- general_prompt: formValue.general_prompt,
345
- llm: formValue.llm,
346
- intents: intents,
347
- last_update_date: formValue.last_update_date
348
- };
349
 
 
350
  await this.apiService.updateVersion(
351
  this.project.id,
352
  this.selectedVersion.id,
@@ -386,14 +386,15 @@ async saveVersion() {
386
  }
387
  } else {
388
  // Force save by removing last_update_date check
389
- const forceUpdateData = { ...updateData };
390
  delete forceUpdateData.last_update_date;
391
 
392
  try {
393
  await this.apiService.updateVersion(
394
  this.project.id,
395
  this.selectedVersion!.id,
396
- forceUpdateData
 
397
  ).toPromise();
398
 
399
  this.snackBar.open('Version saved (forced)', 'Close', { duration: 3000 });
 
323
  });
324
  }
325
 
326
+ async saveVersion() {
327
  if (this.versionForm.invalid || !this.selectedVersion) {
328
  this.snackBar.open('Please fix all validation errors', 'Close', { duration: 3000 });
329
  return;
330
  }
331
 
332
  this.saving = true;
333
+
334
+ // updateData'yı try bloğunun dışında tanımla
335
+ const formValue = this.versionForm.getRawValue();
336
+ const intents = formValue.intents.map((intent: any) => ({
337
+ ...intent,
338
+ examples: intent.examples || []
339
+ }));
340
+
341
+ const updateData = {
342
+ caption: formValue.caption,
343
+ general_prompt: formValue.general_prompt,
344
+ llm: formValue.llm,
345
+ intents: intents,
346
+ last_update_date: formValue.last_update_date
347
+ };
 
348
 
349
+ try {
350
  await this.apiService.updateVersion(
351
  this.project.id,
352
  this.selectedVersion.id,
 
386
  }
387
  } else {
388
  // Force save by removing last_update_date check
389
+ const forceUpdateData = { ...updateData }; // updateData artık erişilebilir
390
  delete forceUpdateData.last_update_date;
391
 
392
  try {
393
  await this.apiService.updateVersion(
394
  this.project.id,
395
  this.selectedVersion!.id,
396
+ forceUpdateData,
397
+ true // force parameter
398
  ).toPromise();
399
 
400
  this.snackBar.open('Version saved (forced)', 'Close', { duration: 3000 });