diff --git a/gateway/config.py b/gateway/config.py index 9a517f81b231..d6edbd05f4c9 100644 --- a/gateway/config.py +++ b/gateway/config.py @@ -152,6 +152,9 @@ class GatewayConfig: # Delivery settings always_log_local: bool = True # Always save cron outputs to local files + # STT (Speech-to-Text) settings + stt_enabled: bool = True # Enable/disable voice message transcription + def get_connected_platforms(self) -> List[Platform]: """Return list of platforms that are enabled and configured.""" connected = [] @@ -211,6 +214,7 @@ def to_dict(self) -> Dict[str, Any]: "reset_triggers": self.reset_triggers, "sessions_dir": str(self.sessions_dir), "always_log_local": self.always_log_local, + "stt_enabled": self.stt_enabled, } @classmethod @@ -251,6 +255,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "GatewayConfig": reset_triggers=data.get("reset_triggers", ["/new", "/reset"]), sessions_dir=sessions_dir, always_log_local=data.get("always_log_local", True), + stt_enabled=data.get("stt_enabled", True), ) diff --git a/gateway/run.py b/gateway/run.py index 6dd1a280a54d..3206ecf3a4cc 100644 --- a/gateway/run.py +++ b/gateway/run.py @@ -2260,6 +2260,13 @@ async def _enrich_message_with_transcription( Returns: The enriched message string with transcriptions prepended. """ + # Check if STT is enabled in config + if not getattr(self.config, 'stt_enabled', True): + logger.debug("STT disabled in config, skipping transcription") + if audio_paths: + return "[The user sent voice message(s) but transcription is disabled]\n\n" + user_text if user_text else "[The user sent voice message(s) but transcription is disabled]" + return user_text + from tools.transcription_tools import transcribe_audio import asyncio diff --git a/run_agent.py b/run_agent.py index c1f2623c83f8..7f196ed1cd7f 100644 --- a/run_agent.py +++ b/run_agent.py @@ -2350,7 +2350,7 @@ def _build_api_kwargs(self, api_messages: list) -> dict: "model": self.model, "messages": api_messages, "tools": self.tools if self.tools else None, - "timeout": 900.0, + "timeout": float(os.getenv("OPEN_AI_LLM_TIMEOUT", 900.0)), } if self.max_tokens is not None: