ciyidogan commited on
Commit
ca52aa5
·
verified ·
1 Parent(s): ef0730d

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

Browse files
flare-ui/src/app/services/conversation-manager.service.ts CHANGED
@@ -134,24 +134,30 @@ export class ConversationManagerService implements OnDestroy {
134
 
135
  throw error;
136
  }
137
- }
138
 
139
  stopConversation(): void {
140
- try {
141
- // Send stop signal if connected
142
- if (this.wsService.isConnected()) {
143
- this.wsService.sendControl('stop_session');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
  }
145
-
146
- this.cleanup();
147
- this.addSystemMessage('Conversation ended');
148
-
149
- } catch (error) {
150
- console.error('Error stopping conversation:', error);
151
- this.cleanup();
152
- }
153
  }
154
-
155
  private setupSubscriptions(): void {
156
  // Audio chunks from microphone
157
  this.subscriptions.add(
 
134
 
135
  throw error;
136
  }
137
+ }
138
 
139
  stopConversation(): void {
140
+ try {
141
+ // First stop audio recording
142
+ this.audioService.stopRecording();
143
+
144
+ // Then send stop signal if connected
145
+ if (this.wsService.isConnected()) {
146
+ this.wsService.sendControl('stop_session');
147
+ }
148
+
149
+ // Small delay before disconnecting
150
+ setTimeout(() => {
151
+ this.cleanup();
152
+ this.addSystemMessage('Conversation ended');
153
+ }, 100);
154
+
155
+ } catch (error) {
156
+ console.error('Error stopping conversation:', error);
157
+ this.cleanup();
158
  }
 
 
 
 
 
 
 
 
159
  }
160
+
161
  private setupSubscriptions(): void {
162
  // Audio chunks from microphone
163
  this.subscriptions.add(