Chuyển đến nội dung
Skillpedia
PDF, Word và slide7.8k · #12945

ppt-generation-resilient

Skill này làm gì

Skill này mô tả hai cách tạo bản trình bày PowerPoint, với lộ trình trợ lý đứng trước. Dành cho người cần bộ slide và có phương án dự phòng nếu lộ trình đầu không hiệu quả.

Khi nào nên dùng

  • ✓Khi tôi cần một bản trình bày PowerPoint được tạo bằng chương trình.
  • ✓Khi trợ lý có thể thất bại hoặc đưa ra lỗi không rõ.
  • ✓Khi bản trình bày đủ phức tạp để cần kiểm soát Python trực tiếp.

Liên kết skill

https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/ppt-workflow-location-enhanced/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/ppt-workflow-location-enhanced/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Hãy làm một bản trình bày PowerPoint về lộ trình sản phẩm của chúng tôi, có tiêu đề và các gạch đầu dòng trên mỗi slide. Nếu trợ lý thất bại, hãy làm trực tiếp bằng Python.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

AI nhờ trợ lý tạo bộ slide theo mô tả rõ ràng, yêu cầu đường dẫn tệp đầy đủ, và dùng code python-pptx trực tiếp nếu kết quả của trợ lý không đạt yêu cầu.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Resilient PowerPoint Generation Workflow

When to Use This Skill

Use this workflow when:

  • You need to create PowerPoint presentations programmatically
  • shell_agent may fail or produce opaque error messages
  • You need robust error handling and debugging capabilities
  • Output files may be created in unexpected nested directories

Overview

This workflow provides two paths:

  1. Primary: Use shell_agent with clear specifications (preferred for simple presentations)
  2. Fallback: Direct Python execution with python-pptx library (for complex or failed shell_agent attempts)

Both paths include automatic error capture and file location verification.


Path 1: shell_agent (Primary)

Step 1.1: Delegate with Clear Specifications

Use shell_agent to create a PowerPoint presentation with:
- Specify exact number of slides needed
- Define content/topic for each slide
- Request file saved with clear filename (e.g., presentation.pptx)
- Ask agent to confirm the full file path after creation
- Request agent report any errors with full output

Example task description:

Create a PowerPoint presentation with 10 slides covering [topic]. Each slide should have a title and bullet points. Save it as presentation.pptx in the current working directory and report the full file path. If you encounter any errors, show the complete error message.

Step 1.2: Verify shell_agent Success

Check if shell_agent completed successfully:

  • Did it report a file path?
  • Can you access the file at that path?
  • Is the file size > 0 bytes?

If any check fails, proceed to Path 2 (Fallback).


Path 2: Direct Python with python-pptx (Fallback)

Step 2.1: Create Python Script File

First, write the PowerPoint generation script to a .py file (do NOT use inline execution):

# save as: generate_presentation.py
from pptx import Presentation
from pptx.util import Inches, Pt
import os

# CRITICAL: Explicitly set and verify working directory
working_dir = os.getcwd()
print(f"Working directory: {working_dir}")

# Create presentation
prs = Presentation()

# Example: Add slides with content
slides_content = [
    {"title": "Slide 1 Title", "content": ["Bullet 1", "Bullet 2"]},
    {"title": "Slide 2 Title", "content": ["Point A", "Point B", "Point C"]},
    # Add more slides as needed
]

for slide_data in slides_content:
    slide_layout = prs.slide_layouts[1]  # Title and Content layout
    slide = prs.slides.add_slide(slide_layout)
    
    # Set title
    title = slide.shapes.title
    title.text = slide_data["title"]
    
    # Set content
    content = slide.placeholders[1]
    tf = content.text_frame
    tf.clear()  # Clear existing content
    
    for i, point in enumerate(slide_data["content"]):
        if i == 0:
            p = tf.paragraphs[0]
        else:
            p = tf.add_paragraph()
        p.text = point
        p.font.size = Pt(18)

# Save to current working directory with explicit path
output_filename = "presentation.pptx"
output_path = os.path.join(working_dir, output_filename)
prs.save(output_path)

print(f"Presentation saved to: {output_path}")
print(f"File exists: {os.path.exists(output_path)}")
print(f"File size: {os.path.getsize(output_path)} bytes")

Step 2.2: Execute with Error Output Capture

CRITICAL: Always redirect stderr to stdout to capture actual error messages:

# Execute the script with full error output
python generate_presentation.py 2>&1

# Or if using run_shell tool, ensure 2>&1 is included

Why this matters: Without 2>&1, Python exceptions are sent to stderr and you only see "unknown error" instead of the actual exception message.

Step 2.3: Debug Common Issues

If execution fails, add these debugging commands:

# Check if python-pptx is installed
python -c "import pptx; print(pptx.__version__)" 2>&1

# Check working directory
pwd
ls -la

# Check Python version
python --version

# Run with verbose error output
python -u generate_presentation.py 2>&1 | tee execution_log.txt

Step 3: Locate the Output File (Both Paths)

PowerPoint files may be in nested workspace directories. Always verify location:

# Find all .pptx files in workspace
find . -name "*.pptx" -type f 2>&1

# Or search for specific filename
find . -name "presentation.pptx" -type f 2>&1

# If not found locally, search broader (last resort)
find /workspace -name "*.pptx" -type f 2>/dev/null

Step 4: Copy to Working Direct

Câu hỏi thường gặp

Loại bản trình bày nào hợp với lộ trình trợ lý?

Hướng dẫn gợi ý lộ trình trợ lý cho các bản trình bày đơn giản với slide cơ bản.

Khi nào Python trực tiếp tốt hơn?

Hướng dẫn gợi ý nó cho bộ slide phức tạp hoặc sau khi trợ lý đã thất bại.

Trợ lý cần báo cáo gì?

Đường dẫn tệp đầy đủ và mọi thông báo lỗi với đầu ra đầy đủ.

Chi tiết

Mô tả gốc của tác giả

Resilient PowerPoint generation with shell_agent primary path and python-pptx fallback

repo: HKUDS/AgentPilot

Độ phổ biến

Sao GitHub
7.8k
Vị trí xếp hạng
#12945
Giấy phép
MIT
Cập nhật
1/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự