Spaces:
Building
Building
Update chat_session/state_orchestrator.py
Browse files
chat_session/state_orchestrator.py
CHANGED
@@ -276,8 +276,6 @@ class StateOrchestrator:
|
|
276 |
text = result_data.get("text", "").strip()
|
277 |
if not text:
|
278 |
log_warning(f"⚠️ Empty final transcription", session_id=session_id)
|
279 |
-
# ✅ DÜZELTME: return yerine devam et
|
280 |
-
# return # BU SATIRI KALDIR VEYA YORUMA AL
|
281 |
|
282 |
if current_state != ConversationState.LISTENING:
|
283 |
log_warning(
|
@@ -287,25 +285,27 @@ class StateOrchestrator:
|
|
287 |
)
|
288 |
return
|
289 |
|
290 |
-
#
|
291 |
if text:
|
292 |
log_info(f"💬 Final transcription: '{text}'", session_id=session_id)
|
293 |
else:
|
294 |
log_info(f"💬 Final transcription: (silence detected)", session_id=session_id)
|
295 |
|
296 |
-
# ✅ STT'yi
|
297 |
await self.event_bus.publish(Event(
|
298 |
type=EventType.STT_STOPPED,
|
299 |
session_id=session_id,
|
300 |
data={"reason": "utterance_completed"}
|
301 |
))
|
302 |
|
303 |
-
# ✅ Boş transcript'te LLM'e
|
304 |
if not text:
|
305 |
# Tekrar dinlemeye geç
|
306 |
await self.transition_to(session_id, ConversationState.LISTENING)
|
307 |
|
308 |
-
# STT'yi
|
|
|
|
|
309 |
await self.event_bus.publish(Event(
|
310 |
type=EventType.STT_STARTED,
|
311 |
session_id=session_id,
|
@@ -322,6 +322,7 @@ class StateOrchestrator:
|
|
322 |
session_id=session_id,
|
323 |
data={"text": text}
|
324 |
))
|
|
|
325 |
async def _handle_llm_response_ready(self, event: Event):
|
326 |
"""Handle LLM response"""
|
327 |
session_id = event.session_id
|
|
|
276 |
text = result_data.get("text", "").strip()
|
277 |
if not text:
|
278 |
log_warning(f"⚠️ Empty final transcription", session_id=session_id)
|
|
|
|
|
279 |
|
280 |
if current_state != ConversationState.LISTENING:
|
281 |
log_warning(
|
|
|
285 |
)
|
286 |
return
|
287 |
|
288 |
+
# Text boş olsa bile log at
|
289 |
if text:
|
290 |
log_info(f"💬 Final transcription: '{text}'", session_id=session_id)
|
291 |
else:
|
292 |
log_info(f"💬 Final transcription: (silence detected)", session_id=session_id)
|
293 |
|
294 |
+
# ✅ STT'yi durdur ve dispose et
|
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,
|
|
|
322 |
session_id=session_id,
|
323 |
data={"text": text}
|
324 |
))
|
325 |
+
|
326 |
async def _handle_llm_response_ready(self, event: Event):
|
327 |
"""Handle LLM response"""
|
328 |
session_id = event.session_id
|