Merge branch 'feat/custom_schema_and_layout' of github.com:presenton/presenton into feat/custom_schema_and_layout

This commit is contained in:
shiva raj badu 2025-07-17 15:35:48 +05:45
commit a959d132e1
2 changed files with 4 additions and 5 deletions

View file

@ -13,7 +13,7 @@ from models.presentation_layout import PresentationLayoutModel
from models.presentation_structure_model import PresentationStructureModel
from models.presentation_with_slides import PresentationWithSlides
from models.sql.slide import SlideModel
from models.sse_response import SSECompleteResponse, SSEResponse, SSEStatusResponse
from models.sse_response import SSECompleteResponse, SSEResponse
from services import TEMP_FILE_SERVICE
from services.database import get_sql_session
from services.documents_loader import DocumentsLoader
@ -89,7 +89,6 @@ async def create_presentation(
prompt: Annotated[str, Body()],
n_slides: Annotated[int, Body()],
language: Annotated[str, Body()],
layout: Annotated[PresentationLayoutModel, Body()],
file_paths: Annotated[Optional[List[str]], Body()] = None,
):
presentation_id = str(uuid.uuid4())
@ -107,7 +106,6 @@ async def create_presentation(
prompt=prompt,
n_slides=n_slides,
language=language,
layout=layout.model_dump(),
summary=summary,
)
@ -123,6 +121,7 @@ async def create_presentation(
async def prepare_presentation(
presentation_id: Annotated[str, Body()],
outlines: Annotated[List[SlideOutlineModel], Body()],
layout: Annotated[PresentationLayoutModel, Body()],
title: Annotated[Optional[str], Body()] = None,
):
if not outlines:
@ -132,10 +131,10 @@ async def prepare_presentation(
presentation = sql_session.get(PresentationModel, presentation_id)
presentation.outlines = [each.model_dump() for each in outlines]
presentation.title = title or presentation.title
presentation.layout = layout.model_dump()
sql_session.commit()
sql_session.refresh(presentation)
layout = presentation.get_layout()
total_slide_layouts = len(layout.slides)
total_outlines = len(outlines)

View file

@ -22,7 +22,7 @@ class PresentationModel(SQLModel, table=True):
summary: Optional[str] = None
created_at: datetime = Field(sa_column=Column(DateTime, default=datetime.now))
updated_at: datetime = Field(sa_column=Column(DateTime, default=datetime.now))
layout: dict = Field(sa_column=Column(JSON))
layout: Optional[dict] = Field(sa_column=Column(JSON), default=None)
structure: Optional[dict] = Field(sa_column=Column(JSON), default=None)
def get_presentation_outline(self):