ciyidogan commited on
Commit
e53114d
·
verified ·
1 Parent(s): 177ec20

Update flare-ui/src/app/services/conversation-manager.service.ts

Browse files
flare-ui/src/app/services/conversation-manager.service.ts CHANGED
@@ -228,64 +228,64 @@ export class ConversationManagerService implements OnDestroy {
228
  }
229
 
230
  private handleMessage(message: any): void {
231
- try {
232
- switch (message.type) {
233
- case 'transcription':
234
- if (message['is_final']) {
235
- this.addMessage('user', message['text']);
236
- this.transcriptionSubject.next('');
237
- }
238
- break;
239
-
240
- case 'assistant_response':
241
- // Welcome mesajı veya normal yanıt
242
- const isWelcome = message['is_welcome'] || false;
243
- this.addMessage('assistant', message['text']);
244
-
245
- if (isWelcome) {
246
- console.log('📢 Welcome message received:', message['text']);
247
- }
248
- break;
249
-
250
- case 'tts_audio':
251
- this.handleTTSAudio(message);
252
- break;
253
-
254
- case 'control':
255
- if (message['action'] === 'stop_playback') {
256
- this.stopAudioPlayback();
257
- }
258
- break;
259
-
260
- case 'error':
261
- this.handleServerError(message);
262
- break;
263
-
264
- case 'session_config':
265
- // Update configuration from server
266
- if (message['config']) {
267
- this.conversationConfig = { ...this.conversationConfig, ...message['config'] };
268
- }
269
- break;
270
-
271
- case 'session_started':
272
- // Session başladı, STT durumunu kontrol et
273
- console.log('📢 Session started:', message);
274
- if (!message['stt_initialized']) {
275
- this.addSystemMessage('Speech recognition failed to initialize. Voice input will not be available.');
276
- }
277
- break;
 
 
 
 
 
 
 
 
 
278
  }
279
- } catch (error) {
280
- console.error('Error handling message:', error);
281
- this.errorSubject.next({
282
- type: 'unknown',
283
- message: 'Failed to process message',
284
- details: error,
285
- timestamp: new Date()
286
- });
287
  }
288
- }
289
 
290
  private handleStateChange(from: string, to: string): void {
291
  console.log(`📊 State: ${from} → ${to}`);
 
228
  }
229
 
230
  private handleMessage(message: any): void {
231
+ try {
232
+ switch (message.type) {
233
+ case 'transcription':
234
+ if (message['is_final']) {
235
+ this.addMessage('user', message['text']);
236
+ this.transcriptionSubject.next('');
237
+ }
238
+ break;
239
+
240
+ case 'assistant_response':
241
+ // Welcome mesajı veya normal yanıt
242
+ const isWelcome = message['is_welcome'] || false;
243
+ this.addMessage('assistant', message['text']);
244
+
245
+ if (isWelcome) {
246
+ console.log('📢 Welcome message received:', message['text']);
247
+ }
248
+ break;
249
+
250
+ case 'tts_audio':
251
+ this.handleTTSAudio(message);
252
+ break;
253
+
254
+ case 'control':
255
+ if (message['action'] === 'stop_playback') {
256
+ this.stopAudioPlayback();
257
+ }
258
+ break;
259
+
260
+ case 'error':
261
+ this.handleServerError(message);
262
+ break;
263
+
264
+ case 'session_config':
265
+ // Update configuration from server
266
+ if (message['config']) {
267
+ this.conversationConfig = { ...this.conversationConfig, ...message['config'] };
268
+ }
269
+ break;
270
+
271
+ case 'session_started':
272
+ // Session başladı, STT durumunu kontrol et
273
+ console.log('📢 Session started:', message);
274
+ if (!message['stt_initialized']) {
275
+ this.addSystemMessage('Speech recognition failed to initialize. Voice input will not be available.');
276
+ }
277
+ break;
278
+ }
279
+ } catch (error) {
280
+ console.error('Error handling message:', error);
281
+ this.errorSubject.next({
282
+ type: 'unknown',
283
+ message: 'Failed to process message',
284
+ details: error,
285
+ timestamp: new Date()
286
+ });
287
  }
 
 
 
 
 
 
 
 
288
  }
 
289
 
290
  private handleStateChange(from: string, to: string): void {
291
  console.log(`📊 State: ${from} → ${to}`);