ciyidogan commited on
Commit
6c56d9a
·
verified ·
1 Parent(s): bda5a73

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

Browse files
flare-ui/src/app/components/chat/realtime-chat.component.ts CHANGED
@@ -345,6 +345,10 @@ export class RealtimeChatComponent implements OnInit, OnDestroy, AfterViewChecke
345
  }
346
 
347
  ngOnInit(): void {
 
 
 
 
348
  // Check browser support
349
  if (!AudioStreamService.checkBrowserSupport()) {
350
  this.error = 'Tarayıcınız ses kaydını desteklemiyor. Lütfen modern bir tarayıcı kullanın.';
@@ -362,6 +366,7 @@ export class RealtimeChatComponent implements OnInit, OnDestroy, AfterViewChecke
362
  this.conversationManager.currentState$.pipe(
363
  takeUntil(this.destroyed$)
364
  ).subscribe(state => {
 
365
  this.currentState = state;
366
  this.updateRecordingState(state);
367
  });
@@ -370,13 +375,14 @@ export class RealtimeChatComponent implements OnInit, OnDestroy, AfterViewChecke
370
  this.conversationManager.messages$.pipe(
371
  takeUntil(this.destroyed$)
372
  ).subscribe(messages => {
 
373
  this.messages = messages;
374
  this.shouldScrollToBottom = true;
375
 
376
  // Check if we have initial welcome message
377
- if (messages.length === 1 && messages[0].role === 'assistant' && !this.isConversationActive) {
378
- // Show welcome message
379
- console.log('Welcome message received:', messages[0].text);
380
  }
381
  });
382
 
@@ -384,11 +390,15 @@ export class RealtimeChatComponent implements OnInit, OnDestroy, AfterViewChecke
384
  this.conversationManager.transcription$.pipe(
385
  takeUntil(this.destroyed$)
386
  ).subscribe(text => {
 
 
 
387
  this.currentTranscription = text;
388
  });
389
 
390
  // Load initial messages from session if available
391
  const initialMessages = this.conversationManager.getMessages();
 
392
  if (initialMessages.length > 0) {
393
  this.messages = initialMessages;
394
  this.shouldScrollToBottom = true;
 
345
  }
346
 
347
  ngOnInit(): void {
348
+ console.log('🎤 RealtimeChat component initialized');
349
+ console.log('Session ID:', this.sessionId);
350
+ console.log('Project Name:', this.projectName);
351
+
352
  // Check browser support
353
  if (!AudioStreamService.checkBrowserSupport()) {
354
  this.error = 'Tarayıcınız ses kaydını desteklemiyor. Lütfen modern bir tarayıcı kullanın.';
 
366
  this.conversationManager.currentState$.pipe(
367
  takeUntil(this.destroyed$)
368
  ).subscribe(state => {
369
+ console.log('📊 Conversation state:', state);
370
  this.currentState = state;
371
  this.updateRecordingState(state);
372
  });
 
375
  this.conversationManager.messages$.pipe(
376
  takeUntil(this.destroyed$)
377
  ).subscribe(messages => {
378
+ console.log('💬 Messages updated:', messages.length, 'messages');
379
  this.messages = messages;
380
  this.shouldScrollToBottom = true;
381
 
382
  // Check if we have initial welcome message
383
+ if (messages.length > 0) {
384
+ const lastMessage = messages[messages.length - 1];
385
+ console.log('📝 Last message:', lastMessage.role, lastMessage.text?.substring(0, 50) + '...');
386
  }
387
  });
388
 
 
390
  this.conversationManager.transcription$.pipe(
391
  takeUntil(this.destroyed$)
392
  ).subscribe(text => {
393
+ if (text) {
394
+ console.log('🎙️ Transcription:', text);
395
+ }
396
  this.currentTranscription = text;
397
  });
398
 
399
  // Load initial messages from session if available
400
  const initialMessages = this.conversationManager.getMessages();
401
+ console.log('📋 Initial messages:', initialMessages.length);
402
  if (initialMessages.length > 0) {
403
  this.messages = initialMessages;
404
  this.shouldScrollToBottom = true;