feat(audio): add pluggable audio preprocessing and denoising layer before STT
- Add audio_enhancer module with 60s timeout, zero-transcoding default, and fail-soft fallback - Persist enhanced audio in daily folders with _enhanced suffix and emit audio.enhance.result event - Connect audio enhancer to transcribe_multi and transcribe in stt.py - Forward message_id and trace_id from handlers - Ensure consensus_text fallback persistence and remove scenario leakage in nlu.py - Add test_enhancer.py unit suite and update smoke_test.py
This commit is contained in:
@@ -73,6 +73,15 @@ class Settings(BaseSettings):
|
||||
STT_MODEL: str = "whisper-1"
|
||||
STT_LANGUAGE: str = "fa"
|
||||
|
||||
# Audio Enhancement / Preprocessing (denoising & speech quality enhancement)
|
||||
AUDIO_ENHANCE_ENABLED: bool = False
|
||||
AUDIO_ENHANCE_BASE_URL: str = ""
|
||||
AUDIO_ENHANCE_API_KEY: str = ""
|
||||
AUDIO_ENHANCE_MODEL: str = ""
|
||||
AUDIO_ENHANCE_TIMEOUT_SECONDS: float = 60.0
|
||||
AUDIO_ENHANCE_TARGET_FORMAT: str = "" # empty = pass raw bytes directly; e.g. "wav" / "mp3"
|
||||
AUDIO_ENHANCE_METHOD: str = "auto" # "auto" | "raw_stream" | "multipart"
|
||||
|
||||
@property
|
||||
def stt_base_url(self) -> str:
|
||||
return self.STT_BASE_URL or self.AI_BASE_URL
|
||||
|
||||
Reference in New Issue
Block a user