ai-director
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAI Director - AI短剧生成全流程
AI Director - Full Workflow of AI Short Drama Generation
完整的AI短剧生成解决方案,从创意到成片,集成X2C平台账号管理和计费。
A complete AI short drama generation solution, from idea to finished video, integrated with X2C platform account management and billing.
👥 多用户支持
👥 Multi-user Support
本Skill支持多用户共享设备,每个用户拥有独立的X2C账号和配置。
用户凭证存储位置:
credentials/{USER_ID}.json调用脚本时需设置 或 环境变量:
USER_IDTELEGRAM_USER_IDbash
USER_ID=5470522468 node scripts/ad-account-manager.js check-bindingOpenClaw从聊天调用时会自动传递用户ID。
This Skill supports multi-user device sharing, each user has independent X2C account and configuration.
User credential storage path:
credentials/{USER_ID}.jsonYou need to set the or environment variable when calling the script:
USER_IDTELEGRAM_USER_IDbash
USER_ID=5470522468 node scripts/ad-account-manager.js check-bindingOpenClaw will automatically pass the user ID when calling from chat.
🎯 模块概览
🎯 Module Overview
1. Ad Account Manager(账号管理)
1. Ad Account Manager
- 功能: X2C平台账号绑定、验证
- 脚本:
scripts/ad-account-manager.js - 独立使用: ✅ 可以单独调用
- Function: X2C platform account binding, verification
- Script:
scripts/ad-account-manager.js - Independent use: ✅ Can be called separately
2. Ad Writer(编剧)
2. Ad Writer
- 功能: 从创意点子生成完整短剧脚本
- 类型: 提示词工程(Agent 读取指南后生成)
- 文档:
references/AD-WRITER-GUIDE.md - 依赖: ⚠️ 需要先绑定X2C账号
- Function: Generate complete short drama scripts from creative ideas
- Type: Prompt engineering (generated after Agent reads the guide)
- Document:
references/AD-WRITER-GUIDE.md - Dependency: ⚠️ X2C account binding required first
3. Ad Producer(视频生产)
3. Ad Producer
- 功能: 从剧本生成完整视频
- 脚本:
scripts/ad-producer.js - 依赖: ⚠️ 需要先绑定X2C账号
- Function: Generate complete video from script
- Script:
scripts/ad-producer.js - Dependency: ⚠️ X2C account binding required first
🚀 快速开始
🚀 Quick Start
第一步:获取X2C API Key
Step 1: Get X2C API Key
用户必须自行完成以下步骤:
- 打开 https://www.x2creel.ai 注册/登录账号
- 进入个人中心 → API管理 → 创建/复制 API Key
- 将 API Key 发送给我
示例对话:
用户:我想生成视频
助手:好的,需要先绑定X2C账号。请打开 https://www.x2creel.ai 登录,然后在个人中心获取API Key发给我。
用户:x2c_sk_xxx...
助手:验证通过!你的账号已绑定,现在可以开始生成视频了~Users must complete the following steps by themselves:
- Open https://www.x2creel.ai to register/login
- Go to Personal Center → API Management → Create/Copy API Key
- Send the API Key to the assistant
Sample conversation:
User: I want to generate a video
Assistant: Okay, you need to bind your X2C account first. Please open https://www.x2creel.ai to log in, then get the API Key in the personal center and send it to me.
User: x2c_sk_xxx...
Assistant: Verification passed! Your account has been bound, you can start generating videos now~第二步:验证API Key(Agent自动执行)
Step 2: Verify API Key (automatically executed by Agent)
Agent 收到 API Key 后,调用 验证有效性:
ad-account-manager.js verify-keybash
node scripts/ad-account-manager.js verify-key x2c_sk_xxx验证成功后将 key 保存到
credentials/{USER_ID}.jsonAfter the Agent receives the API Key, it calls to verify validity:
ad-account-manager.js verify-keybash
node scripts/ad-account-manager.js verify-key x2c_sk_xxxAfter successful verification, the key is saved to
credentials/{USER_ID}.json第三步:查看配置和定价
Step 3: View configuration and pricing
bash
node scripts/ad-producer.js configbash
node scripts/ad-producer.js config第四步:生成短剧
Step 4: Generate short drama
选项A - 仅编剧(Agent模式):
Agent 读取 ,根据用户创意生成剧本。
references/AD-WRITER-GUIDE.md选项B - 全流程(剧本 + 视频):
bash
node scripts/ad-producer.js full-workflow "一个程序员穿越到古代当宰相" --duration 120 --waitOption A - Scriptwriting only (Agent mode):
Agent reads and generates scripts based on user ideas.
references/AD-WRITER-GUIDE.mdOption B - Full workflow (script + video):
bash
node scripts/ad-producer.js full-workflow "A programmer travels back to ancient times to be the prime minister" --duration 120 --wait⚠️ 重要规则
⚠️ Important Rules
在用户提供有效的 X2C API Key 之前,禁止执行任何视频生成或剧本生成操作!
如果用户要求生成视频但尚未绑定账号:
- 引导用户访问 https://www.x2creel.ai
- 告知获取API Key的步骤
- 收到有效Key后才可进入制作流程
Before the user provides a valid X2C API Key, it is forbidden to perform any video generation or script generation operations!
If the user requests to generate a video but has not bound an account:
- Guide the user to visit https://www.x2creel.ai
- Inform the steps to get the API Key
- Only enter the production process after receiving a valid key
📦 Ad Account Manager(账号管理)
📦 Ad Account Manager
命令列表
Command List
bash
undefinedbash
undefined发送验证码
Send verification code
node scripts/ad-account-manager.js send-code user@example.com
node scripts/ad-account-manager.js send-code user@example.com
验证并获取 API Key
Verify and get API Key
node scripts/ad-account-manager.js verify user@example.com 123456
node scripts/ad-account-manager.js verify user@example.com 123456
检查绑定状态
Check binding status
node scripts/ad-account-manager.js check-binding
node scripts/ad-account-manager.js check-binding
查看配置选项
View configuration options
node scripts/ad-account-manager.js config
node scripts/ad-account-manager.js config
解绑账号
Unbind account
node scripts/ad-account-manager.js unbind
node scripts/ad-account-manager.js unbind
帮助
Help
node scripts/ad-account-manager.js help
undefinednode scripts/ad-account-manager.js help
undefined直接绑定(如果已有 API Key)
Direct binding (if you already have an API Key)
bash
node scripts/ad-account-manager.js bind --key "x2c_sk_<REDACTED>xxx"bash
node scripts/ad-account-manager.js bind --key "x2c_sk_<REDACTED>xxx"🎭 Ad Character Manager(角色管理)
🎭 Ad Character Manager
管理自定义角色,可在视频制作中用作主角。制作时系统会根据性别自动匹配角色与剧本中的人物。
注意: 每个用户最多 5 个角色。
Manage custom characters that can be used as protagonists in video production. During production, the system will automatically match characters with the characters in the script according to gender.
Note: Each user can have up to 5 characters.
命令列表
Command List
bash
undefinedbash
undefined查询角色列表
Query character list
node scripts/ad-character-manager.js list
node scripts/ad-character-manager.js list
创建角色
Create character
node scripts/ad-character-manager.js create <name> <gender> <image_url>
node scripts/ad-character-manager.js create <name> <gender> <image_url>
删除角色
Delete character
node scripts/ad-character-manager.js delete <character_id>
node scripts/ad-character-manager.js delete <character_id>
帮助
Help
node scripts/ad-character-manager.js help
undefinednode scripts/ad-character-manager.js help
undefined参数说明
Parameter Description
| 参数 | 说明 | 必填 | 选项 |
|---|---|---|---|
| name | 角色显示名称 | ✅ | - |
| gender | 性别 | ✅ | male, female, other |
| image_url | 角色图片的公开 URL(最大 10MB) | ✅ | - |
| Parameter | Description | Required | Options |
|---|---|---|---|
| name | Character display name | ✅ | - |
| gender | Gender | ✅ | male, female, other |
| image_url | Public URL of character image (max 10MB) | ✅ | - |
使用示例
Usage Example
bash
undefinedbash
undefined查看当前角色
View current characters
node scripts/ad-character-manager.js list
node scripts/ad-character-manager.js list
创建女性角色
Create female character
node scripts/ad-character-manager.js create Alice female https://example.com/alice.png
node scripts/ad-character-manager.js create Alice female https://example.com/alice.png
创建男性角色
Create male character
node scripts/ad-character-manager.js create Bob male https://example.com/bob.png
node scripts/ad-character-manager.js create Bob male https://example.com/bob.png
删除角色
Delete character
node scripts/ad-character-manager.js delete <uuid>
undefinednode scripts/ad-character-manager.js delete <uuid>
undefinedAPI 接口
API Interface
| Action | 说明 |
|---|---|
| character/list | 查询角色列表 |
| character/create | 创建角色 |
| character/delete | 删除角色 |
| Action | Description |
|---|---|
| character/list | Query character list |
| character/create | Create character |
| character/delete | Delete character |
✍️ Ad Writer(编剧)
✍️ Ad Writer
这是提示词工程模块,AI Agent 读取指南后自己生成剧本。
This is a prompt engineering module, the AI Agent generates the script by itself after reading the guide.
功能特性
Features
- 斯皮尔伯格风格: 温情人性、视觉诗意、情感共鸣
- 三线并行: 当下故事线、前史线、反派/外因线
- 工业化流程: 严格遵循短剧市场物理生产限制
- 完整剧本结构: 剧名、梗概、人物小传、大纲、分集、正集
- Spielberg style: Warm humanity, visual poetry, emotional resonance
- Three parallel storylines: current storyline, pre-history line, villain/external factor line
- Industrial process: Strictly follow the physical production limits of the short drama market
- **Complete script structure: drama name, synopsis, character biography, outline, episode breakdown, full script
使用方式
Usage
Agent 工作流程:
- 读取 (完整编剧指南)
references/AD-WRITER-GUIDE.md - 根据用户创意,按指南生成剧本
- 输出六部分完整剧本
用户指令示例:
帮我写一个短剧剧本:一个程序员意外拯救了CEO,却不知道对方的真实身份Agent workflow:
- Read (complete scriptwriting guide)
references/AD-WRITER-GUIDE.md - Generate the script according to the user's idea and the guide
- Output the complete script in six parts
Sample user instruction:
Write me a short drama script: a programmer accidentally saves the CEO, but doesn't know the other person's real identity输出内容
Output Content
- 剧名
- 一句话梗概
- 人物小传
- 故事大纲
- 分集概况(1-30集)
- 剧本正集(完整台词和镜头描述)
- Drama name
- One-sentence synopsis
- Character biography
- Story outline
- Episode overview (1-30 episodes)
- Full script (complete lines and shot descriptions)
🎬 Ad Producer(视频生产)
🎬 Ad Producer
命令列表
Command List
bash
undefinedbash
undefined查看配置和定价
View configuration and pricing
node scripts/ad-producer.js config
node scripts/ad-producer.js config
生成剧本
Generate script
node scripts/ad-producer.js generate-script "你的创意" --wait
node scripts/ad-producer.js generate-script "your idea" --wait
查询剧本状态
Query script status
node scripts/ad-producer.js script-status <project_id>
node scripts/ad-producer.js script-status <project_id>
生产视频
Produce video
node scripts/ad-producer.js produce-video <project_id> 1 --wait
node scripts/ad-producer.js produce-video <project_id> 1 --wait
查询视频进度
Query video progress
node scripts/ad-producer.js video-status <project_id> 1
node scripts/ad-producer.js video-status <project_id> 1
全流程(推荐)
Full workflow (recommended)
node scripts/ad-producer.js full-workflow "创意描述" --duration 120
undefinednode scripts/ad-producer.js full-workflow "idea description" --duration 120
undefined生成选项
Generation Options
| 参数 | 说明 | 默认值 |
|---|---|---|
| --mode | short_video / short_drama | short_video |
| --duration | 60 / 120 / 180 / 300 | 120 |
| --ratio | 9:16 / 16:9 | 9:16 |
| --style | 风格名称 | - |
| --episodes | 集数(固定值,不可用户自定义) | short_video=1, short_drama=10 |
| --language | zh / en | zh |
| --character-ids | 角色UUID数组(逗号分隔),用作主角 | - |
| --wait | 等待完成 | false |
| Parameter | Description | Default Value |
|---|---|---|
| --mode | short_video / short_drama | short_video |
| --duration | 60 / 120 / 180 / 300 | 120 |
| --ratio | 9:16 / 16:9 | 9:16 |
| --style | Style name | - |
| --episodes | Number of episodes (fixed value, cannot be customized by users) | short_video=1, short_drama=10 |
| --language | zh / en | zh |
| --character-ids | Array of character UUIDs (comma separated), used as protagonists | - |
| --wait | Wait for completion | false |
成本
Cost
| 项目 | 积分 | 美元 |
|---|---|---|
| 剧本(short_video) | 10 | $0.1 |
| 剧本(short_drama) | 100 | $1 |
| 视频 60s | 299 | $2.99 |
| 视频 120s | 599 | $5.99 |
| 视频 180s | 799 | $7.99 |
| 视频 300s | 999 | $9.99 |
| Item | Credits | USD |
|---|---|---|
| Script (short_video) | 10 | $0.1 |
| Script (short_drama) | 100 | $1 |
| Video 60s | 299 | $2.99 |
| Video 120s | 599 | $5.99 |
| Video 180s | 799 | $7.99 |
| Video 300s | 999 | $9.99 |
🔄 完整工作流程
🔄 Complete Workflow
方案A:分步执行
Option A: Step-by-step execution
bash
undefinedbash
undefined1. 绑定账号(首次使用)
1. Bind account (first use)
node scripts/ad-account-manager.js send-code your@email.com
node scripts/ad-account-manager.js verify your@email.com 123456
node scripts/ad-account-manager.js send-code your@email.com
node scripts/ad-account-manager.js verify your@email.com 123456
2. 查看定价
2. View pricing
node scripts/ad-producer.js config
node scripts/ad-producer.js config
3. 生成剧本
3. Generate script
node scripts/ad-producer.js generate-script "一个程序员穿越古代" --wait
node scripts/ad-producer.js generate-script "A programmer travels back to ancient times" --wait
→ 获得 project_id
→ Get project_id
4. 生产视频
4. Produce video
node scripts/ad-producer.js produce-video <project_id> 1 --wait
undefinednode scripts/ad-producer.js produce-video <project_id> 1 --wait
undefined方案B:一键自动化
Option B: One-click automation
bash
node scripts/ad-producer.js full-workflow "一个程序员穿越到古代当宰相" \
--mode short_video \
--duration 120 \
--ratio 9:16bash
node scripts/ad-producer.js full-workflow "A programmer travels back to ancient times to be the prime minister" \
--mode short_video \
--duration 120 \
--ratio 9:16⚙️ 配置文件
⚙️ Configuration File
config.jsonjson
{
"x2cApiKey": "x2c_sk_<REDACTED>your_api_key_here",
"x2cEmail": "your@email.com",
"x2cUserId": "user-uuid"
}config.jsonjson
{
"x2cApiKey": "x2c_sk_<REDACTED>your_api_key_here",
"x2cEmail": "your@email.com",
"x2cUserId": "user-uuid"
}🛡️ 安全与隐私
🛡️ Security & Privacy
- API keys 存储在本地
config.json - 显示时自动脱敏
- 所有API调用使用 HTTPS
- API keys are stored locally in
config.json - Automatic desensitization when displayed
- All API calls use HTTPS
🔧 故障排查
🔧 Troubleshooting
账号未绑定
Account not bound
❌ X2C Account Not Bound解决方案:
bash
node scripts/ad-account-manager.js send-code your@email.com
node scripts/ad-account-manager.js verify your@email.com <code>❌ X2C Account Not BoundSolution:
bash
node scripts/ad-account-manager.js send-code your@email.com
node scripts/ad-account-manager.js verify your@email.com <code>积分不足
Insufficient credits
❌ Error: Insufficient credits解决方案:
访问 https://x2creel.ai 充值
❌ Error: Insufficient creditsSolution:
Visit https://x2creel.ai to recharge
API Key 无效
Invalid API Key
❌ Error: Invalid or missing API key解决方案:
bash
node scripts/ad-account-manager.js unbind
node scripts/ad-account-manager.js send-code your@email.com❌ Error: Invalid or missing API keySolution:
bash
node scripts/ad-account-manager.js unbind
node scripts/ad-account-manager.js send-code your@email.com📊 X2C Open API
📊 X2C Open API
Base URL:
https://eumfmgwxwjyagsvqloac.supabase.co/functions/v1/open-apiBase URL:
https://eumfmgwxwjyagsvqloac.supabase.co/functions/v1/open-api接口列表
Interface List
| Action | 说明 |
|---|---|
| auth/send-code | 发送验证码 |
| auth/verify | 验证获取 API Key |
| config/get-options | 获取配置选项 |
| character/list | 查询角色列表 |
| character/create | 创建角色 |
| character/delete | 删除角色 |
| script/generate | 生成剧本 |
| script/query | 查询剧本状态 |
| video/produce | 生产视频 |
| video/query | 查询视频进度 |
详细 API 文档见
references/X2C-OPEN-API.md| Action | Description |
|---|---|
| auth/send-code | Send verification code |
| auth/verify | Verify to get API Key |
| config/get-options | Get configuration options |
| character/list | Query character list |
| character/create | Create character |
| character/delete | Delete character |
| script/generate | Generate script |
| script/query | Query script status |
| video/produce | Produce video |
| video/query | Query video progress |
For detailed API documentation, see
references/X2C-OPEN-API.md📚 文档参考
📚 Document Reference
- 编剧指南:
references/AD-WRITER-GUIDE.md - 剧本示例:
references/example.md - X2C API:
references/X2C-OPEN-API.md
- Scriptwriting Guide:
references/AD-WRITER-GUIDE.md - Script Example:
references/example.md - X2C API:
references/X2C-OPEN-API.md
🎓 最佳实践
🎓 Best Practices
成本优化
Cost Optimization
-
先用 short_video 测试
- 60s 视频成本低(299 积分)
- 确认风格满意后再做长视频
-
选择合适的时长
- 60s: 简短宣传片
- 120s: 标准短剧(推荐)
- 180s-300s: 完整剧情
-
Test with short_video first
- 60s video cost is low (299 credits)
- Confirm the style is satisfactory before making long videos
-
Choose the appropriate duration
- 60s: Short promotional video
- 120s: Standard short drama (recommended)
- 180s-300s: Complete plot
提高成功率
Improve Success Rate
-
创意要清晰具体
- 明确主角、背景、冲突
- 避免过于抽象的描述
-
选择合适的风格
- 用 命令查看可用风格
config - 3D古风、现代都市等
- 用
适用场景: 商业化部署、付费短剧生成服务、B端创作工具
-
Clear and specific ideas
- Clear protagonist, background, conflict
- Avoid too abstract descriptions
-
Choose the right style
- Use the command to view available styles
config - 3D ancient style, modern urban, etc.
- Use the
Applicable scenarios: Commercial deployment, paid short drama generation service, B-side creation tools
🔍 Quality Evaluator(质量评估)
🔍 Quality Evaluator
使用 Gemini 2.0 Flash 分析视频质量,按标准打分。
Use Gemini 2.0 Flash to analyze video quality and score according to standards.
评估维度
Evaluation Dimensions
维度一:单片段质量 (100分)
| 指标 | 权重 | 说明 |
|---|---|---|
| 时空一致性 | 35% | 主体特征在镜头内保持稳定 |
| 动态动力学 | 30% | 运动符合物理规律,无跳帧 |
| 视觉纯净度 | 20% | 纹理清晰,无 AI 噪点 |
| 光影交互 | 15% | 阴影随物体运动同步变化 |
维度二:合成视频质量 (100分)
| 指标 | 权重 | 说明 |
|---|---|---|
| 视觉流一致性 | 30% | 镜头间色调匹配 |
| 剪辑节奏感 | 25% | 转场自然,匹配 BGM |
| 叙事匹配度 | 25% | 准确传达剧本剧情 |
| 音画同步率 | 20% | 音效与视觉契合 |
Dimension 1: Single clip quality (100 points)
| Indicator | Weight | Description |
|---|---|---|
| Spatio-temporal consistency | 35% | Subject characteristics remain stable in the shot |
| Dynamic dynamics | 30% | Motion conforms to physical laws, no frame skipping |
| Visual purity | 20% | Clear texture, no AI noise |
| Light and shadow interaction | 15% | Shadows change synchronously with object movement |
Dimension 2: Composite video quality (100 points)
| Indicator | Weight | Description |
|---|---|---|
| Visual flow consistency | 30% | Color tone matching between shots |
| Editing rhythm | 25% | Natural transitions, matching BGM |
| Narrative matching degree | 25% | Accurately convey the script plot |
| Audio and video synchronization rate | 20% | Sound effects fit the vision |
使用方式
Usage
bash
undefinedbash
undefined评估单个视频
Evaluate a single video
node scripts/quality-evaluator.js <video_url> --prompt "原始提示词"
node scripts/quality-evaluator.js <video_url> --prompt "original prompt"
JSON 输出
JSON output
node scripts/quality-evaluator.js <video_url> --json
undefinednode scripts/quality-evaluator.js <video_url> --json
undefined输出示例
Output Example
json
{
"total_score": 75,
"pass": false,
"issues": ["人物面部不一致", "光影不自然"],
"suggestions": ["简化角色描述", "明确光源方向"],
"prompt_improvements": "改进后的提示词..."
}json
{
"total_score": 75,
"pass": false,
"issues": ["Inconsistent character faces", "Unnatural light and shadow"],
"suggestions": ["Simplify character description", "Clarify light source direction"],
"prompt_improvements": "Improved prompt..."
}🔄 Auto-Iterate(自动迭代)
🔄 Auto-Iterate
自动评估 + 改进提示词 + 重新生成,直到质量达标。
Automatic evaluation + prompt improvement + re-generation until the quality meets the standard.
规则
Rules
- 及格线: 80 分
- 最大迭代: 5 次
- 每次迭代:生成 → 评估 → 如果不及格则改进提示词重试
- Pass line: 80 points
- Maximum iterations: 5 times
- Each iteration: generate → evaluate → if failed, improve the prompt and try again
使用方式
Usage
bash
node scripts/auto-iterate.js "你的创意" \
--duration 60 \
--style "吉卜力" \
--threshold 80 \
--max-iterations 5bash
node scripts/auto-iterate.js "your idea" \
--duration 60 \
--style "Ghibli" \
--threshold 80 \
--max-iterations 5配置要求
Configuration Requirements
config.jsonjson
{
"x2cApiKey": "x2c_sk_<REDACTED>xxx",
"geminiApiKey": "your_gemini_api_key"
}适用场景: 商业化部署、付费短剧生成服务、B端创作工具
config.jsonjson
{
"x2cApiKey": "x2c_sk_<REDACTED>xxx",
"geminiApiKey": "your_gemini_api_key"
}Applicable scenarios: Commercial deployment, paid short drama generation service, B-side creation tools
📋 用户参数确认格式(强制)
📋 User Parameter Confirmation Format (Mandatory)
当用户要求创建视频时,必须用文字让用户直接回复选项来确认参数。必须等用户确认全部参数后才能开始生成:
📋 参数确认
请回复你的选择:
🎬 模式:短剧(10集) 或 短视频(1集)
⏱️ 时长/价格:60秒/299、120秒/599、180秒/799、300秒/999
📐 比例:竖屏(9:16) 或 横屏(16:9)
🎨 风格:3D古风 / 2D漫剧 / 吉卜力 / 皮克斯 / 写实 / 二次元 / 国风水墨
📂 分类:玄幻 / 悬疑 / 科幻 / 都市 / 热门 / 霸总 / 仙侠
例如:「短剧、180秒、竖屏、3D古风、仙侠」
**语言**: 中文 / EnglishWhen a user requests to create a video, you must use text to let the user directly reply to the option to confirm the parameters. You must wait for the user to confirm all parameters before starting generation:
📋 Parameter Confirmation
Please reply with your choice:
🎬 Mode: Short drama (10 episodes) or Short video (1 episode)
⏱️ Duration/Price: 60s/299, 120s/599, 180s/799, 300s/999
📐 Ratio: Vertical (9:16) or Horizontal (16:9)
🎨 Style: 3D ancient style / 2D comic drama / Ghibli / Pixar / Realistic / Anime / Chinese ink wash
📂 Category: Fantasy / Suspense / Sci-fi / Urban / Popular / CEO romance / Xianxia
Example: "Short drama, 180s, vertical, 3D ancient style, Xianxia"
**Language**: Chinese / English⚡ 异步任务处理(重要!)
⚡ Asynchronous Task Processing (Important!)
当用户要求生成视频时,必须使用异步方式,不要等待完成!
When a user requests to generate a video, you must use asynchronous mode, do not wait for completion!
流程:
Process:
- 启动任务,不等待
bash
undefined- Start the task, do not wait
bash
undefined启动视频生成,返回project_id
Start video generation, return project_id
USER_ID=$USER_ID node scripts/ad-producer.js full-workflow "主题" --mode short_video --duration 60 --style "风格" --language zh
2. **添加任务到跟踪列表**(必须!)
```bashUSER_ID=$USER_ID node scripts/ad-producer.js full-workflow "theme" --mode short_video --duration 60 --style "style" --language zh
2. **Add task to tracking list (Mandatory!)**
```bash视频开始生成后,立即调用:
Immediately call after the video starts generating:
/opt/storyclaw/add-video-task.sh "$USER_ID" "$project_id" "$CHAT_ID"
/opt/storyclaw/add-video-task.sh "$USER_ID" "$project_id" "$CHAT_ID"
参数: user_id, project_id, chat_id (Telegram用户ID)
Parameters: user_id, project_id, chat_id (Telegram user ID)
3. **完成后自动通知**
- cron job每2分钟检查一次 /tmp/active-video-tasks.json
- 完成后自动发送消息通知用户
3. **Automatic notification after completion**
- Cron job checks /tmp/active-video-tasks.json every 2 minutes
- Automatically send a message to notify the user after completion关键点:
Key points:
- 不要用 --wait 参数,会阻塞
- 启动任务后立即返回"正在生成,稍等"
- 必须调用 add-video-task.sh 添加任务到跟踪列表
- 创建cron job监控进度
- 完成后通过对应渠道通知用户
用户创建短剧时,以下5个参数只能从配置选项中选取,不允许自定义值:
- 模式: 或
short_videoshort_drama - 时长: /
60/120/180300 - 比例: 或
9:1616:9 - 风格: /
3D古风/2D漫剧/吉卜力/皮克斯/写实风格/二次元国风水墨 - 分类:
- 中文: /
玄幻异能/悬疑惊悚/科幻末世/都市复仇/热门综合/霸总甜宠仙侠古装 - 英文: /
Werewolf & Shifter/Suspense & Horror/Power & Revenge/Sweet & CEO/Magic & FantasyAI Drama Lab
- 中文:
如果用户提供的任何一项不在配置列表中,必须提示用户从列表中重新选择,不得自行替换或忽略。
集数规则(强制):
- → 固定1集,不询问用户
short_video - → 固定10集,不询问用户
short_drama - 不允许用户自定义集数,引导流程中不展示集数选项
- Do not use --wait parameter, it will block
- Return "Generating, please wait" immediately after starting the task
- Must call add-video-task.sh to add the task to the tracking list
- Create a cron job to monitor progress
- Notify users through the corresponding channel after completion
When a user creates a short drama, the following 5 parameters can only be selected from the configuration options, custom values are not allowed:
- Mode: or
short_videoshort_drama - Duration: /
60/120/180300 - Ratio: or
9:1616:9 - Style: /
3D ancient style/2D comic drama/Ghibli/Pixar/Realistic/AnimeChinese ink wash - Category:
- Chinese: /
Fantasy power/Suspense thriller/Sci-fi apocalypse/Urban revenge/Popular comprehensive/CEO romanceXianxia ancient costume - English: /
Werewolf & Shifter/Suspense & Horror/Power & Revenge/Sweet & CEO/Magic & FantasyAI Drama Lab
- Chinese:
If any item provided by the user is not in the configuration list, you must prompt the user to reselect from the list, and you are not allowed to replace or ignore it yourself.
Episode rule (Mandatory):
- → Fixed 1 episode, do not ask the user
short_video - → Fixed 10 episodes, do not ask the user
short_drama - Users are not allowed to customize the number of episodes, and the episode option is not displayed in the guidance process
🎬 视频生产流程(强制)
🎬 Video Production Process (Mandatory)
重要规则:同一集只能发起一次制作
Important rule: Only one production can be initiated for the same episode
每个episode只能提交一次 命令!
produce-video- ✅ 可以多次查询
video-status - ❌ 不能重复提交
produce-video
如果任务失败,等待第三方系统修复,不要重复提交。
Only one command can be submitted per episode!
produce-video- ✅ Can query multiple times
video-status - ❌ Cannot submit repeatedly
produce-video
If the task fails, wait for the third-party system to fix it, do not submit repeatedly.
short_video (1集)
short_video (1 episode)
1. 生成剧本
2. 视频生成 → 完成后通知用户1. Generate script
2. Video generation → Notify user after completionshort_drama (10集) - 必须逐集生产
short_drama (10 episodes) - Must be produced episode by episode
1. 生成剧本 (10集)
2. 等待剧本完成
3. EP1 视频生成 → 等待完成
4. EP2 视频生成 → 等待完成
5. EP3 视频生成 → 等待完成
...
10. EP10 视频生成 → 等待完成
11. 全部完成 → 通知用户关键点:
- 必须等上一集完成后再开始下一集,不能并行
- 每集生成完成后记录状态
- 全部10集完成后统一通知用户
调用 API可获取最新配置列表(风格和分类可能会更新)。
config/get-options1. Generate script (10 episodes)
2. Wait for script completion
3. EP1 video generation → Wait for completion
4. EP2 video generation → Wait for completion
5. EP3 video generation → Wait for completion
...
10. EP10 video generation → Wait for completion
11. All completed → Notify userKey points:
- Must wait for the previous episode to complete before starting the next one, cannot be parallel
- Record status after each episode is generated
- Notify the user uniformly after all 10 episodes are completed
Call the API to get the latest configuration list (styles and categories may be updated).
config/get-options⚠️ Agent 输出规范
⚠️ Agent Output Specification
- 链接必须完整输出,不得截断(视频 URL 带签名很长,但必须完整)
- 使用代码块 ``` 包裹长链接,避免被聊天软件截断
- 关键信息(Project ID、Video URL)必须清晰展示
- Links must be output completely, not truncated (video URLs with signatures are very long, but must be complete)
- Use code blocks ``` to wrap long links to avoid being truncated by chat software
- Key information (Project ID, Video URL) must be clearly displayed
📢 视频完成通知规则
📢 Video Completion Notification Rule
短剧(10集)模式下,当前集完成后必须询问用户是否继续制作下一集!
当一集视频生成完成后:
- 展示视频链接
- 展示本集积分消耗
- 询问用户是否继续制作下一集
示例回复:
🎉 视频生成完成!
📊 积分消耗:599积分
继续制作下一集吗?
- 是,继续EP3
- 暂时停止注意:
- short_video (1集) 无需询问
- 短剧模式必须询问
- 用户选择"是"后,再发起下一集的制作
In short drama (10 episodes) mode, you must ask the user whether to continue producing the next episode after the current episode is completed!
When an episode video is generated:
- Display the video link
- Display the credit consumption of this episode
- Ask the user whether to continue producing the next episode
Sample reply:
🎉 Video generation completed!
📊 Credit consumption: 599 credits
Continue to produce the next episode?
- Yes, continue EP3
- Pause for nowNote:
- No need to ask for short_video (1 episode)
- Must ask for short drama mode
- After the user selects "Yes", initiate the production of the next episode
⚠️ 视频失败处理规则
⚠️ Video Failure Handling Rule
视频生成失败后,禁止自动重试生成!
原因:每次生成都会扣除用户积分,自动重试会导致额外扣费。
处理流程:
- 查询失败原因(通过 命令查看 status 和 progress)
video-status - 将失败原因告知用户
- 等待用户指示是否重试或调整参数
示例回复:
❌ 视频生成失败
原因: 人物生成失败 (character step failed at 14%)
当前余额: 20,013 积分
请选择:
- 重试生成(将从余额中扣除相应积分)
- 更换风格/参数后重试
- 取消任务After video generation fails, automatic retry generation is prohibited!
Reason: Each generation will deduct user credits, automatic retry will lead to additional deductions.
Handling process:
- Query the failure reason (view status and progress through the command)
video-status - Inform the user of the failure reason
- Wait for the user's instruction to retry or adjust parameters
Sample reply:
❌ Video generation failed
Reason: Character generation failed (character step failed at 14%)
Current balance: 20,013 credits
Please choose:
- Retry generation (corresponding credits will be deducted from the balance)
- Retry after changing style/parameters
- Cancel task🔄 多集短剧生产规则(short_drama)
🔄 Multi-episode Short Drama Production Rule (short_drama)
视频必须逐集生产,不能同时启动多集。 流程:
- 生成剧本时必须传 参数(如
total_episodes),否则只会生成1集"total_episodes": 10 - 调用 启动第1集视频制作
video/produce - 轮询第1集状态,等待完成
- 第1集完成后,调用 启动第2集
video/produce - 重复直到所有集完成
- 每集完成后通知用户进度(如 "EP3/10 完成")
- 全部完成后发送总积分报告
Videos must be produced episode by episode, multiple episodes cannot be started at the same time. Process:
- Must pass the parameter when generating the script (e.g.
total_episodes), otherwise only 1 episode will be generated"total_episodes": 10 - Call to start the production of the first episode video
video/produce - Poll the status of the first episode, wait for completion
- After the first episode is completed, call to start the second episode
video/produce - Repeat until all episodes are completed
- Notify the user of the progress after each episode is completed (e.g. "EP3/10 completed")
- Send a total credit report after all are completed
🎬 视频播放优化
🎬 Video Playback Optimization
CDN返回的视频URL末尾带有 ,会导致浏览器强制下载而非播放。
&response-content-disposition=attachment规则:拿到视频URL后,必须去掉 参数,然后可以直接在浏览器中播放,无需下载到本地。
&response-content-disposition=attachment流程:
- 获取视频URL(从 命令)
video-status - 去掉
&response-content-disposition=attachment - 直接 到清理后的URL → 即可播放
browser navigate - 询问用户是否需要下载视频(默认不下载,只播放)
- 如用户要下载/发送到Telegram:下载+压缩到16MB以下(480p, crf 32)再发送
The video URL returned by CDN has at the end, which will cause the browser to force download instead of playing.
&response-content-disposition=attachmentRule: After getting the video URL, you must remove the parameter, then it can be played directly in the browser without downloading to the local.
&response-content-disposition=attachmentProcess:
- Get the video URL (from the command)
video-status - Remove
&response-content-disposition=attachment - Directly to the cleaned URL → can be played
browser navigate - Ask the user if they need to download the video (no download by default, only play)
- If the user wants to download/send to Telegram: download + compress to below 16MB (480p, crf 32) before sending
📱 WebChat 消息推送
📱 WebChat Message Push
WebChat 是 StoryClaw 设备的网页聊天渠道,通过 脚本推送消息。
webchat-stream-ws.shWebChat is the web chat channel of StoryClaw devices, which pushes messages through the script.
webchat-stream-ws.sh脚本位置
Script Location
/opt/storyclaw/webchat-stream-ws.sh/opt/storyclaw/webchat-stream-ws.sh使用方法
Usage
bash
undefinedbash
undefined发送新消息(INSERT 模式)
Send new message (INSERT mode)
webchat-stream-ws.sh <user_id> --file <message_file> <agent_id>
webchat-stream-ws.sh <user_id> --file <message_file> <agent_id>
更新现有消息(UPDATE 模式)
Update existing message (UPDATE mode)
webchat-stream-ws.sh <user_id> --update <message_id> --file <message_file> <agent_id>
undefinedwebchat-stream-ws.sh <user_id> --update <message_id> --file <message_file> <agent_id>
undefined参数说明
Parameter Description
| 参数 | 说明 |
|---|---|
| user_id | WebChat 用户 ID(32位hex) |
| message_id | 已有消息的 ID,用于更新 |
| message_file | 包含消息内容的文件路径(必须用 --file 传递,避免 $ 符号丢失) |
| agent_id | 目标 agent ID(如 |
| Parameter | Description |
|---|---|
| user_id | WebChat user ID (32-bit hex) |
| message_id | Existing message ID, used for update |
| message_file | File path containing message content (must be passed with --file to avoid loss of $ symbol) |
| agent_id | Target agent ID (e.g. |
示例
Example
bash
undefinedbash
undefined1. 发送确认消息并获取 message_id
1. Send confirmation message and get message_id
echo "正在生成视频..." > /tmp/msg.txt
MSG_ID=$(webchat-stream-ws.sh "180d08e23cdac976b4" --file /tmp/msg.txt "director")
echo "Message ID: $MSG_ID"
echo "Generating video..." > /tmp/msg.txt
MSG_ID=$(webchat-stream-ws.sh "180d08e23cdac976b4" --file /tmp/msg.txt "director")
echo "Message ID: $MSG_ID"
2. 任务完成后更新消息
2. Update message after task completion
echo "✅ 视频生成完成!" > /tmp/result.txt
webchat-stream-ws.sh "180d08e23cdac976b4" --update "$MSG_ID" --file /tmp/result.txt "director"
undefinedecho "✅ Video generation completed!" > /tmp/result.txt
webchat-stream-ws.sh "180d08e23cdac976b4" --update "$MSG_ID" --file /tmp/result.txt "director"
undefined注意事项
Notes
- 必须使用 --file 模式 — 直接传文本会导致 符号丢失
$ - message_id 用于原地更新 — 避免产生多条消息
- 异步任务配合 — 视频生成等长时间任务,先发送"处理中"消息,任务完成后再 update
- Must use --file mode — passing text directly will cause loss of symbol
$ - message_id is used for in-place update — avoid generating multiple messages
- Cooperate with asynchronous tasks — for long tasks such as video generation, send a "processing" message first, then update after the task is completed
视频任务进度推送
Video Task Progress Push
使用 添加任务时,chat_id 格式决定通知渠道:
add-video-task.shbash
undefinedWhen using to add a task, the chat_id format determines the notification channel:
add-video-task.shbash
undefinedWebChat 推送(chat_id 格式:webchat:<user_id>:<agent_id>)
WebChat push (chat_id format: webchat:<user_id>:<agent_id>)
add-video-task.sh "180d08e23cdac976b4" "project-id" "webchat:180d08e23cdac976b4:director"
add-video-task.sh "180d08e23cdac976b4" "project-id" "webchat:180d08e23cdac976b4:director"
Telegram 推送(chat_id 为纯数字)
Telegram push (chat_id is pure number)
add-video-task.sh "5470522468" "project-id" "5470522468"
`check-video-tasks.sh` 会每2分钟检查任务状态,根据 chat_id 格式自动选择推送渠道。
---
**版本:** 2.1.2 (X2C Open API + WebChat 推送支持)add-video-task.sh "5470522468" "project-id" "5470522468"
`check-video-tasks.sh` will check the task status every 2 minutes, and automatically select the push channel according to the chat_id format.
---
**Version:** 2.1.2 (X2C Open API + WebChat push support)