- Updated docker-compose.yml to allow disabling embedded Ollama via environment variable. - Refactored Dockerfile and Dockerfile.dev for improved dependency management and installation process. - Enhanced FastAPI migration scripts to handle orphaned Alembic revisions and added new database migration logic. - Improved error handling in background tasks and Codex authentication endpoints. - Added support for font file uploads with better validation and extraction of font names. - Introduced new image search functionality with support for Pexels and Pixabay APIs.
32 lines
1 KiB
Python
32 lines
1 KiB
Python
from typing import Optional
|
|
import uuid
|
|
from sqlalchemy import ForeignKey
|
|
from sqlmodel import Field, Column, JSON, SQLModel
|
|
|
|
|
|
class SlideModel(SQLModel, table=True):
|
|
__tablename__ = "slides"
|
|
|
|
id: uuid.UUID = Field(primary_key=True, default_factory=uuid.uuid4)
|
|
presentation: uuid.UUID = Field(
|
|
sa_column=Column(ForeignKey("presentations.id", ondelete="CASCADE"), index=True)
|
|
)
|
|
layout_group: str
|
|
layout: str
|
|
index: int
|
|
content: dict = Field(sa_column=Column(JSON))
|
|
html_content: Optional[str] = None
|
|
speaker_note: Optional[str] = None
|
|
properties: Optional[dict] = Field(sa_column=Column(JSON))
|
|
|
|
def get_new_slide(self, presentation: uuid.UUID, content: Optional[dict] = None):
|
|
return SlideModel(
|
|
id=uuid.uuid4(),
|
|
presentation=presentation,
|
|
layout_group=self.layout_group,
|
|
layout=self.layout,
|
|
index=self.index,
|
|
speaker_note=self.speaker_note,
|
|
content=content or self.content,
|
|
properties=self.properties,
|
|
)
|