fix: STT consistency — web.py model param, error matching, local provider key

- 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
This commit is contained in:
0xbyt4 2026-03-14 00:14:19 +03:00
parent 41162e0aca
commit e3126aeb40
3 changed files with 6 additions and 5 deletions

View file

@ -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, {

View file

@ -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:

View file

@ -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)