ciyidogan commited on
Commit
fd57883
·
verified ·
1 Parent(s): 0b77ded

Update flare-ui/src/app/components/environment/environment.component.ts

Browse files
flare-ui/src/app/components/environment/environment.component.ts CHANGED
@@ -616,6 +616,30 @@ export class EnvironmentComponent implements OnInit {
616
  });
617
  }
618
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
619
  updateSTTSetting(key: string, value: any) {
620
  if (!this.environment.stt_settings) {
621
  this.environment.stt_settings = {
 
616
  });
617
  }
618
 
619
+ onSTTCredentialsFileSelected(event: any) {
620
+ const file = event.target.files[0];
621
+ if (file && file.type === 'application/json') {
622
+ const reader = new FileReader();
623
+ reader.onload = (e: any) => {
624
+ try {
625
+ // Validate it's a valid JSON
626
+ const jsonContent = JSON.parse(e.target.result);
627
+ // Store the entire JSON content as the API key
628
+ this.environment.stt_engine_api_key = e.target.result;
629
+ this.snackBar.open('Google credentials loaded successfully', 'Close', {
630
+ duration: 3000
631
+ });
632
+ } catch (error) {
633
+ this.snackBar.open('Invalid JSON file', 'Close', {
634
+ duration: 3000,
635
+ panelClass: 'error-snackbar'
636
+ });
637
+ }
638
+ };
639
+ reader.readAsText(file);
640
+ }
641
+ }
642
+
643
  updateSTTSetting(key: string, value: any) {
644
  if (!this.environment.stt_settings) {
645
  this.environment.stt_settings = {