yuanflow-cli 0.1.19 → 0.1.20

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.
package/README.md CHANGED
@@ -141,6 +141,31 @@ yuanflow-cli oss copy --source-key temp/cover.png --target-key final/cover.png -
141
141
 
142
142
  上传本地文件前必须确认用户授权,不能上传密钥、cookie、账号凭据或隐私文件。
143
143
 
144
+ ### 音视频在线转文字
145
+
146
+ `音视频在线转文字` 随 npm 包安装到 Skill bundle,用于通过 YuanFlow 在线 ASR 接口把音频或视频转成干净文本。视频输入需要先用 ffmpeg 分离音频,再上传 OSS。
147
+
148
+ 固定链路:
149
+
150
+ 1. 判断用户提交的是音频还是视频。
151
+ 2. 视频先抽取为音频,音频上传前改成英文文件名。
152
+ 3. 使用 `yuanflow-cli oss temp-upload` 上传音频。
153
+ 4. ASR 请求必须优先使用 OSS 返回的 `data.signed_url` 作为 `metadata.audio_url`,不要优先使用裸域名 `data.url`。
154
+ 5. 调用 `POST https://open.yuanchuangai.com/v1/audio/transcriptions`,模型 `doubao-asr`,`response_format=json`。
155
+ 6. 默认只返回响应里的 `text` 干净文本;用户要求时间戳时再检查响应结构,不编造时间戳。
156
+
157
+ 请求体示例:
158
+
159
+ ```json
160
+ {
161
+ "model": "doubao-asr",
162
+ "response_format": "json",
163
+ "metadata": {
164
+ "audio_url": "<OSS signed_url>"
165
+ }
166
+ }
167
+ ```
168
+
144
169
  ### 生图技能
145
170
 
146
171
  `生图技能` 随 npm 包安装到 Skill bundle。YuanFlow 主程序内优先使用受控工具 `yuanflow_image_request`,自动注入当前用户 token 并缓存返回图片。
package/package.json CHANGED
@@ -1,74 +1,73 @@
1
- {
2
- "name": "yuanflow-cli",
3
- "version": "0.1.19",
4
- "description": "YuanFlow API CLI and skill installer for supported AI coding agents.",
5
- "type": "module",
6
- "license": "MIT",
7
- "private": false,
8
- "author": "zktlove",
9
- "publishConfig": {
10
- "access": "public"
11
- },
12
- "bin": {
13
- "yuanflow-cli": "bin/yuanflow-cli.js",
14
- "yuanflow-skill": "bin/yuanflow-skill.cjs"
15
- },
16
- "scripts": {
17
- "postinstall": "node ./bin/yuanflow-skill.cjs install --postinstall",
18
- "generate": "node ./scripts/generate-registry.js",
19
- "start": "node ./bin/yuanflow-cli.js",
20
- "test": "node --test test/*.test.js tests/*.test.cjs",
21
- "pack:check": "npm pack --dry-run",
22
- "release:check": "node ./bin/yuanflow-skill.cjs release-check",
23
- "publish:help": "node ./bin/yuanflow-skill.cjs publish-help"
24
- },
25
- "files": [
26
- "bin",
27
- "src",
28
- "generated",
29
- "scripts",
30
- "lib",
31
- "skills",
32
- "README.md",
33
- "LICENSE"
34
- ],
35
- "repository": {
36
- "type": "git",
37
- "url": "git+https://github.com/zktlove/yuanflow-cli.git"
38
- },
39
- "homepage": "https://github.com/zktlove/yuanflow-cli#readme",
40
- "bugs": {
41
- "url": "https://github.com/zktlove/yuanflow-cli/issues"
42
- },
43
- "yuanflowSkill": {
44
- "skillRepo": {
45
- "owner": "zktlove",
46
- "repo": "yuanflow-skill",
47
- "ref": "main"
48
- }
49
- },
50
- "engines": {
51
- "node": ">=20"
52
- },
53
- "keywords": [
54
- "skills",
55
- "ai-agent",
56
- "codex",
57
- "claude-code",
58
- "cursor",
59
- "opencode",
60
- "github-copilot",
61
- "gemini-cli",
62
- "kimi-cli",
63
- "openclaw",
64
- "trae",
65
- "windsurf",
66
- "qoder",
67
- "qwen-code",
68
- "yuanflow-cli",
69
- "yuanflow-skill",
70
- "xiaohongshu",
71
- "douyin"
72
- ]
73
- }
74
-
1
+ {
2
+ "name": "yuanflow-cli",
3
+ "version": "0.1.20",
4
+ "description": "YuanFlow API CLI and skill installer for supported AI coding agents.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "private": false,
8
+ "author": "zktlove",
9
+ "publishConfig": {
10
+ "access": "public"
11
+ },
12
+ "bin": {
13
+ "yuanflow-cli": "bin/yuanflow-cli.js",
14
+ "yuanflow-skill": "bin/yuanflow-skill.cjs"
15
+ },
16
+ "scripts": {
17
+ "postinstall": "node ./bin/yuanflow-skill.cjs install --postinstall",
18
+ "generate": "node ./scripts/generate-registry.js",
19
+ "start": "node ./bin/yuanflow-cli.js",
20
+ "test": "node --test test/*.test.js tests/*.test.cjs",
21
+ "pack:check": "npm pack --dry-run",
22
+ "release:check": "node ./bin/yuanflow-skill.cjs release-check",
23
+ "publish:help": "node ./bin/yuanflow-skill.cjs publish-help"
24
+ },
25
+ "files": [
26
+ "bin",
27
+ "src",
28
+ "generated",
29
+ "scripts",
30
+ "lib",
31
+ "skills",
32
+ "README.md",
33
+ "LICENSE"
34
+ ],
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "git+https://github.com/zktlove/yuanflow-cli.git"
38
+ },
39
+ "homepage": "https://github.com/zktlove/yuanflow-cli#readme",
40
+ "bugs": {
41
+ "url": "https://github.com/zktlove/yuanflow-cli/issues"
42
+ },
43
+ "yuanflowSkill": {
44
+ "skillRepo": {
45
+ "owner": "zktlove",
46
+ "repo": "yuanflow-skill",
47
+ "ref": "main"
48
+ }
49
+ },
50
+ "engines": {
51
+ "node": ">=20"
52
+ },
53
+ "keywords": [
54
+ "skills",
55
+ "ai-agent",
56
+ "codex",
57
+ "claude-code",
58
+ "cursor",
59
+ "opencode",
60
+ "github-copilot",
61
+ "gemini-cli",
62
+ "kimi-cli",
63
+ "openclaw",
64
+ "trae",
65
+ "windsurf",
66
+ "qoder",
67
+ "qwen-code",
68
+ "yuanflow-cli",
69
+ "yuanflow-skill",
70
+ "xiaohongshu",
71
+ "douyin"
72
+ ]
73
+ }
@@ -11,6 +11,7 @@ YuanFlow Skill 是 `yuanflow-cli` 的 Agent Skill 仓库,用于把社媒平台
11
11
  - `生图技能/`:图片生成与编辑 Skill,优先走 YuanFlow 内置 `yuanflow_image_request`。
12
12
  - `HTML报告生成/`:单页 HTML 报告生成 Skill,内置 9 种米色留白报告模板。
13
13
  - `本地音视频转文字/`:本地 SenseVoice 音视频转文字 Skill,首次明确使用时按需下载模型。
14
+ - `音视频在线转文字/`:通过 YuanFlow 在线 ASR 接口把音频或视频转成干净文本,视频会先抽取音频并通过 OSS 中转。
14
15
  - `帐号监控/`:帐号搜索、主页资料、主页作品、历史快照、变化对比和 HTML 可视化分流 Skill。
15
16
  - `个人创作库/`:长期保存、整理、复盘和复用用户认可的自媒体合格产出物。
16
17
 
@@ -24,6 +25,7 @@ YuanFlow Skill 是 `yuanflow-cli` 的 Agent Skill 仓库,用于把社媒平台
24
25
  - 生成图片、编辑图片,并缓存返回 URL 或 base64 图片。生成图片必填 `prompt`,可选 `size / quality / style / n / response_format`;编辑图片必须通过 multipart 上传本地图片。
25
26
  - 把自媒体分析、数据复盘、文案方案、账号监控、知识梳理和执行计划生成可直接打开的单页 HTML 报告。
26
27
  - 在用户明确要求本地转写时,把本地音频或视频转成文字;视频会先抽取音频,模型和缓存都保存在 Skill 自己目录下。
28
+ - 在用户要求在线转写、云端转写或 doubao-asr 时,把本地音频或视频经 OSS 中转后提交在线 ASR,默认只返回干净文本。
27
29
  - 监控抖音、小红书、微博、知乎、Bilibili、TikTok、YouTube、Twitter/X 帐号主页,保存快照并对比历史变化;抖音链路优先使用 `get-sec-user-id -> user-profile -> user-posts -> works detail`。
28
30
  - 在用户要求保存、归档、复盘或复用已完成创作成果时,把选题、标题、文案、脚本、封面、剪辑思路、发布计划和数据复盘沉淀进个人创作库。
29
31
 
@@ -96,6 +98,8 @@ yuanflow-skill list-skills
96
98
  ├─ 本地音视频转文字
97
99
  │ ├─ SKILL.md
98
100
  │ └─ scripts/
101
+ ├─ 音视频在线转文字
102
+ │ └─ SKILL.md
99
103
  ├─ 个人创作库
100
104
  │ ├─ SKILL.md
101
105
  │ ├─ raw/
@@ -23,6 +23,7 @@ description: Use when the user asks about social-media API workflows, platform d
23
23
  - `生图技能/`
24
24
  - `HTML报告生成/`
25
25
  - `本地音视频转文字/`
26
+ - `音视频在线转文字/`
26
27
  - `帐号监控/`
27
28
  - `个人创作库/`
28
29
 
@@ -204,6 +205,20 @@ description: Use when the user asks about social-media API workflows, platform d
204
205
 
205
206
  - `本地音视频转文字`
206
207
 
208
+ ### 13. 走 `音视频在线转文字`
209
+
210
+ 遇到下面这些需求,优先进入这个子 Skill:
211
+
212
+ - 用户要求在线转文字、云端转写、快速转写、音频识别或视频提取文字。
213
+ - 用户提供本地音频或视频文件,并希望通过 YuanFlow 在线 ASR 获取完整文字稿。
214
+ - 用户明确要求使用 `doubao-asr`。
215
+
216
+ 如果用户明确要求离线、本地模型或本地 ASR,改用 `本地音视频转文字`。
217
+
218
+ 子 Skill 名称:
219
+
220
+ - `音视频在线转文字`
221
+
207
222
  ## 多需求时怎么处理
208
223
 
209
224
  如果用户一次提了多段流程,不要强行塞进一个子 Skill,按阶段拆开:
