You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(pptx): preserve template decorative elements when generating PPTX #109
When generating PPTX files using a template, decorative image elements (icons, graphics, weather widgets, etc.) from the original template slides are lost in the generated output. Users expect the template to act as a visual foundation where decorative elements are preserved.
Current State
In services/crawler/app/services/pptx_service.py:
New slides are created using prs.slides.add_slide(layout) - this only uses the slide layout, NOT the actual template slide content
Original template slides are deleted using prs.part.drop_rel(rId), which severs relationships to embedded images
Slide layouts only contain placeholder structure, not the decorative shapes that exist on the actual template slides
The code creates template_slides_by_layout but never uses it to clone slides.
constslideContentSchema=z.object({slideIndex: z.number().optional().describe('Index of template slide to clone (from analyze_template)'),layoutName: z.string().optional().describe('Layout name as fallback matching'),// ... existing fields});
fromcopyimportdeepcopydef_clone_slide(self, prs: Presentation, template_slide) ->Slide:
"""Clone a template slide including all shapes and relationships."""layout=template_slide.slide_layoutnew_slide=prs.slides.add_slide(layout)
# Remove default shapes created by add_slide (from layout)forshapeinlist(new_slide.shapes):
sp=shape.elementsp.getparent().remove(sp)
# Copy all shapes from template to new slideforshapeintemplate_slide.shapes:
el=deepcopy(shape.element)
new_slide.shapes._spTree.append(el)
# Copy relationships (for images, etc.)forrelintemplate_slide.part.rels.values():
if"image"inrel.reltype.lower():
new_slide.part.relate_to(rel._target, rel.reltype)
returnnew_slide
Activity
larryro commentedon Jan 8, 2026
Implementation Plan
Step 1: Enhance Template Analysis (analyze_template)
File:
services/crawler/app/services/pptx_service.pyEnhance
_extract_slide_info()method to return more detailed slide structure for AI:slideIndexfor each slide (for clone matching)layoutNamefor each slidehasDecorativeElementsflag (images, shapes)Step 2: Update SlideContentData Schema
File:
services/platform/convex/model/documents/generate_pptx.tsAdd
slideIndexfield toSlideContentData:File:
services/platform/convex/agent_tools/files/pptx_tool.tsUpdate
slideContentSchema:Step 3: Add Slide Cloning Method
File:
services/crawler/app/services/pptx_service.pyAdd
_clone_slide()method using deepcopy:Step 4: Add Placeholder Replacement Method
File:
services/crawler/app/services/pptx_service.pyAdd
_replace_placeholder_content()method:Step 5: Modify
generate_pptx_from_content()to Use CloningFile:
services/crawler/app/services/pptx_service.pyModify main generation logic to use cloning:
Step 6: Clean Up Obsolete Code
File:
services/crawler/app/services/pptx_service.pyRemove redundant methods after implementing cloning:
_add_title_to_slide()_add_subtitle_to_slide()_add_text_to_slide()_add_bullet_list_to_slide()_create_slide_from_content()_clone_slide()+_replace_placeholder_content()Keep these methods:
_add_table_to_slide()_find_layout_by_name()Files to Modify
services/crawler/app/services/pptx_service.pyservices/platform/convex/model/documents/generate_pptx.tsslideIndexfieldservices/platform/convex/agent_tools/files/pptx_tool.tsPotential Risks
relate_to()Testing Strategy
🤖 Generated with Claude Code
fix(pptx): preserve template decorative elements when generating PPTX
fix(pptx): add slideIndex and layoutName to Convex validator
fix(pptx): add content length limits to tool description
feat(pptx): auto-calculate content limits from placeholder dimensions
fix(pptx): clear placeholder content before replacing
fix(pptx): skip text boxes and tables when cloning slides