Add voice

This commit is contained in:
2026-04-05 10:13:28 +02:00
parent 1ca69e94c1
commit 55bd8a4e6b
3 changed files with 36 additions and 4 deletions

View File

@@ -88,6 +88,15 @@ def build_llm_reply(db: Session, student_id: int, user_message: str) -> str:
return response.output_text.strip()
def transcribe_audio(filename: str, audio_bytes: bytes, content_type: str | None = None) -> str:
file_payload = (filename, audio_bytes, content_type or "application/octet-stream")
transcript = client.audio.transcriptions.create(
model="gpt-4o-mini-transcribe",
file=file_payload,
)
return (getattr(transcript, "text", "") or "").strip()
def pick_next_skill(db: Session, student_id: int) -> models.Skill:
weakest = (
db.query(models.StudentSkillMastery)