26 lines
928 B
Python
26 lines
928 B
Python
"""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) |