AI PPT Generation
This skill allows OpenClaw agents to generate ppt file, Based solely on the theme provided by the user, if possible, pictures or resource files can be provided, this tool can help generate perfect PPT files.
Setup
- 1. API Key: Ensure the BAIDUAPIKEY environment variable is set with your valid API key.
- Environment: The API key should be available in the runtime environment.
API table
| name | path | description |
|---|
| PPTThemeQuery | /v2/tools/aippt/getppttheme | Query the built-in list of PPT themes and templates |
| PPTOutlineGenerate |
/v2/tools/aippt/generate_outline |Generate a PPT outline based on the provided theme, template ID, style ID, etc|
|PPTGenerate| /v2/tools/ai
ppt/generateppt
byoutline |Generate a PPT file url based on the provided ppt outline|
Workflow
- 1. The PPTThemeQuery API executes the Python script located at INLINECODE0
- The PPTOutlineGenerate API executes the Python script located at INLINECODE1
- The PPTGenerate API executes the Python script located at INLINECODE2
- The first step is for the user to query the PPT style query interface(PPTThemeQuery) to obtain the style ID and template ID
- The second step is to use the style ID and template ID queried in the first step as parameters for generating the PPT outline and call the PPT outline generation API(PPTOutlineGenerate) to generate the outline (this API is a sse streaming return. This step depends on the first step. If the first step fails, the request can be terminated).
- The third step is to request the PPT intelligent generation API(PPTGenerate) based on the outline generated in the second step. Eventually, a PPT file is generated (the request parameter outline is returned by the outline generation interface, aggregating the sse streaming return result as the input parameter. Meanwhile, users can edit and modify the outline, but the modified outline must be in markdown format). Otherwise, a failure may occur. This step strictly depends on the second step. If the second step fails, the request can be terminated.
APIS
PPTThemeQuery API
Parameters
no parameters
Example Usage
CODEBLOCK0
PPTOutlineGenerate API
Parameters
- -
query: ppt title or user query(required) - INLINECODE4 : the url of the resource file, such as pdf, word, txt, etc.
- INLINECODE5 : the page range of the ppt file, just include enumerations, 1-10、11-20、21-30、31-40、40+
- INLINECODE6 : the layout of the ppt file, optional values: 1,2 (1: Minimalist mode, 2: Professional Mode)
- INLINECODE7 : the language option of the ppt file, optional values: zh, en (zh: Chinese, en: English)
- INLINECODE8 : the generation mode of the ppt, optional values: 1,2 (1: Intelligent touch-ups, 2: Creative Mode)
Example Usage
CODEBLOCK1
PPTGenerate API
Parameters
- -
query_id: query id from PPTOutlineGenerate API return(required) - INLINECODE10 : chat id from PPTOutlineGenerate API return(required)
- INLINECODE11 : ppt outline from PPTOutlineGenerate API return,must be in markdown format.Users can make appropriate modifications to the content, adding, modifying or deleting parts of the outline.(required)
- INLINECODE12 : user orgin query(required)
- INLINECODE13 : ppt title from PPTOutlineGenerate API return(required)
- INLINECODE14 : ppt stype id from PPTThemeQuery API return(required)
- INLINECODE15 : ppt template id from PPTThemeQuery API return(required)
- INLINECODE16 : the url of the resource file, such as pdf, word, txt, etc.
- INLINECODE17 : The path of the user-defined PPT template must be downloadable
- INLINECODE18 : the generation mode of the ppt, optional values: 1,2 (1: Intelligent touch-ups, 2: Creative Mode)
- INLINECODE19 : Information on whether to use AI-generated PPT on the last page of the generated PPT
Example Usage
CODEBLOCK2
AI PPT 生成
该技能允许OpenClaw代理生成PPT文件,仅基于用户提供的主题,如果可能的话,可以提供图片或资源文件,该工具可以帮助生成完美的PPT文件。
设置
- 1. API密钥: 确保BAIDUAPIKEY环境变量已设置为您有效的API密钥。
- 环境: API密钥应在运行时环境中可用。
API 表格
| 名称 | 路径 | 描述 |
|---|
| PPTThemeQuery | /v2/tools/aippt/getppttheme | 查询内置的PPT主题和模板列表 |
| PPTOutlineGenerate |
/v2/tools/aippt/generate_outline |根据提供的主题、模板ID、风格ID等生成PPT大纲|
|PPTGenerate| /v2/tools/ai
ppt/generateppt
byoutline |根据提供的PPT大纲生成PPT文件URL|
工作流程
- 1. PPTThemeQuery API 执行位于 scripts/pptthemelist.py 的Python脚本
- PPTOutlineGenerate API 执行位于 scripts/pptoutlinegenerate.py 的Python脚本
- PPTGenerate API 执行位于 scripts/ppt_generate.py 的Python脚本
- 第一步是用户查询PPT风格查询接口(PPTThemeQuery)以获取风格ID和模板ID
- 第二步是使用第一步查询到的风格ID和模板ID作为生成PPT大纲的参数,调用PPT大纲生成API(PPTOutlineGenerate)生成大纲(该API为SSE流式返回。此步骤依赖于第一步,如果第一步失败,可以终止请求)。
- 第三步是基于第二步生成的大纲请求PPT智能生成API(PPTGenerate)。最终生成一个PPT文件(请求参数outline由大纲生成接口返回,聚合SSE流式返回结果作为输入参数。同时,用户可以编辑修改大纲,但修改后的大纲必须为markdown格式)。否则可能会失败。此步骤严格依赖于第二步,如果第二步失败,可以终止请求。
API
PPTThemeQuery API
参数
无参数
使用示例
bash
BAIDU
APIKEY=xxx python3 scripts/ppt
themelist.py
PPTOutlineGenerate API
参数
- - query:PPT标题或用户查询(必填)
- resourceurl:资源文件的URL,如pdf、word、txt等
- pagerange:PPT文件的页数范围,仅包含枚举值,1-10、11-20、21-30、31-40、40+
- layout:PPT文件的布局,可选值:1,2(1:极简模式,2:专业模式)
- languageoption:PPT文件的语言选项,可选值:zh, en(zh:中文,en:英文)
- genmode:PPT的生成模式,可选值:1,2(1:智能润色,2:创意模式)
使用示例
bash
BAIDU
APIKEY=xxx python3 scripts/ppt
outlinegenerate.py --query 生成一个关于AI未来的PPT
PPTGenerate API
参数
- - queryid:来自PPTOutlineGenerate API返回的查询ID(必填)
- chatid:来自PPTOutlineGenerate API返回的聊天ID(必填)
- outline:来自PPTOutlineGenerate API返回的PPT大纲,必须为markdown格式。用户可以对内容进行适当修改,添加、修改或删除部分大纲。(必填)
- query:用户原始查询(必填)
- title:来自PPTOutlineGenerate API返回的PPT标题(必填)
- styleid:来自PPTThemeQuery API返回的PPT风格ID(必填)
- tplid:来自PPTThemeQuery API返回的PPT模板ID(必填)
- resourceurl:资源文件的URL,如pdf、word、txt等
- customtplurl:用户自定义PPT模板的路径,必须可下载
- genmode:PPT的生成模式,可选值:1,2(1:智能润色,2:创意模式)
- ai_info:关于在生成的PPT最后一页是否使用AI生成PPT的信息
使用示例
bash
BAIDU
APIKEY=xxx python3 scripts/ppt
generate.py --queryid xxx --chat_id xxx ...