🚀 Auto-deploy: BotVPS atualizado em 24/03/2026 11:57:55

This commit is contained in:
2026-03-24 11:57:55 +00:00
parent 9509ea8fe8
commit c2273a13f0
3 changed files with 66 additions and 27 deletions

View File

@@ -9,7 +9,7 @@ from orchestrator import (
format_completion_message, execute_step_async
)
from ai_agent import query_agent_async
from audio_handler import transcribe_audio, text_to_speech
from audio_handler import transcribe_audio, text_to_speech_async
from config import get_config
# Configuração de logging
@@ -22,10 +22,10 @@ logger = logging.getLogger(__name__)
TOKEN = os.getenv("TELEGRAM_BOT_TOKEN")
ALLOWED_CHAT_ID = os.getenv("TELEGRAM_CHAT_ID")
def synthesize_audio(text: str) -> str:
"""Wrapper para a síntese de voz centralizada."""
async def synthesize_audio(text: str) -> str:
"""Wrapper assíncrono para a síntese de voz centralizada."""
try:
filename = text_to_speech(text)
filename = await text_to_speech_async(text)
return os.path.join("/tmp", filename)
except Exception as e:
logger.error(f"TTS Error: {e}")
@@ -119,10 +119,10 @@ async def process_logic(update: Update, context: ContextTypes.DEFAULT_TYPE, user
# Se foi por voz, responde por voz também
if is_voice:
audio_path = synthesize_audio(reply_clean)
audio_path = await synthesize_audio(reply_clean)
if audio_path and os.path.exists(audio_path):
with open(audio_path, 'rb') as voice:
await update.message.reply_voice(voice)
with open(audio_path, 'rb') as voice_file:
await update.message.reply_voice(voice_file)
os.remove(audio_path)
def get_telegram_app():