feat: Implement Text-to-Speech (TTS) functionality with API endpoints, models, and service integration
This commit is contained in:
@@ -12,6 +12,7 @@ from .playlist_sound import PlaylistSound
|
||||
from .scheduled_task import ScheduledTask
|
||||
from .sound import Sound
|
||||
from .sound_played import SoundPlayed
|
||||
from .tts import TTS
|
||||
from .user import User
|
||||
from .user_oauth import UserOauth
|
||||
|
||||
@@ -27,6 +28,7 @@ __all__ = [
|
||||
"ScheduledTask",
|
||||
"Sound",
|
||||
"SoundPlayed",
|
||||
"TTS",
|
||||
"User",
|
||||
"UserOauth",
|
||||
]
|
||||
|
||||
26
app/models/tts.py
Normal file
26
app/models/tts.py
Normal file
@@ -0,0 +1,26 @@
|
||||
"""TTS model."""
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Any
|
||||
|
||||
from sqlalchemy import JSON, Column
|
||||
from sqlmodel import Field, SQLModel
|
||||
|
||||
|
||||
class TTS(SQLModel, table=True):
|
||||
"""Text-to-Speech generation record."""
|
||||
|
||||
__tablename__ = "tts"
|
||||
|
||||
id: int | None = Field(primary_key=True)
|
||||
text: str = Field(max_length=1000, description="Text that was converted to speech")
|
||||
provider: str = Field(max_length=50, description="TTS provider used")
|
||||
options: dict[str, Any] = Field(
|
||||
default_factory=dict,
|
||||
sa_column=Column(JSON),
|
||||
description="Provider-specific options used"
|
||||
)
|
||||
sound_id: int | None = Field(foreign_key="sound.id", description="Associated sound ID")
|
||||
user_id: int = Field(foreign_key="user.id", description="User who created the TTS")
|
||||
created_at: datetime = Field(default_factory=datetime.utcnow)
|
||||
updated_at: datetime = Field(default_factory=datetime.utcnow)
|
||||
Reference in New Issue
Block a user