使用 LangGraph 构建 LLM 驱动的幻灯片生成器
Creating presentation slides from just a single prompt is now feasible with large language models (LLMs). In this tutorial, we will build a fully automated system that takes a raw, detailed question or topic and generates a multi-slide presentation in response. The system will use an LLM (like OpenAI’s GPT API or a local model via Ollama) to produce slide content, and leverage LangGraph for orchestrating the workflow. We’ll cover both the backend logic (in Python) and a simple frontend (in React) to showcase the results. The goal is a fast and unique slide generation pipeline that outputs a beautiful presentation (PPTX or PDF) with minimal human effort.
仅使用单个提示创建演示幻灯片现在使用大型语言模型 (LLMs) 已成为可能。在本教程中,我们将构建一个完全自动化的系统,它接受原始的、详细的问题或主题,并生成多幻灯片演示作为响应。该系统将使用 LLM(例如 OpenAI’s GPT API 或通过 Ollama 的本地模型)来生成幻灯片内容,并利用 LangGraph 来编排工作流程。我们将涵盖后端逻辑(使用 Python)和一个简单的 React 前端来展示结果。目标是一个快速且独特的幻灯片生成管道,它以最少的人力努力输出美丽的演示文稿 (PPTX 或 PDF)。
What you will learn:
你将学到什么:
How LLMs can automate slide content creation (outlines, bullet points, etc.) . Using LangGraph to coordinate multi-step tasks (like web searches for facts or image fetching) in a reliable, stateful workflow . Generating PowerPoint slides programmatically with Python (using the python-pptx library ). Building a simple React UI that allows the user to input a prompt, trigger slide generation, and choose the output format (web preview, PPTX, or PDF). By the end, you’ll have a blueprint for an app that takes a single prompt and returns a set of slides — an LLM-driven slide deck generator that is fully autonomous from prompt to presentation.
LLMs 如何自动化幻灯片内容创建(大纲、要点等)。使用 LangGraph 协调多步骤任务(例如网页搜索事实或图像获取)在可靠的有状态工作流中。以编程方式使用 Python(python-pptx 库)生成 PowerPoint 幻灯片。构建一个简单的 React UI,允许用户输入提示、触发幻灯片生成,并选择输出格式(网页预览、PPTX 或 PDF)。最终,你将拥有一个蓝图,该应用接受单个提示并返回一组幻灯片——一个从提示到演示文稿完全自治的 LLM 驱动幻灯片生成器。
[React UI]
| POST /generateSlides (prompt, format=pptx|pdf)
v
[FastAPI/Flask]
v
[LangGraph App State]
├─ plan_slides (LLM → outline JSON)
├─ fill_content (LLM per-slide bullets) [optional if plan returns bul...