yuanflow-cli 0.1.40 → 0.1.41

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.
@@ -21,11 +21,11 @@ emoji: ☁️
21
21
  - 视频:先用 ffmpeg 分离音频,再进入上传流程。
22
22
  2. 上传前把待上传音频整理为英文文件名。
23
23
  - 官方参数只要求 `metadata.audio_url` 是可公网访问的音频 URL,没有说明必须英文文件名。
24
- - 但为避免 OSS URL 编码、上游下载和中文文件名兼容问题,上传前必须使用 ASCII 英文文件名,例如 `transcription-input.mp3`。
25
- 3. 使用 `OSS文件中转工具` 上传音频。
26
- 4. OSS 返回中优先取 `data.signed_url` 作为 ASR 的 `metadata.audio_url`。
27
- - 不要优先使用裸域名 `data.url`;实测裸域名可能导致上游报 `Invalid audio URI` 或音频下载失败。
28
- - 如果只有 `data.url`,必须补齐 `https://` 后再尝试;失败时说明 OSS URL 不可被 ASR 上游下载。
24
+ - 但为避免文件中转 URL 编码、服务下载和中文文件名兼容问题,上传前必须使用 ASCII 英文文件名,例如 `transcription-input.mp3`。
25
+ 3. 使用 `YuanFlow 文件中转工具` 上传音频。
26
+ 4. 从文件中转返回中优先取 `data.signed_url` 作为 ASR 的 `metadata.audio_url`。
27
+ - 不要优先使用裸域名 `data.url`;实测裸域名可能导致 `Invalid audio URI` 或音频下载失败。
28
+ - 如果只有 `data.url`,必须补齐 `https://` 后再尝试;失败时说明该文件中转 URL 不可被 ASR 服务下载。
29
29
  5. 调用在线 ASR 接口。
30
30
  6. 默认只把干净文本返回给用户,不展示原始 JSON。
31
31
  7. 只有用户明确要求时间戳、分句、原始结构或调试信息时,才返回 JSON 摘要或原始字段。
@@ -40,9 +40,9 @@ ffmpeg -y -i "C:\path\to\input.mp4" -vn -acodec libmp3lame -ar 44100 -ac 2 "tran
40
40
 
41
41
  如果 ffmpeg 不可用,必须明确告诉用户缺少 ffmpeg,不能伪造转写结果。
42
42
 
43
- ## OSS 上传
43
+ ## YuanFlow 文件中转
44
44
 
45
- YuanFlow 主程序内优先调用 `yuanflow_cli_call`,使用 OSS 子命令上传英文命名后的音频:
45
+ YuanFlow 主程序内优先调用 `yuanflow_cli_call`,使用兼容子命令 `oss` 上传英文命名后的音频:
46
46
 
47
47
  ```json
48
48
  {
@@ -95,7 +95,7 @@ Content-Type: application/json
95
95
  "model": "doubao-asr",
96
96
  "response_format": "json",
97
97
  "metadata": {
98
- "audio_url": "<OSS signed_url>"
98
+ "audio_url": "<YuanFlow 文件中转 signed_url>"
99
99
  }
100
100
  }
101
101
  ```
@@ -110,7 +110,7 @@ Content-Type: application/json
110
110
  "model": "doubao-asr",
111
111
  "response_format": "json",
112
112
  "metadata": {
113
- "audio_url": "<OSS signed_url>"
113
+ "audio_url": "<YuanFlow 文件中转 signed_url>"
114
114
  }
115
115
  },
116
116
  "timeout": 180
@@ -138,6 +138,6 @@ Content-Type: application/json
138
138
  ## 失败处理
139
139
 
140
140
  - `Invalid audio URI` / `audio download failed`:优先检查是否误用了 `data.url` 裸域名;改用 `data.signed_url` 重试。
141
- - OSS 上传成功但 ASR 失败:说明 OSS key 已生成,但上游无法下载或识别该 URL。
141
+ - YuanFlow 文件中转上传成功但 ASR 失败:说明文件对象已生成,但 ASR 服务无法下载或识别该 URL。
142
142
  - 视频抽音频失败:报告 ffmpeg 错误,不继续调用 ASR。
143
143
  - 不要暴露 token、Authorization header、签名 URL 的完整敏感查询参数,除非用户明确需要调试链接。
@@ -7,6 +7,7 @@ import { listBrowserCommands } from './browser-tools.js';
7
7
  import { listSearchCommands, listWorkCommands } from './work-tools.js';
8
8
  import { listVideoCommands } from './video-tools.js';
9
9
  import { listTrendingCommands } from './trending-tools.js';
10
+ import { listAiCommands } from './ai-tools.js';
10
11
 
11
12
  const ERROR_MAP = [
12
13
  {
@@ -33,19 +34,19 @@ const ERROR_MAP = [
33
34
  test: (message) => message.includes('HTTP 401') || message.includes('HTTP 403'),
34
35
  },
35
36
  {
36
- code: 'UPSTREAM_CONFIG_ERROR',
37
+ code: 'YUANFLOW_CONFIG_ERROR',
37
38
  exitCode: 4,
38
39
  retryable: false,
39
40
  test: (message) => message.includes('原子能力主站令牌未配置'),
40
41
  },
41
42
  {
42
- code: 'UPSTREAM_ERROR',
43
+ code: 'PLATFORM_SERVICE_ERROR',
43
44
  exitCode: 4,
44
45
  retryable: true,
45
46
  test: (message) => /HTTP 5\d\d/.test(message),
46
47
  },
47
48
  {
48
- code: 'UPSTREAM_ROUTE_MISSING',
49
+ code: 'YUANFLOW_ROUTE_MISSING',
49
50
  exitCode: 4,
50
51
  retryable: false,
51
52
  test: (message) =>
@@ -111,6 +112,7 @@ export function buildCommandRegistry() {
111
112
  const browserCommands = listBrowserCommands();
112
113
  const videoCommands = listVideoCommands();
113
114
  const trendingCommands = listTrendingCommands();
115
+ const aiCommands = listAiCommands();
114
116
  return [
115
117
  ...shortcuts,
116
118
  ...endpoints,
@@ -122,6 +124,7 @@ export function buildCommandRegistry() {
122
124
  ...browserCommands,
123
125
  ...videoCommands,
124
126
  ...trendingCommands,
127
+ ...aiCommands,
125
128
  ].sort((left, right) => left.key.localeCompare(right.key));
126
129
  }
127
130
 
@@ -151,7 +154,7 @@ export function commandToSchema(command) {
151
154
  queryParams: command.queryParams || [],
152
155
  requestBody: command.requestBody || null,
153
156
  },
154
- returns: command.returns || '返回字段以上游接口实际响应为准。',
157
+ returns: command.returns || '返回字段以 YuanFlow API 实际响应为准。',
155
158
  };
156
159
  }
157
160
 
@@ -192,7 +195,7 @@ function endpointToCommand(endpoint) {
192
195
  })),
193
196
  queryParams: endpoint.queryParams || [],
194
197
  requestBody: endpoint.bodyExample,
195
- returns: '返回字段以上游接口实际响应为准。',
198
+ returns: '返回字段以 YuanFlow API 实际响应为准。',
196
199
  };
197
200
  }
198
201