From e3126aeb4076e9872122011b5cc036d1f367b02e Mon Sep 17 00:00:00 2001 From: 0xbyt4 <35742124+0xbyt4@users.noreply.github.com> Date: Sat, 14 Mar 2026 00:14:19 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20STT=20consistency=20=E2=80=94=20web.py?= =?UTF-8?q?=20model=20param,=20error=20matching,=20local=20provider=20key?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - web.py: pass stt_model from config like discord.py and run.py do - run.py: match new error messages (No STT provider / not set) - _transcribe_local: add missing "provider": "local" to return dict --- gateway/platforms/web.py | 5 +++-- gateway/run.py | 4 ++-- tools/transcription_tools.py | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/gateway/platforms/web.py b/gateway/platforms/web.py index 55a6124d..9a5d39fa 100644 --- a/gateway/platforms/web.py +++ b/gateway/platforms/web.py @@ -444,8 +444,9 @@ class WebAdapter(BasePlatformAdapter): f.write(audio_bytes) try: - from tools.transcription_tools import transcribe_audio - result = await asyncio.to_thread(transcribe_audio, tmp_path) + from tools.transcription_tools import transcribe_audio, get_stt_model_from_config + stt_model = get_stt_model_from_config() + result = await asyncio.to_thread(transcribe_audio, tmp_path, model=stt_model) if not result.get("success"): await self._send_to_session(session_id, { diff --git a/gateway/run.py b/gateway/run.py index 5ea40828..a24efe01 100644 --- a/gateway/run.py +++ b/gateway/run.py @@ -3345,10 +3345,10 @@ class GatewayRunner: ) else: error = result.get("error", "unknown error") - if "OPENAI_API_KEY" in error or "VOICE_TOOLS_OPENAI_KEY" in error: + if "No STT provider" in error or "not set" in error: enriched_parts.append( "[The user sent a voice message but I can't listen " - "to it right now~ VOICE_TOOLS_OPENAI_KEY isn't set up yet " + "to it right now~ No STT provider is configured " "(';w;') Let them know!]" ) else: diff --git a/tools/transcription_tools.py b/tools/transcription_tools.py index b28891a8..09ffb6a7 100644 --- a/tools/transcription_tools.py +++ b/tools/transcription_tools.py @@ -209,7 +209,7 @@ def _transcribe_local(file_path: str, model_name: str) -> Dict[str, Any]: Path(file_path).name, model_name, info.language, info.duration, ) - return {"success": True, "transcript": transcript} + return {"success": True, "transcript": transcript, "provider": "local"} except Exception as e: logger.error("Local transcription failed: %s", e, exc_info=True)