Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions gateway/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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),
)


Expand Down
7 changes: 7 additions & 0 deletions gateway/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion run_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down