Spaces:
Building
Building
Update chat_session/state_orchestrator.py
Browse files
chat_session/state_orchestrator.py
CHANGED
@@ -291,28 +291,21 @@ class StateOrchestrator:
|
|
291 |
else:
|
292 |
log_info(f"💬 Final transcription: (silence detected)", session_id=session_id)
|
293 |
|
294 |
-
# ✅ STT'yi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
295 |
await self.event_bus.publish(Event(
|
296 |
type=EventType.STT_STOPPED,
|
297 |
session_id=session_id,
|
298 |
data={"reason": "utterance_completed"}
|
299 |
))
|
300 |
|
301 |
-
# ✅ Boş transcript'te LLM'e gönderme
|
302 |
-
if not text:
|
303 |
-
# Tekrar dinlemeye geç
|
304 |
-
await self.transition_to(session_id, ConversationState.LISTENING)
|
305 |
-
|
306 |
-
# ✅ Biraz bekle ve STT'yi yeniden başlat
|
307 |
-
await asyncio.sleep(0.5)
|
308 |
-
|
309 |
-
await self.event_bus.publish(Event(
|
310 |
-
type=EventType.STT_STARTED,
|
311 |
-
session_id=session_id,
|
312 |
-
data={}
|
313 |
-
))
|
314 |
-
return
|
315 |
-
|
316 |
# Transition to processing
|
317 |
await self.transition_to(session_id, ConversationState.PROCESSING_SPEECH)
|
318 |
|
|
|
291 |
else:
|
292 |
log_info(f"💬 Final transcription: (silence detected)", session_id=session_id)
|
293 |
|
294 |
+
# ✅ Boş transcript'te STT'yi yeniden başlatmaya gerek yok
|
295 |
+
# ✅ Deepgram zaten continuous listening modunda çalışıyor
|
296 |
+
if not text:
|
297 |
+
# Sadece log at ve devam et
|
298 |
+
log_debug(f"🔄 Continuing to listen after silence", session_id=session_id)
|
299 |
+
return
|
300 |
+
|
301 |
+
# ✅ Sadece gerçek text varsa STT'yi durdur ve LLM'e gönder
|
302 |
+
# STT'yi durdur
|
303 |
await self.event_bus.publish(Event(
|
304 |
type=EventType.STT_STOPPED,
|
305 |
session_id=session_id,
|
306 |
data={"reason": "utterance_completed"}
|
307 |
))
|
308 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
309 |
# Transition to processing
|
310 |
await self.transition_to(session_id, ConversationState.PROCESSING_SPEECH)
|
311 |
|