ciyidogan commited on
Commit
c4b43fa
Β·
verified Β·
1 Parent(s): aa6ec1a

Update realtime_stt_manager.py

Browse files
Files changed (1) hide show
  1. realtime_stt_manager.py +7 -7
realtime_stt_manager.py CHANGED
@@ -8,7 +8,7 @@ import sys
8
 
9
  from stt_interface import STTInterface, STTConfig, TranscriptionResult
10
  from config_provider import ConfigProvider
11
- from utils import log
12
 
13
  class STTStreamManager:
14
  """Manages real-time STT streaming"""
@@ -39,12 +39,12 @@ class STTStreamManager:
39
  # Start streaming session
40
  await self.stt_provider.start_streaming(self.config)
41
  self.is_streaming = True
42
- log("βœ… STT stream manager initialized")
43
 
44
  async def process_chunk(self, audio_chunk: bytes) -> AsyncIterator[TranscriptionResult]:
45
  """Process audio chunk and yield transcription results"""
46
  if not self.is_streaming or not self.stt_provider:
47
- log("⚠️ STT not streaming or provider not initialized")
48
  return
49
 
50
  try:
@@ -58,7 +58,7 @@ class STTStreamManager:
58
  yield result
59
 
60
  except Exception as e:
61
- log(f"❌ STT processing error: {e}")
62
  # Yield error result
63
  yield TranscriptionResult(
64
  text="",
@@ -81,18 +81,18 @@ class STTStreamManager:
81
  self.accumulated_text = final_result.text
82
  self.last_final_result = final_result
83
 
84
- log("βœ… STT streaming stopped")
85
  return final_result
86
 
87
  except Exception as e:
88
- log(f"❌ Error stopping STT stream: {e}")
89
  return None
90
 
91
  def reset(self):
92
  """Reset accumulated text and state"""
93
  self.accumulated_text = ""
94
  self.last_final_result = None
95
- log("πŸ”„ STT stream manager reset")
96
 
97
  def get_accumulated_text(self) -> str:
98
  """Get all accumulated text from the session"""
 
8
 
9
  from stt_interface import STTInterface, STTConfig, TranscriptionResult
10
  from config_provider import ConfigProvider
11
+ from logger import log_info, log_error, log_warning, log_debug
12
 
13
  class STTStreamManager:
14
  """Manages real-time STT streaming"""
 
39
  # Start streaming session
40
  await self.stt_provider.start_streaming(self.config)
41
  self.is_streaming = True
42
+ log_info("βœ… STT stream manager initialized")
43
 
44
  async def process_chunk(self, audio_chunk: bytes) -> AsyncIterator[TranscriptionResult]:
45
  """Process audio chunk and yield transcription results"""
46
  if not self.is_streaming or not self.stt_provider:
47
+ log_info("⚠️ STT not streaming or provider not initialized")
48
  return
49
 
50
  try:
 
58
  yield result
59
 
60
  except Exception as e:
61
+ log_error("❌ STT processing error", e)
62
  # Yield error result
63
  yield TranscriptionResult(
64
  text="",
 
81
  self.accumulated_text = final_result.text
82
  self.last_final_result = final_result
83
 
84
+ log_info("βœ… STT streaming stopped")
85
  return final_result
86
 
87
  except Exception as e:
88
+ log_error("❌ Error stopping STT stream", e)
89
  return None
90
 
91
  def reset(self):
92
  """Reset accumulated text and state"""
93
  self.accumulated_text = ""
94
  self.last_final_result = None
95
+ log_info("πŸ”„ STT stream manager reset")
96
 
97
  def get_accumulated_text(self) -> str:
98
  """Get all accumulated text from the session"""