From 3415208a7c33f60aac2fb887ef1478f98f2e07db Mon Sep 17 00:00:00 2001 From: Suraj Jha Date: Wed, 13 Aug 2025 17:54:47 +0545 Subject: [PATCH] fix: stuck template generation --- servers/fastapi/api/v1/ppt/endpoints/pptx_slides.py | 2 +- .../custom-template/hooks/useSlideProcessing.ts | 12 +++++++++++- .../custom-template/page.tsx | 1 - 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/servers/fastapi/api/v1/ppt/endpoints/pptx_slides.py b/servers/fastapi/api/v1/ppt/endpoints/pptx_slides.py index 5044cd52..9b922f3c 100644 --- a/servers/fastapi/api/v1/ppt/endpoints/pptx_slides.py +++ b/servers/fastapi/api/v1/ppt/endpoints/pptx_slides.py @@ -249,7 +249,7 @@ async def analyze_fonts_in_all_slides(slide_xmls: List[str]) -> FontAnalysisResu return FontAnalysisResult( internally_supported_fonts=internally_supported_fonts, - not_supported_fonts=not_supported_fonts + not_supported_fonts=[] ) diff --git a/servers/nextjs/app/(presentation-generator)/custom-template/hooks/useSlideProcessing.ts b/servers/nextjs/app/(presentation-generator)/custom-template/hooks/useSlideProcessing.ts index 544c4804..52e67a7c 100644 --- a/servers/nextjs/app/(presentation-generator)/custom-template/hooks/useSlideProcessing.ts +++ b/servers/nextjs/app/(presentation-generator)/custom-template/hooks/useSlideProcessing.ts @@ -157,13 +157,23 @@ export const useSlideProcessing = ( setSlides(initialSlides); + const hasUnsupported = Array.isArray(pptxData.fonts?.not_supported_fonts) && pptxData.fonts.not_supported_fonts.length > 0; + toast.success( `Template Processing Finished`, { - description: `Please Upload the not supported fonts, and click Extract Template` + description: hasUnsupported + ? `Please Upload the not supported fonts, and click Extract Template` + : `All fonts are supported. Starting template extraction...` } ); + // If all fonts are supported, auto-start extraction from the first slide + if (!hasUnsupported && initialSlides.length > 0) { + const firstSlide = initialSlides[0]; + setTimeout(() => processSlideToHtml(firstSlide, 0), 300); + } + } catch (error) { console.error("Error processing file:", error); diff --git a/servers/nextjs/app/(presentation-generator)/custom-template/page.tsx b/servers/nextjs/app/(presentation-generator)/custom-template/page.tsx index b77ded5d..3c23d26f 100644 --- a/servers/nextjs/app/(presentation-generator)/custom-template/page.tsx +++ b/servers/nextjs/app/(presentation-generator)/custom-template/page.tsx @@ -82,7 +82,6 @@ const CustomTemplatePage = () => { } }, []); - // Loading state if (isRequiredKeyLoading) { return ;