Files
john 05e173b293 Ship native iOS app, Wiki/TTS backend, and skeleton loading UX.
Replace the WebView shell with SwiftUI screens, add account-scoped Wiki and TTS APIs with adaptive review and photo scan support, and keep web/iOS pages usable while data loads asynchronously.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-08 15:13:59 +08:00

26 lines
758 B
Python

from fastapi import APIRouter, Depends, HTTPException, Query
from fastapi.responses import Response
from auth import get_current_user
from models import User
from services.tts_service import TtsServiceError, tts_service
router = APIRouter(prefix="/api", tags=["tts"])
@router.get("/tts/speak")
def speak_word(
text: str = Query(..., min_length=1, max_length=200),
current_user: User = Depends(get_current_user),
):
try:
audio_bytes, content_type = tts_service.synthesize(text)
except TtsServiceError as exc:
raise HTTPException(status_code=503, detail=str(exc)) from exc
return Response(
content=audio_bytes,
media_type=content_type,
headers={"Cache-Control": "private, max-age=86400"},
)