• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
jslez

jslez

slidebot

Public
Like
slidebot
Home
Code
9
backend
4
backup
1
debug
1
frontend
1
pptx_examples
2
README-content-editing.md
README-development.md
README-how_pptx-works.md
README.md
Branches
1
Pull requests
Remixes
History
Environment variables
7
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
README.md
Code
/
README.md
Search
…
README.md

PPTX XML Editing Bot - Content-Aware AI System

🎯 CURRENT STATUS: Content-Aware AI Editing Restored! 🎉

The sophisticated content-aware AI system has been fully restored after fixing syntax errors.

✅ Current Features

  • Multi-Slide Content-Aware AI: AI sees ALL slides and their text elements with context
  • Multi-Slide Operations: AI can edit multiple slides in one request ("make whole deck about cats")
  • Text Box Relationship Understanding: AI knows which elements belong to the same text box
  • Smart Slide Targeting: AI automatically finds the right slide based on content
  • Text Box Replacement: AI can replace entire text boxes (all bullets) or individual elements
  • Markdown to PowerPoint XML: AI generates clean markdown, system converts to proper XML
  • Precise Element Selection: AI chooses the right text element using slide-aware IDs (1A, 2B, 3C, etc.)
  • Natural Language Commands: "Change the executive summary to something about cats"
  • Surgical XML Editing: Makes precise edits to specific elements without corruption
  • File Upload/Download: Drag & drop PPTX processing
  • Thread-Based Chat: Multiple conversation threads with persistent history

🔧 Recently Fixed

  • Syntax Errors: Resolved all missing braces and orphaned code blocks
  • Content-Aware System: Fully restored the sophisticated AI processing
  • Element Mapping: Restored precise element targeting and surgical edits

Example Commands That Work

"Change the main heading on the first slide to 5 words about tortoises"
"Replace the title with something about giraffes"
"Update the large text to say hello world"
"Add some lorem ipsum to the slide"

🚀 MILESTONE ACHIEVED: Content-Aware AI Editing

How It Works

  1. Content Extraction: System reads slide XML and extracts all text elements with context
  2. AI Analysis: OpenAI sees actual slide content: [A] "Kwaku Slide One" (18pt, top-center)
  3. Smart Selection: AI chooses the right element based on user's natural language
  4. Precise Edit: System makes surgical XML changes to exactly the right element

Technical Architecture

Content-Aware AI Flow

interface SlideText { text: string; // "Welcome to Company" fontSize: number; // 44 position: {...}; // top-center elementId: string; // "A" xmlPath: string; // For precise editing }

AI Decision Making

PPTX Content:

Slide 1 text elements:
Text Box TB0 (title):
  [1A] "Welcome to Company" (44pt, top-center)
Text Box TB1 (body):
  [1B] "Quarterly Review" (18pt, middle-left)

Slide 2 text elements:
Text Box TB0 (title):
  [2A] "Executive Summary" (36pt, top-center)
Text Box TB1 (body):
  [2B] "Key findings and recommendations" (16pt, middle-left)
  [2C] "First bullet point" (16pt, middle-left)
  [2D] "Second bullet point" (16pt, middle-left)

User: "Change the executive summary content to 3 bullet points about cats"
AI Decision: "User wants to replace entire body content under Executive Summary"
AI Response: {
  "textBoxId": "TB1", 
  "slideNumber": 2,
  "content": "• Cats are independent animals\n• Cats love to sleep in sunny spots\n• Cats communicate through purring"
}
System: Parses markdown → Generates proper PowerPoint XML → Replaces entire text box

PPTX XML Processing

The system uses deep knowledge of PPTX structure to make precise edits. See README-how_pptx-works.md for complete technical details on:

  • PPTX ZIP structure and relationships
  • XML parsing and text extraction
  • Safe editing patterns that preserve file integrity

🏗️ Important: Structure of Slide Elements

Understanding how PowerPoint organizes content is crucial for the AI system to make intelligent editing decisions.

Text Boxes vs. Text Elements

  • Text Box = <p:sp> element (PowerPoint shape container)
  • Text Elements = <a:t> tags within the text box (individual text runs)
  • One text box can contain multiple paragraphs (<a:p>) with multiple text runs (<a:t>)

How Bullets Are Actually Structured

<!-- Executive Summary slide has TWO text boxes: --> <!-- Text Box 1: Title --> <p:sp><p:ph type="title"/> <a:t>Executive Summary</a:t> </p:sp> <!-- Text Box 2: ALL bullets in ONE text box --> <p:sp><p:ph type="body"/> <a:p><a:buChar char="•"/><a:t>First bullet point</a:t></a:p> <a:p><a:buChar char="•"/><a:t>Second bullet point</a:t></a:p> <a:p><a:buChar char="•"/><a:t>Third bullet point</a:t></a:p> </p:sp>

Why Element-by-Element Parsing Is Safer

