added voice functionality and increased avatar size
All checks were successful
Deploy FluentGerman.ai / deploy (push) Successful in 53s

This commit is contained in:
2026-02-18 10:11:13 +01:00
parent 6df7b17261
commit be366777d4
7 changed files with 59 additions and 11 deletions

View File

@@ -10,7 +10,9 @@ from app.config import get_settings
async def transcribe(audio_bytes: bytes, filename: str = "audio.webm") -> str:
"""Transcribe audio to text using OpenAI Whisper API."""
settings = get_settings()
client = openai.AsyncOpenAI(api_key=settings.llm_api_key)
# Use dedicated OpenAI key if available, otherwise fallback to LLM key
api_key = settings.openai_api_key or settings.llm_api_key
client = openai.AsyncOpenAI(api_key=api_key)
audio_file = io.BytesIO(audio_bytes)
audio_file.name = filename
@@ -25,7 +27,9 @@ async def transcribe(audio_bytes: bytes, filename: str = "audio.webm") -> str:
async def synthesize(text: str) -> bytes:
"""Synthesize text to speech using OpenAI TTS API."""
settings = get_settings()
client = openai.AsyncOpenAI(api_key=settings.llm_api_key)
# Use dedicated OpenAI key if available, otherwise fallback to LLM key
api_key = settings.openai_api_key or settings.llm_api_key
client = openai.AsyncOpenAI(api_key=api_key)
response = await client.audio.speech.create(
model=settings.tts_model,