Spaces:
Running
Running
Update flare-ui/src/app/components/environment/environment.component.ts
Browse files
flare-ui/src/app/components/environment/environment.component.ts
CHANGED
@@ -583,16 +583,35 @@ export class EnvironmentComponent implements OnInit {
|
|
583 |
saving = false;
|
584 |
|
585 |
ngOnInit() {
|
586 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
587 |
}
|
588 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
589 |
loadEnvironment() {
|
|
|
590 |
this.loading = true;
|
|
|
591 |
this.apiService.getEnvironment().subscribe({
|
592 |
next: (env) => {
|
|
|
593 |
this.environment = env;
|
594 |
-
|
|
|
|
|
|
|
595 |
if (!this.environment.stt_settings) {
|
|
|
596 |
this.environment.stt_settings = {
|
597 |
speech_timeout_ms: 2000,
|
598 |
noise_reduction_level: 2,
|
@@ -604,9 +623,12 @@ export class EnvironmentComponent implements OnInit {
|
|
604 |
interim_results: true
|
605 |
};
|
606 |
}
|
|
|
|
|
607 |
this.loading = false;
|
608 |
},
|
609 |
error: (err) => {
|
|
|
610 |
this.snackBar.open('Failed to load environment configuration', 'Close', {
|
611 |
duration: 5000,
|
612 |
panelClass: 'error-snackbar'
|
@@ -692,9 +714,37 @@ export class EnvironmentComponent implements OnInit {
|
|
692 |
}
|
693 |
}
|
694 |
|
695 |
-
|
696 |
-
|
697 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
698 |
}
|
699 |
}
|
700 |
|
|
|
583 |
saving = false;
|
584 |
|
585 |
ngOnInit() {
|
586 |
+
console.log('EnvironmentComponent ngOnInit started');
|
587 |
+
try {
|
588 |
+
this.loadEnvironment();
|
589 |
+
} catch (error) {
|
590 |
+
console.error('Error in ngOnInit:', error);
|
591 |
+
console.error('Stack trace:', error.stack);
|
592 |
+
}
|
593 |
}
|
594 |
+
|
595 |
+
ngAfterViewInit() {
|
596 |
+
console.log('EnvironmentComponent ngAfterViewInit');
|
597 |
+
console.log('Current environment:', this.environment);
|
598 |
+
console.log('STT settings:', this.environment.stt_settings);
|
599 |
+
}
|
600 |
+
|
601 |
loadEnvironment() {
|
602 |
+
console.log('loadEnvironment called');
|
603 |
this.loading = true;
|
604 |
+
|
605 |
this.apiService.getEnvironment().subscribe({
|
606 |
next: (env) => {
|
607 |
+
console.log('Environment loaded from API:', env);
|
608 |
this.environment = env;
|
609 |
+
|
610 |
+
// Debug check
|
611 |
+
console.log('Checking stt_settings:', this.environment.stt_settings);
|
612 |
+
|
613 |
if (!this.environment.stt_settings) {
|
614 |
+
console.log('No stt_settings found, creating defaults...');
|
615 |
this.environment.stt_settings = {
|
616 |
speech_timeout_ms: 2000,
|
617 |
noise_reduction_level: 2,
|
|
|
623 |
interim_results: true
|
624 |
};
|
625 |
}
|
626 |
+
|
627 |
+
console.log('Final environment:', this.environment);
|
628 |
this.loading = false;
|
629 |
},
|
630 |
error: (err) => {
|
631 |
+
console.error('Error loading environment:', err);
|
632 |
this.snackBar.open('Failed to load environment configuration', 'Close', {
|
633 |
duration: 5000,
|
634 |
panelClass: 'error-snackbar'
|
|
|
714 |
}
|
715 |
}
|
716 |
|
717 |
+
onSTTEngineChange() {
|
718 |
+
console.log('onSTTEngineChange called with:', this.environment.stt_engine);
|
719 |
+
console.log('Current stt_settings:', this.environment.stt_settings);
|
720 |
+
|
721 |
+
try {
|
722 |
+
if (this.environment.stt_engine === 'no_stt') {
|
723 |
+
this.environment.stt_engine_api_key = '';
|
724 |
+
this.sttSettingsExpanded = false;
|
725 |
+
} else {
|
726 |
+
// Debug log
|
727 |
+
console.log('Setting up STT settings...');
|
728 |
+
|
729 |
+
if (!this.environment.stt_settings) {
|
730 |
+
console.log('Creating new stt_settings...');
|
731 |
+
this.environment.stt_settings = {
|
732 |
+
speech_timeout_ms: 2000,
|
733 |
+
noise_reduction_level: 2,
|
734 |
+
vad_sensitivity: 0.5,
|
735 |
+
language: 'tr-TR',
|
736 |
+
model: 'latest_long',
|
737 |
+
use_enhanced: true,
|
738 |
+
enable_punctuation: true,
|
739 |
+
interim_results: true
|
740 |
+
};
|
741 |
+
}
|
742 |
+
this.sttSettingsExpanded = true;
|
743 |
+
console.log('STT settings after setup:', this.environment.stt_settings);
|
744 |
+
}
|
745 |
+
} catch (error) {
|
746 |
+
console.error('Error in onSTTEngineChange:', error);
|
747 |
+
console.error('Stack trace:', error.stack);
|
748 |
}
|
749 |
}
|
750 |
|