fix: support PPT generation without GEMINI_API_KEY by adding Path B fallback#1171
fix: support PPT generation without GEMINI_API_KEY by adding Path B fallback#1171Jennifer-00 wants to merge 4 commits intobytedance:mainfrom
Conversation
There was a problem hiding this comment.
@Jennifer-00 why do you do it? It's not related to topic of this PR?
| middlewares.append(todo_list_middleware) | ||
|
|
||
| # Add PPT enforcement middleware (ensures PPTX artifact exists for PPT requests) | ||
| middlewares.append(PptEnforcementMiddleware()) |
There was a problem hiding this comment.
It's better to leave the PPT-related change to the skills to keep the extensions clearer.
There was a problem hiding this comment.
Thanks for the review. This makes sense. And I’ll narrow the fix to the ppt-generation skill itself and remove the unrelated UI / middleware / built-in tool changes from this PR.
|
|
||
| @staticmethod | ||
| def _run_generate_text(plan_file: str, output_file: str) -> tuple[bool, str]: | ||
| script = get_skills_root_path() / "public" / "ppt-generation" / "scripts" / "generate_text.py" |
There was a problem hiding this comment.
@Jennifer-00 The middleware should not know about skill details; we should keep the middleware as simple as possible.
| @@ -0,0 +1,144 @@ | |||
| """Built-in tool: generate_ppt | |||
|
|
|||
| Generates a PowerPoint presentation directly from a slide plan, bypassing | |||
There was a problem hiding this comment.
@Jennifer-00 What's the difference between the generate_ppt_tool and the ppt-generations tools?
Please don't introduce the same tool in different places, this kind of tool can be used in skills.
Fix issue bytedance#424 - agent does not load ppt-generation skill proactively Root cause (Lntanohuang's analysis): - Agent's strong CLARIFY → PLAN → ACT system prompt causes it to ask clarifying questions before loading the ppt-generation skill - Skill matching is fully passive (prompt-guided) — the agent must recognize and read_file SKILL.md on its own, which weaker models fail to do - PR bytedance#1171 only addressed Path B fallback for missing GEMINI_API_KEY Changes: - Add SKILL-FIRST PRIORITY section in get_skills_prompt_section() with explicit PPT keyword table and immediate skill loading directive - Add 'Skill-First Priority' reminder in critical_reminders section - Specify exact skill path /mnt/skills/public/ppt-generation/SKILL.md - Instruct agent to NOT ask clarification (style/slide count) — skill has reasonable defaults and handles parameters itself - Bilingual keywords: English + Chinese (幻灯片, 生成PPT, 制作PPT) This makes PPT generation requests recognized and acted upon immediately, bypassing the CLARIFY step that caused re-planning loops.
Description
Fixes #424
Summary
This PR fixes PPT generation failures when API-based image generation is unavailable, and improves stability of PPT output across multi-turn conversations.
Root cause
Previously, PPT generation effectively depended on a single path (Path A), which required
GEMINI_API_KEY(image-based generation flow).When
GEMINI_API_KEYwas not configured (or Path A failed), the run could end without a generated.pptxartifact.What this PR changes
python-pptx) that does not require external image API keys.generate_ppttool flow with stronger subprocess/output validation.PptEnforcementMiddlewarefallback to ensure a.pptxartifact is produced for PPT requests.1).MessageSizeGuardMiddlewareto reduce failures caused by oversized historical messages.<think>,<system>) in frontend message rendering.Validation
.pptxartifacts are generated under thread outputs.Notes
main.deerflow.*module paths (not legacysrc.*) after package migration.