ciyidogan commited on
Commit
2c2874a
·
verified ·
1 Parent(s): 3b66e59

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

Browse files
flare-ui/src/app/dialogs/project-edit-dialog/project-edit-dialog.component.ts CHANGED
@@ -222,58 +222,40 @@ export default class ProjectEditDialogComponent implements OnInit {
222
  this.form.markAllAsTouched();
223
  return;
224
  }
225
-
226
  this.saving = true;
227
  try {
228
  const formValue = this.form.value;
229
- const projectData = {
 
 
230
  name: formValue.name,
231
  caption: formValue.caption,
232
  icon: formValue.icon,
233
- description: formValue.description,
234
  default_language: formValue.defaultLanguage,
235
  supported_languages: formValue.supportedLanguages,
236
  timezone: formValue.timezone,
237
  region: formValue.region,
238
  test_users: formValue.testUsers || []
239
  };
240
-
241
  let result;
242
  if (this.data.mode === 'create') {
243
- result = await this.apiService.createProject(projectData).toPromise();
244
-
245
- // Otomatik boş versiyon oluştur
246
- if (result) {
247
- const defaultVersion = {
248
- caption: 'Version 1',
249
- description: 'Initial version',
250
- default_api: '',
251
- published: false,
252
- llm: {
253
- repo_id: '',
254
- generation_config: {
255
- max_new_tokens: 512,
256
- temperature: 0.7,
257
- top_p: 0.95,
258
- top_k: 50,
259
- repetition_penalty: 1.1
260
- },
261
- use_fine_tune: false,
262
- fine_tune_zip: ''
263
- },
264
- intents: [],
265
- parameters: []
266
- };
267
- }
268
-
269
  this.showMessage('Project created successfully!', false);
270
  } else {
271
- projectData.id = this.data.project.id;
272
- projectData.last_update_date = this.data.project.last_update_date;
273
- result = await this.apiService.updateProject(this.data.project.id, projectData).toPromise();
 
 
 
 
 
274
  this.showMessage('Project updated successfully!', false);
275
  }
276
-
277
  this.dialogRef.close(result);
278
  } catch (error: any) {
279
  if (error.status === 409) {
@@ -285,7 +267,7 @@ export default class ProjectEditDialogComponent implements OnInit {
285
  this.saving = false;
286
  }
287
  }
288
-
289
  private showMessage(message: string, isError: boolean) {
290
  this.snackBar.open(message, 'Close', {
291
  duration: isError ? 5000 : 3000,
 
222
  this.form.markAllAsTouched();
223
  return;
224
  }
225
+
226
  this.saving = true;
227
  try {
228
  const formValue = this.form.value;
229
+
230
+ // Base project data
231
+ const baseProjectData = {
232
  name: formValue.name,
233
  caption: formValue.caption,
234
  icon: formValue.icon,
235
+ description: formValue.description,
236
  default_language: formValue.defaultLanguage,
237
  supported_languages: formValue.supportedLanguages,
238
  timezone: formValue.timezone,
239
  region: formValue.region,
240
  test_users: formValue.testUsers || []
241
  };
242
+
243
  let result;
244
  if (this.data.mode === 'create') {
245
+ result = await this.apiService.createProject(baseProjectData).toPromise();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
246
  this.showMessage('Project created successfully!', false);
247
  } else {
248
+ // Edit mode için ek alanlarla birlikte gönder
249
+ const updateProjectData = {
250
+ ...baseProjectData,
251
+ id: this.data.project.id,
252
+ last_update_date: this.data.project.last_update_date
253
+ };
254
+
255
+ result = await this.apiService.updateProject(this.data.project.id, updateProjectData).toPromise();
256
  this.showMessage('Project updated successfully!', false);
257
  }
258
+
259
  this.dialogRef.close(result);
260
  } catch (error: any) {
261
  if (error.status === 409) {
 
267
  this.saving = false;
268
  }
269
  }
270
+
271
  private showMessage(message: string, isError: boolean) {
272
  this.snackBar.open(message, 'Close', {
273
  duration: isError ? 5000 : 3000,