mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-28 04:59:52 +01:00
- Defaults and config aligned with English-first product surface - Adds/removes ASR/TTS paths; drops China-only provider implementations and bundled SenseVoice assets - Westernizes prompts, plugin/tool copy, connection and handler behavior on upstream fixes - Powermem max_tokens and OpenAI no-thinking guard preserved on downstream path
23 lines
759 B
Python
23 lines
759 B
Python
import os
|
|
from config.logger import setup_logging
|
|
from core.providers.tts.base import TTSProviderBase
|
|
|
|
TAG = __name__
|
|
logger = setup_logging()
|
|
|
|
|
|
class DefaultTTS(TTSProviderBase):
|
|
def __init__(self, config, delete_audio_file=True):
|
|
super().__init__(config, delete_audio_file)
|
|
self.output_dir = config.get("output_dir", "tmp")
|
|
if not os.path.exists(self.output_dir):
|
|
os.makedirs(self.output_dir)
|
|
|
|
def generate_filename(self):
|
|
"""Generate unique audio filename"""
|
|
import uuid
|
|
|
|
return os.path.join(self.output_dir, f"{uuid.uuid4()}.wav")
|
|
|
|
async def text_to_speak(self, text, output_file):
|
|
logger.bind(tag=TAG).error(f"Unable to instantiate TTS service, please check configuration")
|