Skip to content

Latest commit

Β 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AI-Powered Presentation Viewer

An interactive PDF presentation viewer with integrated ElevenLabs voice AI agent. Navigate slides using voice commands, view conversation transcripts, and control presentations through both UI and voice.

LivePresenter Screenshot

License: MIT

✨ Features

  • πŸ“Š PDF Rendering - Smooth, high-quality PDF slide rendering using PDF.js
  • 🎀 Voice Control - Navigate presentations using natural voice commands via ElevenLabs
  • πŸ’¬ Live Transcript - Real-time conversation transcript with chat interface
  • 🧭 Multiple Navigation - Click buttons, use keyboard shortcuts, or speak commands
  • πŸ“± Responsive Design - Works on desktop, tablet, and mobile devices
  • 🎨 Modern UI - Clean, dark-themed interface with glassmorphism effects
  • πŸ—‚οΈ Slide Sidebar - Hamburger menu with slide navigation and titles
  • πŸ”§ Modular Architecture - Well-organized, maintainable codebase

πŸš€ Quick Start

Prerequisites

  • A web server (cannot run from file:// protocol)
  • An ElevenLabs account with a Conversational AI agent
  • Your presentation in PDF format
  • Python 3 (for PDF extraction utility)

Installation

  1. Clone or download this repository

    git clone <your-repo-url>
    cd presentation_viewer
  2. Place your PDF file

    cp your-presentation.pdf presentation.pdf
  3. Configure ElevenLabs

    cp config.example.js config.js

    Edit config.js and add your ElevenLabs agent ID:

    export const CONFIG = {
      ELEVENLABS_AGENT_ID: 'agent_your_id_here',
      PDF_PATH: './presentation.pdf'
    };
  4. Extract PDF content (auto-generates slide navigation)

    pip install pdfplumber
    python extract_pdf.py presentation.pdf

    This creates:

    • RAG content file for your ElevenLabs agent
    • modules/slide-titles.js with auto-extracted slide titles

    See docs/PDF_EXTRACTION.md for details.

  5. Start a web server

    # Python
    python3 -m http.server 8000
    
    # Node.js
    npx http-server -p 8000
    
    # PHP
    php -S localhost:8000
  6. Open in browser

    Navigate to http://localhost:8000 and you're ready!

🎯 ElevenLabs Agent Setup

Your ElevenLabs agent should be configured with these client tools to enable voice navigation:

Tool Name Description Parameters
nextPage Navigate to next slide none
previousPage Navigate to previous slide none
goToPage Jump to specific slide pageNumber (number)
getCurrentPage Get current slide number none
getTotalPages Get total number of slides none
getPageText Extract text from current slide none

Sample Agent System Prompt

You are a helpful presentation assistant. You can help users navigate through
a PDF presentation using voice commands.

You have access to these tools:
- nextPage: Move to the next slide
- previousPage: Move to the previous slide
- goToPage: Jump to a specific slide number
- getCurrentPage: Check what slide we're on
- getTotalPages: Find out how many slides there are
- getPageText: Read the text content from the current slide

When users ask you to navigate (e.g., "next slide", "go to slide 5",
"what's on this page"), use the appropriate tool and let them know what
slide they're on.

Be conversational and helpful. If they ask about the content, use getPageText
to read it to them.

The viewer automatically registers these tools when it initializes. See the ElevenLabs documentation for more information.

πŸ“– Usage

Voice Commands

Click the microphone button to start a conversation, then use natural language:

  • "Go to the next slide"
  • "Show me slide 5"
  • "What page are we on?"
  • "Go back to the previous slide"
  • "Read the text on this slide"

UI Controls

  • Previous/Next Buttons - Navigate slides
  • Hamburger Menu (☰) - View slide list and jump to any slide
  • Chat Button (πŸ’¬) - Toggle conversation transcript
  • Microphone Button - Start/end voice conversation

Keyboard Shortcuts

  • ← / β†’ - Previous/Next slide
  • Home / End - First/Last slide
  • Esc - Close sidebar/chat

Developer API

For testing and debugging, use the window.pdfController API:

// Navigate programmatically
window.pdfController.nextPage()
window.pdfController.previousPage()
window.pdfController.goToPage(5)

// Get state
window.pdfController.getCurrentPage()  // Returns { current: 1, total: 20 }
window.pdfController.getTotalPages()   // Returns 20

// Extract text
await window.pdfController.getPageText() // Returns text content

βš™οΈ Configuration

config.js

export const CONFIG = {
  // Required: Your ElevenLabs agent ID
  ELEVENLABS_AGENT_ID: 'agent_xxxxx',

  // PDF file path
  PDF_PATH: './presentation.pdf',

  // Optional: Customize loading messages
  LOADING_MESSAGES: {
    init: 'Initializing...',
    loading: 'Loading PDF...',
    rendering: 'Rendering slides...'
  }
};

modules/slide-titles.js

Auto-generated by extract_pdf.py, but you can manually edit:

export const SLIDE_TITLES = [
  { page: 1, title: 'Introduction' },
  { page: 2, title: 'Key Concepts' },
  { page: 3, title: 'Data Analysis' },
  // ...
];

Styling

Edit css/presentation.css to customize:

  • Colors and themes
  • Fonts and typography
  • Avatar image (line 183)
  • Responsive breakpoints

πŸ—οΈ Architecture

Modular Design

Each module has a single responsibility and clear interface:

presentation_viewer/
β”œβ”€β”€ index.html              # Main HTML entry point
β”œβ”€β”€ main.js                 # System orchestrator
β”œβ”€β”€ config.js               # User configuration
β”œβ”€β”€ extract_pdf.py          # PDF extraction utility
β”œβ”€β”€ css/
β”‚   └── presentation.css    # All styles
β”œβ”€β”€ docs/
β”‚   └── PDF_EXTRACTION.md   # PDF extraction guide
└── modules/
    β”œβ”€β”€ state-manager.js    # State tracking and events
    β”œβ”€β”€ pdf-renderer.js     # PDF.js integration
    β”œβ”€β”€ navigation.js       # Navigation logic
    β”œβ”€β”€ ui-controls.js      # UI buttons and controls
    β”œβ”€β”€ voice-controls.js   # Voice button UI
    β”œβ”€β”€ client-tools.js     # ElevenLabs tool registration
    β”œβ”€β”€ chat-interface.js   # Chat UI panel
    β”œβ”€β”€ transcript-manager.js # Message routing
    β”œβ”€β”€ slide-sidebar.js    # Sidebar navigation
    β”œβ”€β”€ api-controller.js   # Testing API
    └── slide-titles.js     # Slide metadata

Data Flow

Voice Input β†’ ElevenLabs Agent β†’ Client Tools β†’ Navigation β†’ PDF Renderer
                    ↓
              Transcript Manager β†’ Chat Interface

Adding Features

  1. Create a new module in modules/your-feature.js
  2. Export a class with clear public methods
  3. Import in main.js and wire it up
  4. Update this README

Module Template:

/**
 * YOUR MODULE
 *
 * Purpose: Brief description
 * Contract: What it does
 * Dependencies: What it needs
 */

export class YourModule {
  constructor(dependencies) {
    // Initialize
  }

  // Public methods
  publicMethod() {
    // Implementation
  }

  // Private methods (prefix with _)
  _privateMethod() {
    // Implementation
  }
}

πŸ› Troubleshooting

PDF doesn't load

  • βœ… Ensure you're serving via HTTP/HTTPS (not file://)
  • βœ… Check PDF path in config.js
  • βœ… Look for errors in browser console (F12)

Voice control not working

  • βœ… Verify your ElevenLabs agent ID in config.js
  • βœ… Check that client tools are registered in your ElevenLabs agent
  • βœ… Ensure microphone permissions are granted
  • βœ… Check browser console for connection errors

Chat not showing messages

  • βœ… Ensure voice session is active (click microphone button)
  • βœ… Check that onMessage callback is receiving data
  • βœ… Use window.chatDebug helpers for testing:
    window.chatDebug.addTestMessage('user', 'Hello!')
    window.chatDebug.showChat()

Slide sidebar is empty

  • βœ… Run python extract_pdf.py presentation.pdf to auto-generate titles
  • βœ… Or manually edit modules/slide-titles.js

🌐 Browser Compatibility

Browser Status
Chrome/Edge βœ… Fully supported
Firefox βœ… Fully supported
Safari βœ… Fully supported
Mobile browsers βœ… Responsive design

🀝 Contributing

Contributions welcome! This is designed to be a clean, reusable base for AI-powered presentations.

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

MIT License - see LICENSE file for details.

Feel free to use this in your own projects!

πŸ™ Credits

πŸ’¬ Support

For issues or questions:

  1. Check the Troubleshooting section
  2. Review browser console for errors (F12)
  3. Verify ElevenLabs agent configuration
  4. Open an issue on GitHub

Enjoy your AI-powered presentations! πŸŽ€πŸ“Šβœ¨

About

Using an ElevenLabs agent to walk a person through a given PDF (annual report, pitch deck, etc.)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages