@optima-chat/optima-agent 0.4.25 → 0.4.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -69,7 +69,8 @@
|
|
|
69
69
|
"Bash(commerce homepage create-collections:*)",
|
|
70
70
|
"Bash(commerce homepage create-featured:*)",
|
|
71
71
|
"Bash(commerce homepage create-collection-products:*)",
|
|
72
|
-
"Bash(commerce homepage create-banner:*)"
|
|
72
|
+
"Bash(commerce homepage create-banner:*)",
|
|
73
|
+
"Bash(xargs -I {} sh -c 'echo \"\"\"\"=== {} ===\"\"\"\"; head -3 /Users/verypro/optima-agent/.claude/skills/{}/SKILL.md | grep \"\"\"\"name:\"\"\"\"')"
|
|
73
74
|
],
|
|
74
75
|
"deny": [],
|
|
75
76
|
"ask": []
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ffmpeg
|
|
3
|
+
description: "Audio and video processing for e-commerce. Use when user needs to: merge audio with video (视频配音/添加背景音乐/音视频合成), compress videos (压缩视频/视频压缩), generate thumbnails (生成缩略图/视频封面), concatenate videos (视频拼接/合并视频), trim videos (视频裁切/截取片段/剪辑视频), convert formats (格式转换/转换视频)."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# FFmpeg 音视频处理
|
|
7
|
+
|
|
8
|
+
## 电商场景常用任务
|
|
9
|
+
|
|
10
|
+
### 1. 音视频合成(产品视频配音/背景音乐)
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
# 视频配背景音乐(音频较短时循环)
|
|
14
|
+
ffmpeg -i video.mp4 -stream_loop -1 -i audio.mp3 -shortest -c:v copy -c:a aac output.mp4
|
|
15
|
+
|
|
16
|
+
# 视频配音频(音频较长时截断)
|
|
17
|
+
ffmpeg -i video.mp4 -i audio.mp3 -shortest -c:v copy -c:a aac output.mp4
|
|
18
|
+
|
|
19
|
+
# 替换视频原有音频
|
|
20
|
+
ffmpeg -i video.mp4 -i new_audio.mp3 -c:v copy -c:a aac -map 0:v:0 -map 1:a:0 output.mp4
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**参数说明**:
|
|
24
|
+
- `-stream_loop -1` - 无限循环音频(直到视频结束)
|
|
25
|
+
- `-shortest` - 以最短的流为准(视频或音频)
|
|
26
|
+
- `-map 0:v:0 -map 1:a:0` - 手动选择第1个文件的视频+第2个文件的音频
|
|
27
|
+
|
|
28
|
+
### 2. 视频压缩(上传优化,保证展示质量)
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# 产品视频压缩(推荐:CRF 20,高质量)
|
|
32
|
+
ffmpeg -i product.mp4 -c:v libx264 -crf 20 -c:a aac output.mp4
|
|
33
|
+
|
|
34
|
+
# 标准压缩(CRF 23,平衡质量和大小)
|
|
35
|
+
ffmpeg -i video.mp4 -crf 23 output.mp4
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**电商场景 CRF 建议**:
|
|
39
|
+
- **18-20** - 产品主图视频(质量优先)
|
|
40
|
+
- **23** - 一般营销视频(平衡)
|
|
41
|
+
- **25-28** - 内部使用视频(文件大小优先)
|
|
42
|
+
|
|
43
|
+
### 3. 生成视频缩略图(产品封面)
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# 从5秒处生成缩略图
|
|
47
|
+
ffmpeg -i product_video.mp4 -ss 00:00:05 -frames:v 1 thumbnail.jpg
|
|
48
|
+
|
|
49
|
+
# 批量生成所有产品视频的缩略图
|
|
50
|
+
for video in *.mp4; do
|
|
51
|
+
ffmpeg -i "$video" -ss 00:00:05 -frames:v 1 "${video%.mp4}_thumb.jpg"
|
|
52
|
+
done
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### 4. 视频拼接(多个片段合并)
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# 创建拼接列表文件
|
|
59
|
+
cat > concat_list.txt << 'EOF'
|
|
60
|
+
file 'video1.mp4'
|
|
61
|
+
file 'video2.mp4'
|
|
62
|
+
file 'video3.mp4'
|
|
63
|
+
EOF
|
|
64
|
+
|
|
65
|
+
# 拼接视频(所有视频参数相同时,快速无损)
|
|
66
|
+
ffmpeg -f concat -safe 0 -i concat_list.txt -c copy output.mp4
|
|
67
|
+
|
|
68
|
+
# 拼接视频(参数不同时,重新编码)
|
|
69
|
+
ffmpeg -f concat -safe 0 -i concat_list.txt -c:v libx264 -crf 20 -c:a aac output.mp4
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**参数说明**:
|
|
73
|
+
- `-f concat` - 使用 concat 分离器
|
|
74
|
+
- `-safe 0` - 允许不安全的文件路径(本地文件需要)
|
|
75
|
+
- `-c copy` - 无损拼接(仅当所有视频格式完全相同)
|
|
76
|
+
|
|
77
|
+
### 5. 视频裁切(截取指定片段)
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# 从第10秒开始,截取30秒
|
|
81
|
+
ffmpeg -i video.mp4 -ss 00:00:10 -t 30 -c copy output.mp4
|
|
82
|
+
|
|
83
|
+
# 从第10秒到第40秒
|
|
84
|
+
ffmpeg -i video.mp4 -ss 00:00:10 -to 00:00:40 -c copy output.mp4
|
|
85
|
+
|
|
86
|
+
# 去掉前5秒(从第5秒到结尾)
|
|
87
|
+
ffmpeg -i video.mp4 -ss 00:00:05 -c copy output.mp4
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**参数说明**:
|
|
91
|
+
- `-ss HH:MM:SS` - 开始时间
|
|
92
|
+
- `-t <秒数>` - 持续时长
|
|
93
|
+
- `-to HH:MM:SS` - 结束时间
|
|
94
|
+
- `-c copy` - 无损裁切(快速)
|
|
95
|
+
|
|
96
|
+
### 6. 格式转换(确保兼容性)
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
# 快速转换(只改容器,不重新编码)
|
|
100
|
+
ffmpeg -i video.mov -c copy video.mp4
|
|
101
|
+
|
|
102
|
+
# 标准转换(重新编码)
|
|
103
|
+
ffmpeg -i video.mov -c:v libx264 -c:a aac video.mp4
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## 电商工作流程
|
|
107
|
+
|
|
108
|
+
### 场景1:产品视频配背景音乐
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# 1. 检查文件
|
|
112
|
+
ls -lh product_video.mp4 background_music.mp3
|
|
113
|
+
|
|
114
|
+
# 2. 合成(音乐循环播放)
|
|
115
|
+
ffmpeg -i product_video.mp4 -stream_loop -1 -i background_music.mp3 \
|
|
116
|
+
-shortest -c:v copy -c:a aac -b:a 192k final_video.mp4
|
|
117
|
+
|
|
118
|
+
# 3. 检查输出
|
|
119
|
+
ls -lh final_video.mp4
|
|
120
|
+
|
|
121
|
+
# 4. 告知用户:文件大小、是否需要压缩
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### 场景2:压缩产品视频后生成缩略图
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# 1. 压缩视频(保证产品展示质量)
|
|
128
|
+
ffmpeg -i raw_product.mp4 -c:v libx264 -crf 20 -c:a aac product.mp4
|
|
129
|
+
|
|
130
|
+
# 2. 生成缩略图
|
|
131
|
+
ffmpeg -i product.mp4 -ss 00:00:05 -frames:v 1 product_thumb.jpg
|
|
132
|
+
|
|
133
|
+
# 3. 告知用户文件大小变化
|
|
134
|
+
ls -lh raw_product.mp4 product.mp4
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### 场景3:批量处理多个产品视频
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
# 批量压缩并生成缩略图
|
|
141
|
+
for video in product_*.mp4; do
|
|
142
|
+
# 压缩
|
|
143
|
+
ffmpeg -i "$video" -c:v libx264 -crf 20 -c:a aac "compressed_${video}"
|
|
144
|
+
|
|
145
|
+
# 生成缩略图
|
|
146
|
+
ffmpeg -i "compressed_${video}" -ss 00:00:05 -frames:v 1 "${video%.mp4}_thumb.jpg"
|
|
147
|
+
done
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## 重要提示
|
|
151
|
+
|
|
152
|
+
### 电商场景特殊要求
|
|
153
|
+
|
|
154
|
+
- 🎨 **质量优先** - 产品视频使用 CRF 18-20,不要过度压缩
|
|
155
|
+
- 📏 **文件大小监控** - 始终告知用户处理前后的文件大小变化
|
|
156
|
+
- 🖼️ **缩略图质量** - 选择展示效果好的时间点(通常5秒处)
|
|
157
|
+
- 🎵 **音频音量** - 合成时注意背景音乐不要盖过产品解说
|
|
158
|
+
|
|
159
|
+
### 常用参数
|
|
160
|
+
|
|
161
|
+
- `-c:v copy` - 视频流无损复制(音视频合成时推荐,保持原质量)
|
|
162
|
+
- `-shortest` - 以最短流为准(音视频合成必备)
|
|
163
|
+
- `-stream_loop -1` - 循环音频(背景音乐常用)
|
|
164
|
+
- `-crf 20` - 产品视频推荐质量
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: markdown-pdf
|
|
3
|
+
description: "Markdown to PDF conversion. Use when user needs to: export documents (导出成PDF/生成PDF/转换成PDF), create reports (保存为PDF), save as PDF (Export to PDF)."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Markdown → PDF 转换
|
|
7
|
+
|
|
8
|
+
## 标准命令格式
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
md-to-pdf <input.md> \
|
|
12
|
+
--launch-options '{"args":["--no-sandbox","--disable-setuid-sandbox","--disable-dev-shm-usage"]}' \
|
|
13
|
+
--pdf-options '{"format":"A4","margin":"20mm","printBackground":true}'
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
**关键点**:
|
|
17
|
+
- 输出文件默认生成为 `<input>.pdf`(与输入同名,在同一目录)
|
|
18
|
+
- 支持 glob 模式批量处理:`md-to-pdf ./**/*.md`
|
|
19
|
+
- `--launch-options` 中的参数**必须包含**(Docker 容器要求)
|
|
20
|
+
|
|
21
|
+
## 常见场景
|
|
22
|
+
|
|
23
|
+
### 单个文档转换
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
md-to-pdf report.md \
|
|
27
|
+
--launch-options '{"args":["--no-sandbox","--disable-setuid-sandbox","--disable-dev-shm-usage"]}' \
|
|
28
|
+
--pdf-options '{"format":"A4","margin":"20mm","printBackground":true}'
|
|
29
|
+
|
|
30
|
+
# 输出:report.pdf(同目录)
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### 指定输出路径(使用 stdin/stdout)
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
cat document.md | md-to-pdf \
|
|
37
|
+
--launch-options '{"args":["--no-sandbox","--disable-setuid-sandbox","--disable-dev-shm-usage"]}' \
|
|
38
|
+
--pdf-options '{"format":"A4","margin":"20mm","printBackground":true}' \
|
|
39
|
+
> /home/aiuser/project/final.pdf
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### 批量转换(使用 glob)
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# 转换当前目录所有 Markdown 文件
|
|
46
|
+
md-to-pdf *.md \
|
|
47
|
+
--launch-options '{"args":["--no-sandbox","--disable-setuid-sandbox","--disable-dev-shm-usage"]}' \
|
|
48
|
+
--pdf-options '{"format":"A4","margin":"20mm","printBackground":true}'
|
|
49
|
+
|
|
50
|
+
# 递归转换所有子目录的 Markdown 文件
|
|
51
|
+
md-to-pdf ./**/*.md \
|
|
52
|
+
--launch-options '{"args":["--no-sandbox","--disable-setuid-sandbox","--disable-dev-shm-usage"]}' \
|
|
53
|
+
--pdf-options '{"format":"A4","margin":"20mm","printBackground":true}'
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## 参数选项
|
|
57
|
+
|
|
58
|
+
### --pdf-options 常用配置
|
|
59
|
+
|
|
60
|
+
| 参数 | 可选值 | 说明 |
|
|
61
|
+
|------|--------|------|
|
|
62
|
+
| format | A4, Letter, A3, Legal | 纸张大小 |
|
|
63
|
+
| margin | "20mm" 或 {"top":"20mm",...} | 页边距(支持 CSS 简写或对象) |
|
|
64
|
+
| printBackground | true/false | 打印背景色(推荐 true) |
|
|
65
|
+
| landscape | true/false | 横向/纵向 |
|
|
66
|
+
|
|
67
|
+
## 重要提示
|
|
68
|
+
|
|
69
|
+
- ⚠️ **必须使用** `--no-sandbox` 等参数(Docker 环境要求)
|
|
70
|
+
- ✅ 已安装中文字体(fonts-noto-cjk),支持完美渲染中文
|
|
71
|
+
- ✅ 已安装 Emoji 字体(fonts-noto-color-emoji)
|
|
72
|
+
- 📝 支持完整 Markdown 语法(表格、代码块、Emoji)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system-prompt.d.ts","sourceRoot":"","sources":["../../src/system-prompt.ts"],"names":[],"mappings":"AAAA,wBAAgB,eAAe,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"system-prompt.d.ts","sourceRoot":"","sources":["../../src/system-prompt.ts"],"names":[],"mappings":"AAAA,wBAAgB,eAAe,IAAI,MAAM,CAyFxC"}
|
|
@@ -15,6 +15,8 @@ export function getSystemPrompt() {
|
|
|
15
15
|
|
|
16
16
|
你是 Optima Agent,一个专业的电商运营 AI 助手。你的职责是帮助用户管理电商业务的各个方面。
|
|
17
17
|
|
|
18
|
+
**重要**:用户提到的"独立站"、"店铺"、"我的店"均指 Optima AI 自有电商平台,不是 Shopify 或其他第三方建站平台。
|
|
19
|
+
|
|
18
20
|
## 当前环境
|
|
19
21
|
|
|
20
22
|
- **当前时间**:${dateStr} ${timeStr}
|
|
@@ -34,6 +36,8 @@ export function getSystemPrompt() {
|
|
|
34
36
|
- **homepage** - 店铺首页配置(Banner、集合展示)
|
|
35
37
|
- **product-page** - 商品详情页配置
|
|
36
38
|
- **comfy** - 图像/视频生成
|
|
39
|
+
- **markdown-pdf** - Markdown 转 PDF(文档导出、报告生成)
|
|
40
|
+
- **ffmpeg** - 音视频处理(格式转换、压缩、提取音频)
|
|
37
41
|
- **ads** - Google Ads 广告投放
|
|
38
42
|
- **scout** - Amazon 选品调研
|
|
39
43
|
- **bi** - 数据分析和报表
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system-prompt.js","sourceRoot":"","sources":["../../src/system-prompt.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,eAAe;IAC7B,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IACvB,MAAM,OAAO,GAAG,GAAG,CAAC,kBAAkB,CAAC,OAAO,EAAE;QAC9C,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,MAAM;QACb,GAAG,EAAE,SAAS;QACd,OAAO,EAAE,MAAM;KAChB,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,GAAG,CAAC,kBAAkB,CAAC,OAAO,EAAE;QAC9C,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,SAAS;KAClB,CAAC,CAAC;IAEH,OAAO
|
|
1
|
+
{"version":3,"file":"system-prompt.js","sourceRoot":"","sources":["../../src/system-prompt.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,eAAe;IAC7B,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IACvB,MAAM,OAAO,GAAG,GAAG,CAAC,kBAAkB,CAAC,OAAO,EAAE;QAC9C,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,MAAM;QACb,GAAG,EAAE,SAAS;QACd,OAAO,EAAE,MAAM;KAChB,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,GAAG,CAAC,kBAAkB,CAAC,OAAO,EAAE;QAC9C,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,SAAS;KAClB,CAAC,CAAC;IAEH,OAAO;;;;;;;;;aASI,OAAO,IAAI,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkE9B,CAAC;AACF,CAAC"}
|