  • Preserves XML Structure: Each <a:t> replacement maintains bullet formatting
  • Avoids Corruption: No need to reconstruct complex XML with indentation, bullet chars, etc.
  • Granular Control: Can replace individual bullets or groups of bullets
  • User Flexibility: "Change first bullet" vs "change all executive summary content"

PowerPoint Placeholder Types

  • <p:ph type="title"/> - Main slide titles
  • <p:ph type="body"/> - Content areas (usually containing bullets)
  • <p:ph type="ctrTitle"/> - Centered titles
  • <p:ph type="subTitle"/> - Subtitles

AI Strategy: Text Box Awareness Without Grouping

The AI sees individual elements but understands their relationships:

Text Box 1 (title): [2A] "Executive Summary"
Text Box 2 (body): [2B] "First bullet" [2C] "Second bullet" [2D] "Third bullet"

When user says "change executive summary content" → AI targets the entire text box When user says "change executive summary title" → AI targets element 2A

Content Generation: Markdown to PowerPoint XML

The system uses a clean separation between content generation and technical implementation:

  1. AI generates markdown-like content:

    • First bullet point about cats
    • Second bullet point about dogs  
    • Third bullet point about birds
    
  2. System parses and converts to PowerPoint XML:

    <p:txBody> <a:p><a:pPr><a:buChar char="•"/></a:pPr><a:t>First bullet point about cats</a:t></a:p> <a:p><a:pPr><a:buChar char="•"/></a:pPr><a:t>Second bullet point about dogs</a:t></a:p> <a:p><a:pPr><a:buChar char="•"/></a:pPr><a:t>Third bullet point about birds</a:t></a:p> </p:txBody>

Benefits:

  • ✅ AI focuses on content: No need to understand PowerPoint XML complexity
  • ✅ System handles formatting: Proper bullet structure, indentation, XML escaping
  • ✅ Clean separation: Content generation vs. technical implementation
  • ✅ Flexible: Supports bullets, sub-bullets, plain text, mixed content

Success Criteria Met ✅

  • AI sees actual slide content (not blind heuristics)
  • Smart element selection based on context
  • Natural language commands work reliably
  • Precise XML editing without file corruption
  • Clean, maintainable codebase under 500 lines per file

🏗️ Clean Project Structure

├── backend/
│   ├── index.ts                 # Routes & database (~200 lines)
│   ├── pptx.ts                  # Content-aware PPTX processing (~400 lines)  
│   └── ai.ts                    # AI command parsing (~150 lines)
├── frontend/
│   └── index.html              # Simple web interface
└── README.md                   # This file

Architecture Benefits

  • Content-Aware: AI sees actual slide content before making decisions
  • Precise Editing: Surgical XML changes to specific elements
  • Clean Code: All files under 500 lines, clear separation of concerns
  • No Legacy Cruft: Removed all broken fallback code
  • Maintainable: Easy to find, understand, and modify functionality

API Endpoints

  • GET / - Main chat interface
  • GET /health - Health check
  • GET /api/chat - Get chat history
  • POST /api/chat - Send message (with content-aware AI)
  • POST /api/upload - Upload PPTX file
  • GET /api/download/:fileId - Download processed file

🔧 Development Guidelines

Code Organization

  • File Size Limit: Keep files under 500 lines for maintainability
  • Single Responsibility: Each file has one clear purpose
  • No Legacy Cruft: Remove broken code instead of keeping "fallbacks"
  • Content-Aware First: AI should see actual content, not use blind heuristics

Documentation Requirements

  • Keep README Updated: When you make code changes, update this README to reflect the current state
  • Technical Reference: See README-how_pptx-works.md for detailed PPTX XML structure documentation
  • Document Milestones: Update status sections when major features are completed
  • Remove Outdated Content: Delete old implementation details that no longer apply

Key Principles

  1. Intelligence Over Heuristics: Let AI see content and make smart decisions
  2. Precise Over Broad: Make surgical edits to specific elements
  3. Clean Over Complex: Remove unnecessary complexity and legacy code
  4. Working Over Perfect: Focus on functionality that actually works
  5. Document Over Assume: Keep documentation current with implementation

📚 Additional Documentation

  • README-content-editing.md - How the AI analyzes content and converts markdown to PowerPoint XML
  • README-development.md - Development roadmap and plans for slide structural operations
  • README-how_pptx-works.md - Comprehensive guide to PPTX XML structure, relationships, and editing patterns

Monitoring: GET requests to /health return "PPTX Bot is running" for health checks.

FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.