ciyidogan commited on
Commit
cc1e2e3
·
verified ·
1 Parent(s): 1745ba8

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

Browse files
flare-ui/src/app/components/chat/chat.component.ts CHANGED
@@ -98,8 +98,16 @@ export class ChatComponent implements OnInit, OnDestroy, AfterViewChecked {
98
  } catch (error) {
99
  console.error('Failed to create AudioContext:', error);
100
  }
 
 
 
101
  }
102
 
 
 
 
 
 
103
  ngAfterViewChecked() {
104
  if (this.shouldScroll) {
105
  this.scrollToBottom();
@@ -157,8 +165,8 @@ export class ChatComponent implements OnInit, OnDestroy, AfterViewChecked {
157
  return;
158
  }
159
 
160
- if (!this.sttAvailable) {
161
- this.error = 'STT is not configured. Please configure it in Environment settings.';
162
  this.snackBar.open(this.error, 'Close', { duration: 5000 });
163
  return;
164
  }
@@ -173,6 +181,7 @@ export class ChatComponent implements OnInit, OnDestroy, AfterViewChecked {
173
  // Store session ID for realtime component
174
  localStorage.setItem('current_session_id', res.session_id);
175
  localStorage.setItem('current_project', this.selectedProject || '');
 
176
 
177
  // Open realtime chat dialog
178
  this.openRealtimeDialog(res.session_id);
@@ -290,6 +299,11 @@ export class ChatComponent implements OnInit, OnDestroy, AfterViewChecked {
290
  return;
291
  }
292
 
 
 
 
 
 
293
  this.loading = true;
294
  this.error = '';
295
 
 
98
  } catch (error) {
99
  console.error('Failed to create AudioContext:', error);
100
  }
101
+
102
+ // Watch for STT toggle changes
103
+ this.watchSTTToggle();
104
  }
105
 
106
+ private watchSTTToggle(): void {
107
+ // When STT is toggled, provide feedback
108
+ // This could be implemented with form control valueChanges if needed
109
+ }
110
+
111
  ngAfterViewChecked() {
112
  if (this.shouldScroll) {
113
  this.scrollToBottom();
 
165
  return;
166
  }
167
 
168
+ if (!this.sttAvailable || !this.useSTT) {
169
+ this.error = 'STT must be enabled for real-time chat';
170
  this.snackBar.open(this.error, 'Close', { duration: 5000 });
171
  return;
172
  }
 
181
  // Store session ID for realtime component
182
  localStorage.setItem('current_session_id', res.session_id);
183
  localStorage.setItem('current_project', this.selectedProject || '');
184
+ localStorage.setItem('use_tts', this.useTTS.toString());
185
 
186
  // Open realtime chat dialog
187
  this.openRealtimeDialog(res.session_id);
 
299
  return;
300
  }
301
 
302
+ if (this.useSTT) {
303
+ this.snackBar.open('For voice input, please use Real-time Chat', 'Close', { duration: 3000 });
304
+ return;
305
+ }
306
+
307
  this.loading = true;
308
  this.error = '';
309