ciyidogan commited on
Commit
b4cf038
·
verified ·
1 Parent(s): 32272c2

Update flare-ui/src/app/services/api.service.ts

Browse files
flare-ui/src/app/services/api.service.ts CHANGED
@@ -116,6 +116,17 @@ export interface Project {
116
  last_update_user?: string;
117
  }
118
 
 
 
 
 
 
 
 
 
 
 
 
119
  @Injectable({
120
  providedIn: 'root'
121
  })
@@ -417,6 +428,23 @@ export class ApiService {
417
  );
418
  }
419
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
420
  // ===================== Error Handler =====================
421
  private handleError(error: any) {
422
  console.error('API Error:', error);
 
116
  last_update_user?: string;
117
  }
118
 
119
+ export interface Environment {
120
+ work_mode: string;
121
+ cloud_token: string;
122
+ spark_endpoint: string;
123
+ internal_prompt?: string;
124
+ tts_engine?: string;
125
+ tts_engine_api_key?: string;
126
+ stt_engine?: string;
127
+ stt_engine_api_key?: string;
128
+ }
129
+
130
  @Injectable({
131
  providedIn: 'root'
132
  })
 
428
  );
429
  }
430
 
431
+ // ===================== TTS =====================
432
+ generateTTS(text: string, voiceId?: string, modelId?: string, outputFormat: string = 'mp3_44100_128'): Observable<Blob> {
433
+ const body = {
434
+ text,
435
+ voice_id: voiceId,
436
+ model_id: modelId,
437
+ output_format: outputFormat
438
+ };
439
+
440
+ return this.http.post(`${this.apiUrl}/tts/generate`, body, {
441
+ headers: this.getAuthHeaders(),
442
+ responseType: 'blob'
443
+ }).pipe(
444
+ catchError(this.handleError)
445
+ );
446
+ }
447
+
448
  // ===================== Error Handler =====================
449
  private handleError(error: any) {
450
  console.error('API Error:', error);