Spaces:
Building
Building
Update flare-ui/src/app/components/chat/chat.component.ts
Browse files
flare-ui/src/app/components/chat/chat.component.ts
CHANGED
@@ -61,6 +61,9 @@ export class ChatComponent implements OnInit, OnDestroy, AfterViewChecked {
|
|
61 |
loading = false;
|
62 |
error = '';
|
63 |
playingAudio = false;
|
|
|
|
|
|
|
64 |
|
65 |
// Audio visualization
|
66 |
audioContext?: AudioContext;
|
@@ -79,6 +82,7 @@ export class ChatComponent implements OnInit, OnDestroy, AfterViewChecked {
|
|
79 |
ngOnInit(): void {
|
80 |
this.loadProjects();
|
81 |
this.checkTTSAvailability();
|
|
|
82 |
|
83 |
// Initialize Audio Context
|
84 |
this.audioContext = new (window.AudioContext || (window as any).webkitAudioContext)();
|
@@ -142,6 +146,28 @@ export class ChatComponent implements OnInit, OnDestroy, AfterViewChecked {
|
|
142 |
});
|
143 |
}
|
144 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
startChat(): void {
|
146 |
if (!this.selectedProject) return;
|
147 |
|
|
|
61 |
loading = false;
|
62 |
error = '';
|
63 |
playingAudio = false;
|
64 |
+
useSTT = false;
|
65 |
+
sttAvailable = false;
|
66 |
+
isListening = false;
|
67 |
|
68 |
// Audio visualization
|
69 |
audioContext?: AudioContext;
|
|
|
82 |
ngOnInit(): void {
|
83 |
this.loadProjects();
|
84 |
this.checkTTSAvailability();
|
85 |
+
this.checkSTTAvailability();
|
86 |
|
87 |
// Initialize Audio Context
|
88 |
this.audioContext = new (window.AudioContext || (window as any).webkitAudioContext)();
|
|
|
146 |
});
|
147 |
}
|
148 |
|
149 |
+
checkSTTAvailability(): void {
|
150 |
+
const sub = this.environmentService.environment$.subscribe(env => {
|
151 |
+
if (env) {
|
152 |
+
this.sttAvailable = env.stt_engine !== 'no_stt';
|
153 |
+
if (!this.sttAvailable) {
|
154 |
+
this.useSTT = false;
|
155 |
+
}
|
156 |
+
}
|
157 |
+
});
|
158 |
+
this.subs.add(sub);
|
159 |
+
|
160 |
+
// Also get current environment
|
161 |
+
this.api.getEnvironment().subscribe({
|
162 |
+
next: (env) => {
|
163 |
+
this.sttAvailable = env.stt_engine !== 'no_stt';
|
164 |
+
if (!this.sttAvailable) {
|
165 |
+
this.useSTT = false;
|
166 |
+
}
|
167 |
+
}
|
168 |
+
});
|
169 |
+
}
|
170 |
+
|
171 |
startChat(): void {
|
172 |
if (!this.selectedProject) return;
|
173 |
|