Spaces:
Building
Building
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
@@ -418,6 +418,7 @@ export default class VersionEditDialogComponent implements OnInit {
|
|
418 |
}
|
419 |
}
|
420 |
|
|
|
421 |
async saveVersion() {
|
422 |
if (this.versionForm.invalid || !this.selectedVersion) {
|
423 |
const invalidFields: string[] = [];
|
@@ -440,6 +441,9 @@ export default class VersionEditDialogComponent implements OnInit {
|
|
440 |
return;
|
441 |
}
|
442 |
|
|
|
|
|
|
|
443 |
this.saving = true;
|
444 |
|
445 |
try {
|
@@ -476,23 +480,23 @@ export default class VersionEditDialogComponent implements OnInit {
|
|
476 |
fallback_error_prompt: intent.fallback_error_prompt
|
477 |
}));
|
478 |
|
479 |
-
// updateData'yı burada tanımla
|
480 |
const updateData = {
|
481 |
caption: formValue.caption,
|
482 |
description: formValue.caption,
|
483 |
-
default_api:
|
484 |
-
published:
|
485 |
llm: llmConfig,
|
486 |
intents: intents,
|
487 |
parameters: [],
|
488 |
-
last_update_date:
|
489 |
};
|
490 |
|
491 |
console.log('Saving version data:', JSON.stringify(updateData, null, 2));
|
492 |
|
493 |
const result = await this.apiService.updateVersion(
|
494 |
this.project.id,
|
495 |
-
|
496 |
updateData
|
497 |
).toPromise();
|
498 |
|
@@ -513,7 +517,7 @@ export default class VersionEditDialogComponent implements OnInit {
|
|
513 |
console.error('Save error:', error);
|
514 |
|
515 |
if (error.status === 409) {
|
516 |
-
// updateData'ya burada da ihtiyacımız var
|
517 |
const formValue = this.versionForm.getRawValue();
|
518 |
const llmConfig = {
|
519 |
repo_id: formValue.llm.repo_id,
|
@@ -537,12 +541,12 @@ export default class VersionEditDialogComponent implements OnInit {
|
|
537 |
const retryUpdateData = {
|
538 |
caption: formValue.caption,
|
539 |
description: formValue.caption,
|
540 |
-
default_api:
|
541 |
-
published:
|
542 |
llm: llmConfig,
|
543 |
intents: intents,
|
544 |
parameters: [],
|
545 |
-
last_update_date:
|
546 |
};
|
547 |
|
548 |
const { default: ConfirmDialogComponent } = await import('../confirm-dialog/confirm-dialog.component');
|
@@ -564,7 +568,7 @@ export default class VersionEditDialogComponent implements OnInit {
|
|
564 |
try {
|
565 |
await this.apiService.updateVersion(
|
566 |
this.project.id,
|
567 |
-
|
568 |
retryUpdateData,
|
569 |
true // force flag
|
570 |
).toPromise();
|
|
|
418 |
}
|
419 |
}
|
420 |
|
421 |
+
// saveVersion metodunu düzelt (line 478-600 civarı):
|
422 |
async saveVersion() {
|
423 |
if (this.versionForm.invalid || !this.selectedVersion) {
|
424 |
const invalidFields: string[] = [];
|
|
|
441 |
return;
|
442 |
}
|
443 |
|
444 |
+
// selectedVersion null check'i yukarıda yapıldı, artık güvenle kullanabiliriz
|
445 |
+
const currentVersion = this.selectedVersion!; // Non-null assertion
|
446 |
+
|
447 |
this.saving = true;
|
448 |
|
449 |
try {
|
|
|
480 |
fallback_error_prompt: intent.fallback_error_prompt
|
481 |
}));
|
482 |
|
483 |
+
// updateData'yı burada tanımla - currentVersion kullan
|
484 |
const updateData = {
|
485 |
caption: formValue.caption,
|
486 |
description: formValue.caption,
|
487 |
+
default_api: currentVersion.default_api || '',
|
488 |
+
published: currentVersion.published,
|
489 |
llm: llmConfig,
|
490 |
intents: intents,
|
491 |
parameters: [],
|
492 |
+
last_update_date: currentVersion.last_update_date
|
493 |
};
|
494 |
|
495 |
console.log('Saving version data:', JSON.stringify(updateData, null, 2));
|
496 |
|
497 |
const result = await this.apiService.updateVersion(
|
498 |
this.project.id,
|
499 |
+
currentVersion.id,
|
500 |
updateData
|
501 |
).toPromise();
|
502 |
|
|
|
517 |
console.error('Save error:', error);
|
518 |
|
519 |
if (error.status === 409) {
|
520 |
+
// updateData'ya burada da ihtiyacımız var
|
521 |
const formValue = this.versionForm.getRawValue();
|
522 |
const llmConfig = {
|
523 |
repo_id: formValue.llm.repo_id,
|
|
|
541 |
const retryUpdateData = {
|
542 |
caption: formValue.caption,
|
543 |
description: formValue.caption,
|
544 |
+
default_api: currentVersion.default_api || '',
|
545 |
+
published: currentVersion.published,
|
546 |
llm: llmConfig,
|
547 |
intents: intents,
|
548 |
parameters: [],
|
549 |
+
last_update_date: currentVersion.last_update_date
|
550 |
};
|
551 |
|
552 |
const { default: ConfirmDialogComponent } = await import('../confirm-dialog/confirm-dialog.component');
|
|
|
568 |
try {
|
569 |
await this.apiService.updateVersion(
|
570 |
this.project.id,
|
571 |
+
currentVersion.id,
|
572 |
retryUpdateData,
|
573 |
true // force flag
|
574 |
).toPromise();
|