ciyidogan commited on
Commit
35c652b
·
verified ·
1 Parent(s): b02afd6

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

Browse files
flare-ui/src/app/components/chat/chat.component.ts CHANGED
@@ -381,4 +381,29 @@ export class ChatComponent implements OnInit, OnDestroy, AfterViewChecked {
381
  console.error('Scroll error:', err);
382
  }
383
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
384
  }
 
381
  console.error('Scroll error:', err);
382
  }
383
  }
384
+
385
+ startRealtimeChat(): void {
386
+ if (!this.selectedProject) return;
387
+
388
+ this.loading = true;
389
+ this.error = '';
390
+
391
+ const sub = this.api.startChat(this.selectedProject).subscribe({
392
+ next: res => {
393
+ // Store session ID for realtime component
394
+ localStorage.setItem('current_session_id', res.session_id);
395
+
396
+ // Navigate to realtime chat or open in dialog
397
+ this.openRealtimeDialog(res.session_id);
398
+
399
+ this.loading = false;
400
+ },
401
+ error: (err) => {
402
+ this.error = err.error?.detail || 'Failed to start realtime session';
403
+ this.loading = false;
404
+ console.error('Start realtime chat error:', err);
405
+ }
406
+ });
407
+ this.subs.add(sub);
408
+ }
409
  }