@@ -0,0 +1,142 @@
1
+ ---
2
+ name: 音视频在线转文字
3
+ description: 当用户需要把本地音频或视频通过 YuanFlow 在线 ASR 接口转成文字、云端转写、快速转写,或明确要求使用 doubao-asr 在线识别时使用。
4
+ ---
5
+
6
+ # 音视频在线转文字
7
+
8
+ 本 Skill 使用 YuanFlow 网关的在线 ASR 能力,把音频或视频转成文字。它不下载本地模型;如果用户明确要求离线、本地模型或本地 ASR,改用 `本地音视频转文字`。
9
+
10
+ ## 适用场景
11
+
12
+ - 用户要求“在线转文字”“云端转写”“快速转写”“音频识别”“视频提取文字”。
13
+ - 用户提供本地音频、视频文件路径,并希望得到完整文字稿。
14
+ - 用户明确要求 `doubao-asr`。
15
+
16
+ ## 固定流程
17
+
18
+ 1. 判断输入类型。
19
+ - 音频:直接进入上传流程。
20
+ - 视频:先用 ffmpeg 分离音频,再进入上传流程。
21
+ 2. 上传前把待上传音频整理为英文文件名。
22
+ - 官方参数只要求 `metadata.audio_url` 是可公网访问的音频 URL,没有说明必须英文文件名。
23
+ - 但为避免 OSS URL 编码、上游下载和中文文件名兼容问题,上传前必须使用 ASCII 英文文件名,例如 `transcription-input.mp3`。
24
+ 3. 使用 `OSS文件中转工具` 上传音频。
25
+ 4. 从 OSS 返回中优先取 `data.signed_url` 作为 ASR 的 `metadata.audio_url`。
26
+ - 不要优先使用裸域名 `data.url`;实测裸域名可能导致上游报 `Invalid audio URI` 或音频下载失败。
27
+ - 如果只有 `data.url`,必须补齐 `https://` 后再尝试;失败时说明 OSS URL 不可被 ASR 上游下载。
28
+ 5. 调用在线 ASR 接口。
29
+ 6. 默认只把干净文本返回给用户,不展示原始 JSON。
30
+ 7. 只有用户明确要求时间戳、分句、原始结构或调试信息时,才返回 JSON 摘要或原始字段。
31
+
32
+ ## 视频转音频
33
+
34
+ 视频输入必须先抽音频:
35
+
36
+ ```powershell
37
+ ffmpeg -y -i "C:\path\to\input.mp4" -vn -acodec libmp3lame -ar 44100 -ac 2 "transcription-input.mp3"
38
+ ```
39
+
40
+ 如果 ffmpeg 不可用,必须明确告诉用户缺少 ffmpeg,不能伪造转写结果。
41
+
42
+ ## OSS 上传
43
+
44
+ YuanFlow 主程序内优先调用 `yuanflow_cli_call`,使用 OSS 子命令上传英文命名后的音频:
45
+
46
+ ```json
47
+ {
48
+ "args": [
49
+ "oss",
50
+ "temp-upload",
51
+ "--file",
52
+ "C:\\path\\to\\transcription-input.mp3",
53
+ "--filename",
54
+ "transcription-input.mp3",
55
+ "--content-type",
56
+ "audio/mpeg",
57
+ "--format",
58
+ "agent-json"
59
+ ],
60
+ "timeout": 180
61
+ }
62
+ ```
63
+
64
+ 外部 Agent 可直接执行:
65
+
66
+ ```bash
67
+ yuanflow-cli oss temp-upload \
68
+ --file ./transcription-input.mp3 \
69
+ --filename transcription-input.mp3 \
70
+ --content-type audio/mpeg \
71
+ --format agent-json
72
+ ```
73
+
74
+ 解析返回时优先使用:
75
+
76
+ ```text
77
+ response.data.signed_url
78
+ ```
79
+
80
+ ## ASR 接口
81
+
82
+ 调用端点:
83
+
84
+ ```http
85
+ POST https://open.yuanchuangai.com/v1/audio/transcriptions
86
+ Authorization: Bearer <由 YuanFlow 自动注入>
87
+ Content-Type: application/json
88
+ ```
89
+
90
+ 请求体:
91
+
92
+ ```json
93
+ {
94
+ "model": "doubao-asr",
95
+ "response_format": "json",
96
+ "metadata": {
97
+ "audio_url": "<OSS signed_url>"
98
+ }
99
+ }
100
+ ```
101
+
102
+ 在 YuanFlow 主程序内优先使用 `yuanflow_gateway_request`:
103
+
104
+ ```json
105
+ {
106
+ "method": "POST",
107
+ "path": "/v1/audio/transcriptions",
108
+ "body": {
109
+ "model": "doubao-asr",
110
+ "response_format": "json",
111
+ "metadata": {
112
+ "audio_url": "<OSS signed_url>"
113
+ }
114
+ },
115
+ "timeout": 180
116
+ }
117
+ ```
118
+
119
+ ## 返回处理
120
+
121
+ 当前实测成功响应为:
122
+
123
+ ```json
124
+ {
125
+ "text": "完整转写文本..."
126
+ }
127
+ ```
128
+
129
+ 默认最终回复只输出 `text` 字段清洗后的文本内容。
130
+
131
+ 如果用户要求时间戳:
132
+
133
+ - 先检查接口返回里是否包含 `utterances`、`words`、`segments`、`start_time`、`end_time` 等结构。
134
+ - 如果本次接口没有返回时间戳字段,如实说明“当前网关响应只返回全文 text,未返回时间戳”。
135
+ - 不要编造时间戳。
136
+
137
+ ## 失败处理
138
+
139
+ - `Invalid audio URI` / `audio download failed`:优先检查是否误用了 `data.url` 裸域名;改用 `data.signed_url` 重试。
140
+ - OSS 上传成功但 ASR 失败:说明 OSS key 已生成,但上游无法下载或识别该 URL。
141
+ - 视频抽音频失败:报告 ffmpeg 错误,不继续调用 ASR。
142
+ - 不要暴露 token、Authorization header、签名 URL 的完整敏感查询参数,除非用户明确需要调试链接。