Spaces:
Running
Running
Pulastya B commited on
Commit ·
644cb0d
1
Parent(s): 4079a53
Fixed SSE response streaming error
Browse files
FRRONTEEEND/components/ChatInterface.tsx
CHANGED
|
@@ -381,6 +381,14 @@ export const ChatInterface: React.FC<{ onBack: () => void }> = ({ onBack }) => {
|
|
| 381 |
if (data.result) {
|
| 382 |
processAnalysisResult(data.result, activeSessionId);
|
| 383 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 384 |
} else {
|
| 385 |
console.log('⏭️ Skipping duplicate analysis result', resultKey);
|
| 386 |
}
|
|
|
|
| 381 |
if (data.result) {
|
| 382 |
processAnalysisResult(data.result, activeSessionId);
|
| 383 |
}
|
| 384 |
+
|
| 385 |
+
// Close SSE connection after receiving final result to prevent duplicate events
|
| 386 |
+
console.log('🔒 Closing SSE connection after analysis complete');
|
| 387 |
+
if (eventSourceRef.current) {
|
| 388 |
+
eventSourceRef.current.close();
|
| 389 |
+
eventSourceRef.current = null;
|
| 390 |
+
sseSessionRef.current = null;
|
| 391 |
+
}
|
| 392 |
} else {
|
| 393 |
console.log('⏭️ Skipping duplicate analysis result', resultKey);
|
| 394 |
}
|