@henjicc/ai-sdk 0.5.2 → 0.6.1
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/CHANGELOG.md +15 -0
- package/README.md +17 -17
- package/dist/capabilities/speech-recognition/bailian/module.js +15 -3
- package/dist/capabilities/speech-recognition/bailian/parse.js +9 -1
- package/dist/capabilities/speech-recognition/bailian/presets.d.ts +3 -1
- package/dist/capabilities/speech-recognition/bailian/presets.js +4 -0
- package/dist/capabilities/speech-recognition/bailian/realtime/presets.d.ts +2 -1
- package/dist/capabilities/speech-recognition/bailian/realtime/presets.js +2 -0
- package/dist/capabilities/speech-recognition/bailian/realtime/protocol.js +12 -4
- package/dist/capabilities/speech-recognition/bailian/realtime/types.d.ts +3 -0
- package/dist/capabilities/speech-recognition/bailian/types.d.ts +4 -0
- package/dist/capabilities/speech-recognition/index.d.ts +2 -0
- package/dist/catalog/index.js +39 -35
- package/dist/catalog/kie/happyhorse-1.1.model.d.ts +2 -0
- package/dist/catalog/kie/happyhorse-1.1.model.js +67 -0
- package/dist/catalog/volcengine/seedream-5.0-flash.model.d.ts +2 -0
- package/dist/catalog/volcengine/seedream-5.0-flash.model.js +7 -0
- package/dist/catalog/volcengine/seedream-5.0-pro.model.d.ts +0 -1
- package/dist/catalog/volcengine/seedream-5.0-pro.model.js +5 -147
- package/dist/catalog/volcengine/seedream-5.0.d.ts +11 -0
- package/dist/catalog/volcengine/seedream-5.0.js +153 -0
- package/dist/llm/bigmodel/profiles.d.ts +2 -0
- package/dist/llm/bigmodel/profiles.js +8 -1
- package/dist/llm/modelCatalogEntries.js +28 -6
- package/dist/llm/providerPresets.js +4 -3
- package/dist/llm/providerReasoningRequest.d.ts +2 -1
- package/dist/llm/providerReasoningRequest.js +27 -5
- package/dist/llm/sdk/mimoResponses.d.ts +4 -0
- package/dist/llm/sdk/mimoResponses.js +42 -0
- package/dist/llm/sdk/provider.js +4 -2
- package/dist/packs/models/kie/happyhorse-1.1.d.ts +6 -0
- package/dist/packs/models/kie/happyhorse-1.1.js +7 -0
- package/dist/packs/models/volcengine/seedream-5.0-flash.d.ts +6 -0
- package/dist/packs/models/volcengine/seedream-5.0-flash.js +7 -0
- package/dist/packs/provider-packs/kie.d.ts +1 -1
- package/dist/packs/provider-packs/kie.js +22 -21
- package/dist/packs/provider-packs/volcengine.d.ts +1 -1
- package/dist/packs/provider-packs/volcengine.js +4 -3
- package/docs/consumers.md +29 -15
- package/docs/llm-adaptation/README.md +8 -8
- package/docs/llm-adaptation//344/276/233/345/272/224/345/225/206/DeepSeek.md +4 -3
- package/docs/llm-adaptation//344/276/233/345/272/224/345/225/206/Kimi.md +3 -2
- package/docs/llm-adaptation//344/276/233/345/272/224/345/225/206//345/260/217/347/261/263MiMo.md +42 -1
- package/docs/model-adaptation/GLM-5.3-Flash/GLM-5.3-Flash_/346/231/272/350/260/261.md +6 -0
- package/docs/model-adaptation/HappyHorse-1.1/HappyHorse-1.1_KIE.md +27 -0
- package/docs/model-adaptation/README.md +11 -3
- package/docs/model-adaptation/Seedream-5.0-Flash/Seedream-5.0-Flash_/347/201/253/345/261/261/345/274/225/346/223/216.md +18 -0
- package/docs/model-adaptation//344/276/233/345/272/224/345/225/206//347/231/276/347/202/274.md +31 -0
- package/examples/form-renderer/package.json +1 -1
- package/examples/llm-chat/package.json +1 -1
- package/examples/minimal-node/package.json +1 -1
- package/package.json +258 -258
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.6.1 - 2026-09-24
|
|
4
|
+
|
|
5
|
+
- 修复百炼 Fun Duplex 实时识别把无句首标记的空文本中间帧误判为无效响应的问题;覆盖 Qwen Audio 3.1 streaming 与 Fun-ASR 共享协议。
|
|
6
|
+
- 保持缺失文字字段、空最终结果、全程无有效 final 的严格校验及连接释放。
|
|
7
|
+
|
|
8
|
+
## 0.6.0 - 2026-09-24
|
|
9
|
+
|
|
10
|
+
- 新增 MiMo 2.6 Pro / Flash / Pro-UltraSpeed 能力;默认推荐 Pro / Flash,保留 2.5 ID(官方计划 10 月 21 日下线),不自动替换用户选择。
|
|
11
|
+
- MiMo Chat / Responses 思考字段分离,兼容完整 reasoning_text 事件及历史思考回传,流中断不再伪装完成。
|
|
12
|
+
- 新增大陆 GLM-5.3-FlashX 与官方价格;Flash / FlashX 开放 JSON 输出并保留思考。
|
|
13
|
+
- 新增 KIE HappyHorse 1.1 文生、图生、多图参考模式,以及火山 Seedream 5.0 Flash 生成/编辑和图层拆分;价格按最新官方单价。
|
|
14
|
+
- 百炼新增 Qwen-Audio 3.1 短音频、文件与实时 ASR,支持方言/即时热词与说话人输出;修复短音频 JSON 回退、上下文字段及文件声道数组。
|
|
15
|
+
- Kimi K3 资料补齐缓存写入 TTL 价格。新增公开入口保持向后兼容,既有外部 ASR 消费方从 0.2.x 升级仍须满足 0.5.0 的宿主流式上传要求。
|
|
16
|
+
|
|
17
|
+
|
|
3
18
|
## 0.5.2 - 2026-09-21
|
|
4
19
|
|
|
5
20
|
- `llm/streaming` 新增有类型定义的文本、JSON Object 与 JSON Schema 输出配置,并把它正式写入 Chat Completions 的 `response_format`。
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# @henjicc/ai-sdk
|
|
2
2
|
|
|
3
|
-
痕迹AI 的多供应商模型 SDK:内含 8 个生成供应商、
|
|
4
|
-
10 个 LLM 供应商预设和
|
|
3
|
+
痕迹AI 的多供应商模型 SDK:内含 8 个生成供应商、111 个图片/视频/音频模型,以及
|
|
4
|
+
10 个 LLM 供应商预设和 18 个按需 ASR 模型。另有 12 个 FAL 图片工具使用独立按需入口,不进入默认 111 模型目录。预制 LLM 会按供应商与具体模型自动选择 Responses API 或 Chat Completions,宿主不需要暴露逐模型协议设置。SDK 负责目录、请求构建、媒体预处理、
|
|
5
5
|
供应商调用、轮询、SSE 与错误归一化;宿主只需注入网络、凭据、媒体读取和日志。
|
|
6
6
|
|
|
7
7
|
## 5 分钟快速开始
|
|
@@ -48,10 +48,10 @@ try {
|
|
|
48
48
|
|
|
49
49
|
百炼工厂必须传 `baseUrl` 为实际地域/工作空间的 API 根地址,不包含端点路径。其他供应商可以覆盖根地址与 `credentialId`;SDK 不自动切换地域或账号。不同模型的向量不能混用;切换模型通常需要重建向量索引。Rerank 分数仅在本次请求内比较。
|
|
50
50
|
|
|
51
|
-
SDK `0.
|
|
51
|
+
SDK `0.6.1` 的正式分发渠道为公共 npm,无需配置 registry 或访问令牌:
|
|
52
52
|
|
|
53
53
|
```bash
|
|
54
|
-
npm install @henjicc/ai-sdk@0.
|
|
54
|
+
npm install @henjicc/ai-sdk@0.6.1
|
|
55
55
|
```
|
|
56
56
|
|
|
57
57
|
然后提供 4 个宿主能力(`Transport` / `CredentialStore` / `MediaReader` / `Logger`),创建客户端:
|
|
@@ -148,11 +148,11 @@ LLM 预设默认使用 SDK 维护的官方地址,并按具体模型选择 Chat
|
|
|
148
148
|
SDK 源码不得依赖 `@/`、`node:`、Electron、`import.meta.glob`、`eval`/`new Function`/`node:vm`;
|
|
149
149
|
`npm run check:sdk` 会守住这些边界。Photoshop/受限宿主只做生成时应从
|
|
150
150
|
`@henjicc/ai-sdk/generation` 导入 `createGenerationClient`;该入口不静态带入 LLM、Vercel AI SDK、
|
|
151
|
-
Node 内置模块或 Fal 官方客户端,发布门禁会把它打成 IIFE 并在无网络生命周期中核对
|
|
151
|
+
Node 内置模块或 Fal 官方客户端,发布门禁会把它打成 IIFE 并在无网络生命周期中核对 111 个模型。
|
|
152
152
|
|
|
153
153
|
## 按需装配生成模型
|
|
154
154
|
|
|
155
|
-
`@henjicc/ai-sdk/generation` 是兼容入口,默认始终装入
|
|
155
|
+
`@henjicc/ai-sdk/generation` 是兼容入口,默认始终装入 111 个模型。真正需要缩小 Photoshop/Tauri
|
|
156
156
|
包体时,从不含任何内置 catalog/provider 的 `generation/core` 创建模块化客户端,并只导入完整 pack:
|
|
157
157
|
|
|
158
158
|
```ts
|
|
@@ -165,12 +165,12 @@ console.log(client.catalog.list().map((model) => model.meta.id)) // ['kie-z-imag
|
|
|
165
165
|
|
|
166
166
|
完整单模型 pack 同时携带该模型的唯一真实 schema、provider adapter 与 provider-scoped 媒体预处理/
|
|
167
167
|
上传策略;宿主不需要知道内部上传模块。`@henjicc/ai-sdk/provider-packs/kie` 可一次装入 KIE 的全部
|
|
168
|
-
|
|
168
|
+
29 个模型;`provider-adapters/kie` 只装入 KIE 执行与上传策略、不装任何模型。所有 111 个单模型路径和
|
|
169
169
|
8 个供应商路径由 catalog 生成器自动产出并由 bundle 门禁穷举,新增模型不会靠手工维护 exports。
|
|
170
170
|
|
|
171
171
|
每个 `models/<provider>/<model>` 子路径也导出名为 `model` 的低层定义,供目录分析或高级自定义组合;
|
|
172
172
|
直接传裸 `model` 而不传同文件的 `pack` 不保证媒体上传或供应商执行完整,普通宿主应使用 `pack`。
|
|
173
|
-
包根 `createAIClient` 仍默认
|
|
173
|
+
包根 `createAIClient` 仍默认 111 模型;若确实需要根 client 的 chat 与按需生成共存,可显式传:
|
|
174
174
|
|
|
175
175
|
```ts
|
|
176
176
|
const client = createAIClient({
|
|
@@ -239,7 +239,7 @@ cancelLlmChatTask('chat-1')
|
|
|
239
239
|
|
|
240
240
|
### 可选模型分发包与统一能力筛选
|
|
241
241
|
|
|
242
|
-
当前 12 个 FAL 图片工具不会混入默认
|
|
242
|
+
当前 12 个 FAL 图片工具不会混入默认 111 模型。宿主可选择单个完整工具模型 pack,也可按用户任务装入三个聚合包:
|
|
243
243
|
|
|
244
244
|
- `tool-packs/fal-image-edit-tools`:3 个消除工具。
|
|
245
245
|
- `tool-packs/fal-image-utility-tools`:6 个重打光、暗光增强、扩图、商品摄影、照片修复和背景移除工具。
|
|
@@ -274,9 +274,9 @@ console.log(utilities.map((item) => item.id))
|
|
|
274
274
|
- 图片实用工具:`tool-models/fal/relighting`、`tool-models/fal/control-light`、`tool-models/fal/outpaint`、`tool-models/fal/product-photography`、`tool-models/fal/photo-restoration`、`tool-models/fal/pixelcut-background-removal`。
|
|
275
275
|
- 多角度:`tool-models/fal/qwen-image-edit-2511-multiple-angles`、`tool-models/fal/perspective-change`、`tool-models/fal/flux-2-multiple-angles`。
|
|
276
276
|
|
|
277
|
-
每个单模型入口只导出 `model`、`provider` 与完整 `pack`。三个聚合包只携带各自 3 / 6 / 3 个工具模型、Fal adapter 和 Fal CDN 上传,不携带其余
|
|
277
|
+
每个单模型入口只导出 `model`、`provider` 与完整 `pack`。三个聚合包只携带各自 3 / 6 / 3 个工具模型、Fal adapter 和 Fal CDN 上传,不携带其余 111 模型或 LLM。能力筛选与分发是两层:`search()` 只过滤已经导入的候选,不会让已经进入 bundle 的代码自动消失;缩小包体仍必须显式选择单模型/provider/collection pack。
|
|
278
278
|
|
|
279
|
-
Henji-AI 在执行层按需装入工具 pack,但普通模型选择器、`@henjicc/ai-sdk/generation` 与默认能力发现仍只展示
|
|
279
|
+
Henji-AI 在执行层按需装入工具 pack,但普通模型选择器、`@henjicc/ai-sdk/generation` 与默认能力发现仍只展示 111 个主目录模型。
|
|
280
280
|
|
|
281
281
|
## 两类模型的公共边界
|
|
282
282
|
|
|
@@ -324,14 +324,14 @@ SDK 统一处理媒体来源优先级、首个/求和聚合、固定倍率和参
|
|
|
324
324
|
|
|
325
325
|
### 参数类型 → 控件
|
|
326
326
|
|
|
327
|
-
以下 13 种是 `RuntimeParamDef` 的完整公开联合;括号内是当前真实
|
|
327
|
+
以下 13 种是 `RuntimeParamDef` 的完整公开联合;括号内是当前真实 111 catalog 的出现数量。未出现不代表
|
|
328
328
|
类型无效,而是当前目录没有对应模型。
|
|
329
329
|
|
|
330
|
-
| type |
|
|
330
|
+
| type | 111 catalog | 消费方控件 | 关键运行时字段 |
|
|
331
331
|
|---|---:|---|---|
|
|
332
|
-
| `dropdown` |
|
|
332
|
+
| `dropdown` | 325 | 下拉选择 | `options[].value`、`default`、`required?` |
|
|
333
333
|
| `switch` | 93 | 布尔开关 | `default` |
|
|
334
|
-
| `number` |
|
|
334
|
+
| `number` | 86 | 数值输入/步进器 | `min?`、`max?`、`step?`、`default` |
|
|
335
335
|
| `text` | 7 | 单行文本 | `maxLength?`、`default` |
|
|
336
336
|
| `image-upload` | 6 | 图片上传 | `maxCount?`、`accept?`、`maxSize?`、`format?` |
|
|
337
337
|
| `composite` | 4 | 宿主自定义组件钩子 | `valueType?`、`default`;panel/config 不在 SDK |
|
|
@@ -344,7 +344,7 @@ SDK 统一处理媒体来源优先级、首个/求和聚合、固定倍率和参
|
|
|
344
344
|
| `aspect-ratio` | 0 | 比例选择 | `options[].value` |
|
|
345
345
|
|
|
346
346
|
所有参数共有 `id`、`type`、`order`、`default`,并可带 `required`、`valueType`、API 映射、
|
|
347
|
-
`transferKey`、`visible`、`disabled`。实际
|
|
347
|
+
`transferKey`、`visible`、`disabled`。实际 111 catalog 的字段集合与数量由
|
|
348
348
|
`packages/ai-sdk/tests/catalog-consumer-contract.test.ts` 穷举锁定,不以旧 ParamDef 文件或示例推断。
|
|
349
349
|
|
|
350
350
|
### 条件与媒体输入
|
|
@@ -443,7 +443,7 @@ features 与原始 tags。顶层查询维度默认 AND,也可设 `mode: 'any'`
|
|
|
443
443
|
调用方随后交给对应执行 handle;SDK 不提供一个掩盖协议差异的通用 `generate()`。
|
|
444
444
|
|
|
445
445
|
能力画像是运行时选择层,不是打包器。`createModelCapabilityDiscovery({ generationPacks: [...] })` 只会看
|
|
446
|
-
传入的 pack;它既不会隐式导入默认
|
|
446
|
+
传入的 pack;它既不会隐式导入默认 111,也不会从 bundle 删除已导入代码。真正的按需分发仍以 import
|
|
447
447
|
单模型/provider/collection pack 为边界。
|
|
448
448
|
|
|
449
449
|
### ASR/OCR 等开放能力
|
|
@@ -77,10 +77,18 @@ async function executeFunShort(preset, input, apiKey, apiBaseUrl, context) {
|
|
|
77
77
|
const options = providerOptions(input);
|
|
78
78
|
const content = [];
|
|
79
79
|
if (options.context?.trim())
|
|
80
|
-
content.push({ type: '
|
|
80
|
+
content.push({ type: 'input_text', text: options.context.trim() });
|
|
81
81
|
const parameters = { format: formatFrom(input, options) };
|
|
82
82
|
if (options.sampleRateHz !== undefined)
|
|
83
|
-
parameters.sample_rate = options.sampleRateHz;
|
|
83
|
+
parameters.sample_rate = String(options.sampleRateHz);
|
|
84
|
+
if (preset.modelId === 'qwen-audio-3.1-asr-flash') {
|
|
85
|
+
if (options.keepDialect !== undefined)
|
|
86
|
+
parameters.keep_dialect = options.keepDialect;
|
|
87
|
+
if (options.diarizationEnabled !== undefined)
|
|
88
|
+
parameters.speaker_diarization_enabled = options.diarizationEnabled;
|
|
89
|
+
if (options.vocabulary !== undefined)
|
|
90
|
+
parameters.vocabulary = options.vocabulary;
|
|
91
|
+
}
|
|
84
92
|
if (options.vocabularyId)
|
|
85
93
|
parameters.vocabulary_id = options.vocabularyId;
|
|
86
94
|
const languageHints = [...new Set([...(input.hints ?? []), ...(input.language ? [input.language] : [])]
|
|
@@ -141,8 +149,12 @@ function asyncParameters(preset, input, options) {
|
|
|
141
149
|
...(options.vocabularyId ? { vocabulary_id: options.vocabularyId } : {}),
|
|
142
150
|
...(options.diarizationEnabled !== undefined ? { diarization_enabled: options.diarizationEnabled } : {}),
|
|
143
151
|
...(options.speakerCount !== undefined ? { speaker_count: options.speakerCount } : {}),
|
|
144
|
-
...(options.channelId !== undefined ? { channel_id: options.channelId } : {}),
|
|
152
|
+
...(options.channelId !== undefined ? { channel_id: [options.channelId] } : {}),
|
|
145
153
|
...(options.specialWordFilter ? { special_word_filter: options.specialWordFilter } : {}),
|
|
154
|
+
...(preset.modelId === 'qwen-audio-3.1-asr-flash-filetrans' ? {
|
|
155
|
+
...(options.keepDialect !== undefined ? { keep_dialect: options.keepDialect } : {}),
|
|
156
|
+
...(options.vocabulary !== undefined ? { vocabulary: options.vocabulary } : {}),
|
|
157
|
+
} : {}),
|
|
146
158
|
};
|
|
147
159
|
}
|
|
148
160
|
async function wait(ms, context) {
|
|
@@ -26,6 +26,7 @@ function parseWord(value) {
|
|
|
26
26
|
return undefined;
|
|
27
27
|
return {
|
|
28
28
|
text: `${wordText}${text(value.punctuation) ?? ''}`,
|
|
29
|
+
...(numberValue(value.speaker_id) !== undefined ? { speakerId: numberValue(value.speaker_id) } : {}),
|
|
29
30
|
startMs: numberValue(value.begin_time),
|
|
30
31
|
endMs: numberValue(value.end_time),
|
|
31
32
|
};
|
|
@@ -41,6 +42,7 @@ export function parseBailianSentence(value) {
|
|
|
41
42
|
const words = records(sentence.words).map(parseWord).filter((word) => word !== undefined);
|
|
42
43
|
return {
|
|
43
44
|
text: sentenceText,
|
|
45
|
+
...(numberValue(sentence.speaker_id) !== undefined ? { speakerId: numberValue(sentence.speaker_id) } : {}),
|
|
44
46
|
startMs: numberValue(sentence.begin_time),
|
|
45
47
|
endMs: numberValue(sentence.end_time),
|
|
46
48
|
...(words.length ? { words } : {}),
|
|
@@ -48,6 +50,9 @@ export function parseBailianSentence(value) {
|
|
|
48
50
|
}
|
|
49
51
|
/** 解析 Fun-ASR 短音频 SSE,去重供应商可能回显的累计句子。 */
|
|
50
52
|
export function parseFunShortSse(payload) {
|
|
53
|
+
// 短于一分钟时供应商可能忽略 SSE 请求头并直接返回 JSON。
|
|
54
|
+
if (payload.trimStart().startsWith('{'))
|
|
55
|
+
payload = `data:${payload.replace(/\r?\n/g, '')}`;
|
|
51
56
|
const segments = [];
|
|
52
57
|
let latestText = '';
|
|
53
58
|
let durationMs;
|
|
@@ -66,18 +71,21 @@ export function parseFunShortSse(payload) {
|
|
|
66
71
|
throw new AiRuntimeError('invalid_response', 'Bailian Fun-ASR returned malformed SSE JSON');
|
|
67
72
|
}
|
|
68
73
|
const root = record(parsed);
|
|
74
|
+
if (text(root?.code))
|
|
75
|
+
throw new AiRuntimeError('provider_task_failed', text(root?.message) ?? String(root?.code));
|
|
69
76
|
const output = record(root?.output);
|
|
70
77
|
latestText = text(output?.text) ?? latestText;
|
|
71
78
|
const durationSeconds = numberValue(record(root?.usage)?.duration);
|
|
72
79
|
if (durationSeconds !== undefined)
|
|
73
80
|
durationMs = durationSeconds * 1_000;
|
|
74
|
-
for (const sentence of recordsOrOne(output?.sentence)) {
|
|
81
|
+
for (const sentence of recordsOrOne(output?.sentences ?? output?.sentence)) {
|
|
75
82
|
if (sentence.sentence_end !== true)
|
|
76
83
|
continue;
|
|
77
84
|
const segment = parseBailianSentence(sentence);
|
|
78
85
|
if (!segment)
|
|
79
86
|
continue;
|
|
80
87
|
const duplicate = segments.find((candidate) => candidate.startMs === segment.startMs
|
|
88
|
+
&& candidate.speakerId === segment.speakerId
|
|
81
89
|
&& (candidate.text === segment.text
|
|
82
90
|
|| candidate.text.startsWith(segment.text)
|
|
83
91
|
|| segment.text.startsWith(candidate.text)));
|
|
@@ -14,4 +14,6 @@ export declare const bailianQwen3AsrFlash: BailianAsrPreset;
|
|
|
14
14
|
export declare const bailianQwen3AsrFlash20260210: BailianAsrPreset;
|
|
15
15
|
export declare const bailianFunAsr: BailianAsrPreset;
|
|
16
16
|
export declare const bailianQwen3AsrFlashFiletrans: BailianAsrPreset;
|
|
17
|
-
export declare const
|
|
17
|
+
export declare const bailianQwenAudio31AsrFlash: BailianAsrPreset;
|
|
18
|
+
export declare const bailianQwenAudio31AsrFlashFiletrans: BailianAsrPreset;
|
|
19
|
+
export declare const bailianNonRealtimeAsrPresets: readonly [BailianAsrPreset, BailianAsrPreset, BailianAsrPreset, BailianAsrPreset, BailianAsrPreset, BailianAsrPreset, BailianAsrPreset];
|
|
@@ -46,10 +46,14 @@ export const bailianQwen3AsrFlashFiletrans = definePreset({
|
|
|
46
46
|
protocol: 'file-async',
|
|
47
47
|
asyncInputField: 'file_url',
|
|
48
48
|
});
|
|
49
|
+
export const bailianQwenAudio31AsrFlash = definePreset({ modelId: 'qwen-audio-3.1-asr-flash', protocol: 'fun-short-sse', maxInlineBytes: 7_500_000 });
|
|
50
|
+
export const bailianQwenAudio31AsrFlashFiletrans = definePreset({ modelId: 'qwen-audio-3.1-asr-flash-filetrans', protocol: 'file-async', asyncInputField: 'file_urls' });
|
|
49
51
|
export const bailianNonRealtimeAsrPresets = [
|
|
50
52
|
bailianFunAsrFlash20260615,
|
|
51
53
|
bailianQwen3AsrFlash,
|
|
52
54
|
bailianQwen3AsrFlash20260210,
|
|
53
55
|
bailianFunAsr,
|
|
54
56
|
bailianQwen3AsrFlashFiletrans,
|
|
57
|
+
bailianQwenAudio31AsrFlash,
|
|
58
|
+
bailianQwenAudio31AsrFlashFiletrans,
|
|
55
59
|
];
|
|
@@ -10,4 +10,5 @@ export declare const bailianFunAsrRealtime: BailianRealtimeAsrPreset;
|
|
|
10
10
|
export declare const bailianFunAsrRealtime20260228: BailianRealtimeAsrPreset;
|
|
11
11
|
export declare const bailianQwen3AsrFlashRealtime: BailianRealtimeAsrPreset;
|
|
12
12
|
export declare const bailianQwen3AsrFlashRealtime20260210: BailianRealtimeAsrPreset;
|
|
13
|
-
export declare const
|
|
13
|
+
export declare const bailianQwenAudio31AsrFlashStreaming: BailianRealtimeAsrPreset;
|
|
14
|
+
export declare const bailianRealtimeAsrPresets: readonly [BailianRealtimeAsrPreset, BailianRealtimeAsrPreset, BailianRealtimeAsrPreset, BailianRealtimeAsrPreset, BailianRealtimeAsrPreset];
|
|
@@ -24,9 +24,11 @@ export const bailianFunAsrRealtime = definePreset('fun-asr-realtime', 'fun-duple
|
|
|
24
24
|
export const bailianFunAsrRealtime20260228 = definePreset('fun-asr-realtime-2026-02-28', 'fun-duplex');
|
|
25
25
|
export const bailianQwen3AsrFlashRealtime = definePreset('qwen3-asr-flash-realtime', 'qwen-realtime');
|
|
26
26
|
export const bailianQwen3AsrFlashRealtime20260210 = definePreset('qwen3-asr-flash-realtime-2026-02-10', 'qwen-realtime');
|
|
27
|
+
export const bailianQwenAudio31AsrFlashStreaming = definePreset('qwen-audio-3.1-asr-flash-streaming', 'fun-duplex');
|
|
27
28
|
export const bailianRealtimeAsrPresets = [
|
|
28
29
|
bailianFunAsrRealtime,
|
|
29
30
|
bailianFunAsrRealtime20260228,
|
|
30
31
|
bailianQwen3AsrFlashRealtime,
|
|
31
32
|
bailianQwen3AsrFlashRealtime20260210,
|
|
33
|
+
bailianQwenAudio31AsrFlashStreaming,
|
|
32
34
|
];
|
|
@@ -65,6 +65,14 @@ export function buildFunStart(preset, input, taskId) {
|
|
|
65
65
|
parameters.heartbeat = true;
|
|
66
66
|
if (options.speechNoiseThreshold !== undefined)
|
|
67
67
|
parameters.speech_noise_threshold = options.speechNoiseThreshold;
|
|
68
|
+
if (preset.modelId === 'qwen-audio-3.1-asr-flash-streaming') {
|
|
69
|
+
if (options.keepDialect !== undefined)
|
|
70
|
+
parameters.keep_dialect = options.keepDialect;
|
|
71
|
+
if (options.vadModel !== undefined)
|
|
72
|
+
parameters.vad_model = options.vadModel;
|
|
73
|
+
if (options.vocabulary !== undefined)
|
|
74
|
+
parameters.vocabulary = options.vocabulary;
|
|
75
|
+
}
|
|
68
76
|
return JSON.stringify({
|
|
69
77
|
header: { action: 'run-task', task_id: taskId, streaming: 'duplex' },
|
|
70
78
|
payload: {
|
|
@@ -142,10 +150,10 @@ function parseFunEvent(root) {
|
|
|
142
150
|
const segment = parseBailianSentence(sentence);
|
|
143
151
|
const transcript = segment?.text ?? string(sentence?.text);
|
|
144
152
|
if (!transcript) {
|
|
145
|
-
//
|
|
146
|
-
//
|
|
147
|
-
if (sentence?.
|
|
148
|
-
return { kind: 'ignored', eventType: 'empty-sentence-begin' };
|
|
153
|
+
// 句首及后续中间帧均可能尚无文字;只有首帧带 sentence_begin。
|
|
154
|
+
// 必须有 text 字符串与明确的非终态,不能把缺字段的异常响应当作空帧。
|
|
155
|
+
if (typeof sentence?.text === 'string' && sentence.sentence_end === false) {
|
|
156
|
+
return { kind: 'ignored', eventType: sentence.sentence_begin === true ? 'empty-sentence-begin' : 'empty-intermediate' };
|
|
149
157
|
}
|
|
150
158
|
if (sentence?.sentence_end === true) {
|
|
151
159
|
throw new AiRuntimeError('invalid_response', 'Bailian Fun-ASR final result has no text');
|
|
@@ -10,6 +10,9 @@ export interface BailianRealtimeAsrOptions {
|
|
|
10
10
|
turnDetection?: 'server_vad' | 'manual';
|
|
11
11
|
vadThreshold?: number;
|
|
12
12
|
vadSilenceDurationMs?: number;
|
|
13
|
+
keepDialect?: boolean;
|
|
14
|
+
vadModel?: 'near_meeting_16k' | 'far_field_meeting_16k';
|
|
15
|
+
vocabulary?: Readonly<Record<string, number>>;
|
|
13
16
|
}
|
|
14
17
|
export interface BailianRealtimeModuleOptions {
|
|
15
18
|
funWebSocketUrl?: string;
|
|
@@ -8,6 +8,10 @@ export interface BailianAsrOptions {
|
|
|
8
8
|
speakerCount?: number;
|
|
9
9
|
channelId?: number;
|
|
10
10
|
specialWordFilter?: string;
|
|
11
|
+
/** Qwen-Audio 3.1 保留方言表达。 */
|
|
12
|
+
keepDialect?: boolean;
|
|
13
|
+
/** Qwen-Audio 3.x 即时热词:权重 1–5 或 50(超级热词最多 50 个)。 */
|
|
14
|
+
vocabulary?: Readonly<Record<string, number>>;
|
|
11
15
|
}
|
|
12
16
|
export interface BailianAsrModuleOptions {
|
|
13
17
|
/** DashScope `/api/v1` 根路径;工作空间端点可由消费方完整注入。 */
|
|
@@ -10,12 +10,14 @@ export interface SpeechRecognitionInput {
|
|
|
10
10
|
}
|
|
11
11
|
export interface SpeechRecognitionWord {
|
|
12
12
|
text: string;
|
|
13
|
+
speakerId?: number;
|
|
13
14
|
startMs?: number;
|
|
14
15
|
endMs?: number;
|
|
15
16
|
confidence?: number;
|
|
16
17
|
}
|
|
17
18
|
export interface SpeechRecognitionSegment {
|
|
18
19
|
text: string;
|
|
20
|
+
speakerId?: number;
|
|
19
21
|
startMs?: number;
|
|
20
22
|
endMs?: number;
|
|
21
23
|
confidence?: number;
|
package/dist/catalog/index.js
CHANGED
|
@@ -77,41 +77,43 @@ import catalogModel71 from './kie/grok-imagine-video.model.js';
|
|
|
77
77
|
import catalogModel72 from './kie/grok-imagine.model.js';
|
|
78
78
|
import catalogModel73 from './kie/hailuo-02.model.js';
|
|
79
79
|
import catalogModel74 from './kie/hailuo-2-3.model.js';
|
|
80
|
-
import catalogModel75 from './kie/
|
|
81
|
-
import catalogModel76 from './kie/kling-3.0-
|
|
82
|
-
import catalogModel77 from './kie/kling-3.0.model.js';
|
|
83
|
-
import catalogModel78 from './kie/kling-
|
|
84
|
-
import catalogModel79 from './kie/
|
|
85
|
-
import catalogModel80 from './kie/
|
|
86
|
-
import catalogModel81 from './kie/nano-banana-2.model.js';
|
|
87
|
-
import catalogModel82 from './kie/nano-banana-
|
|
88
|
-
import catalogModel83 from './kie/
|
|
89
|
-
import catalogModel84 from './kie/
|
|
90
|
-
import catalogModel85 from './kie/seedance-
|
|
91
|
-
import catalogModel86 from './kie/seedance-2.0-
|
|
92
|
-
import catalogModel87 from './kie/seedance-2.0.model.js';
|
|
93
|
-
import catalogModel88 from './kie/seedance-2.
|
|
94
|
-
import catalogModel89 from './kie/seedance-
|
|
95
|
-
import catalogModel90 from './kie/
|
|
96
|
-
import catalogModel91 from './kie/seedream-4.
|
|
97
|
-
import catalogModel92 from './kie/seedream-5.
|
|
98
|
-
import catalogModel93 from './kie/seedream-5.0-
|
|
99
|
-
import catalogModel94 from './kie/
|
|
100
|
-
import catalogModel95 from './
|
|
101
|
-
import catalogModel96 from './modelscope/
|
|
102
|
-
import catalogModel97 from './modelscope/
|
|
103
|
-
import catalogModel98 from './modelscope/
|
|
104
|
-
import catalogModel99 from './modelscope/qwen-image.model.js';
|
|
105
|
-
import catalogModel100 from './modelscope/
|
|
106
|
-
import catalogModel101 from './modelscope/
|
|
107
|
-
import catalogModel102 from './
|
|
108
|
-
import catalogModel103 from './ppio/
|
|
109
|
-
import catalogModel104 from './ppio/minimax-
|
|
110
|
-
import catalogModel105 from './ppio/
|
|
111
|
-
import catalogModel106 from './ppio/wan-2.
|
|
112
|
-
import catalogModel107 from './ppio/wan-2.
|
|
113
|
-
import catalogModel108 from './
|
|
114
|
-
import catalogModel109 from './volcengine/seedream-5.0-
|
|
80
|
+
import catalogModel75 from './kie/happyhorse-1.1.model.js';
|
|
81
|
+
import catalogModel76 from './kie/kling-3.0-omni.model.js';
|
|
82
|
+
import catalogModel77 from './kie/kling-3.0-turbo.model.js';
|
|
83
|
+
import catalogModel78 from './kie/kling-3.0.model.js';
|
|
84
|
+
import catalogModel79 from './kie/kling-v2-6.model.js';
|
|
85
|
+
import catalogModel80 from './kie/minimax-h3.model.js';
|
|
86
|
+
import catalogModel81 from './kie/nano-banana-2-lite.model.js';
|
|
87
|
+
import catalogModel82 from './kie/nano-banana-2.model.js';
|
|
88
|
+
import catalogModel83 from './kie/nano-banana-pro.model.js';
|
|
89
|
+
import catalogModel84 from './kie/qwen-image-3.0.model.js';
|
|
90
|
+
import catalogModel85 from './kie/seedance-1.5-pro.model.js';
|
|
91
|
+
import catalogModel86 from './kie/seedance-2.0-fast.model.js';
|
|
92
|
+
import catalogModel87 from './kie/seedance-2.0-mini.model.js';
|
|
93
|
+
import catalogModel88 from './kie/seedance-2.0.model.js';
|
|
94
|
+
import catalogModel89 from './kie/seedance-2.5.model.js';
|
|
95
|
+
import catalogModel90 from './kie/seedance-v1.model.js';
|
|
96
|
+
import catalogModel91 from './kie/seedream-4.0.model.js';
|
|
97
|
+
import catalogModel92 from './kie/seedream-4.5.model.js';
|
|
98
|
+
import catalogModel93 from './kie/seedream-5.0-lite.model.js';
|
|
99
|
+
import catalogModel94 from './kie/seedream-5.0-pro.model.js';
|
|
100
|
+
import catalogModel95 from './kie/z-image.model.js';
|
|
101
|
+
import catalogModel96 from './modelscope/flux-1-krea-dev.model.js';
|
|
102
|
+
import catalogModel97 from './modelscope/majicmix-realistic.model.js';
|
|
103
|
+
import catalogModel98 from './modelscope/modelscope-custom.model.js';
|
|
104
|
+
import catalogModel99 from './modelscope/qwen-image-edit-2509.model.js';
|
|
105
|
+
import catalogModel100 from './modelscope/qwen-image.model.js';
|
|
106
|
+
import catalogModel101 from './modelscope/sdxl-14-ckpt.model.js';
|
|
107
|
+
import catalogModel102 from './modelscope/z-image-turbo.model.js';
|
|
108
|
+
import catalogModel103 from './ppio/kling-3.0.model.js';
|
|
109
|
+
import catalogModel104 from './ppio/minimax-hailuo-2.3.model.js';
|
|
110
|
+
import catalogModel105 from './ppio/minimax-speech.model.js';
|
|
111
|
+
import catalogModel106 from './ppio/wan-2.5-preview.model.js';
|
|
112
|
+
import catalogModel107 from './ppio/wan-2.6.model.js';
|
|
113
|
+
import catalogModel108 from './ppio/wan-2.7.model.js';
|
|
114
|
+
import catalogModel109 from './volcengine/seedream-5.0-flash.model.js';
|
|
115
|
+
import catalogModel110 from './volcengine/seedream-5.0-lite.model.js';
|
|
116
|
+
import catalogModel111 from './volcengine/seedream-5.0-pro.model.js';
|
|
115
117
|
export * from './defineModel.js';
|
|
116
118
|
export * from './model-index.js';
|
|
117
119
|
export * from './validate.js';
|
|
@@ -228,5 +230,7 @@ export const catalog = [
|
|
|
228
230
|
catalogModel107,
|
|
229
231
|
catalogModel108,
|
|
230
232
|
catalogModel109,
|
|
233
|
+
catalogModel110,
|
|
234
|
+
catalogModel111,
|
|
231
235
|
];
|
|
232
236
|
export const catalogIndex = createModelIndex(catalog);
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { defineModel } from '../defineModel.js';
|
|
2
|
+
import { hasUploadedImage, resolveKieImageSources } from './mediaSources.js';
|
|
3
|
+
const RATIOS = ['16:9', '9:16', '1:1', '4:3', '3:4', '4:5', '5:4', '9:21', '21:9'];
|
|
4
|
+
function duration(params) {
|
|
5
|
+
const value = params.kieHappyHorse11Duration ?? 5;
|
|
6
|
+
if (typeof value !== 'number' || !Number.isInteger(value) || value < 3 || value > 15) {
|
|
7
|
+
throw new Error('HappyHorse 1.1 时长必须是 3–15 秒的整数');
|
|
8
|
+
}
|
|
9
|
+
return value;
|
|
10
|
+
}
|
|
11
|
+
export const kieHappyHorse11Model = defineModel({
|
|
12
|
+
meta: {
|
|
13
|
+
id: 'kie-happyhorse-1.1', canonicalModelId: 'happyhorse-1.1', seriesId: 'happyhorse', seriesRank: 1.1,
|
|
14
|
+
provider: 'kie', type: 'video',
|
|
15
|
+
tags: ['text-to-video', 'image-to-video', 'reference-mode', 'multi-mode-switch', 'supports-multi-image', 'provider-kie'],
|
|
16
|
+
polling: { interval: 5000, maxAttempts: 180, expectedAttempts: 60 },
|
|
17
|
+
},
|
|
18
|
+
inputLimits: {
|
|
19
|
+
images: { max: 1 }, videos: { max: 0 }, audios: { max: 0 },
|
|
20
|
+
rules: [{ when: 'kieHappyHorse11Mode === "reference-to-video"', images: { min: 1, max: 9 } }],
|
|
21
|
+
},
|
|
22
|
+
params: [
|
|
23
|
+
{ id: 'kieHappyHorse11Mode', type: 'dropdown', order: 1, default: 'text-image-to-video',
|
|
24
|
+
options: [{ value: 'text-image-to-video' }, { value: 'reference-to-video' }] },
|
|
25
|
+
{ id: 'kieHappyHorse11AspectRatio', type: 'dropdown', order: 2, default: 'smart',
|
|
26
|
+
visible: { condition: params => params.kieHappyHorse11Mode === 'reference-to-video' || !hasUploadedImage(params) },
|
|
27
|
+
options: [{ value: 'smart' }, ...RATIOS.map(value => ({ value }))] },
|
|
28
|
+
{ id: 'kieHappyHorse11Resolution', type: 'dropdown', order: 3, default: '1080p',
|
|
29
|
+
options: [{ value: '720p' }, { value: '1080p' }] },
|
|
30
|
+
{ id: 'kieHappyHorse11Duration', type: 'number', order: 4, default: 5, min: 3, max: 15, step: 1 },
|
|
31
|
+
],
|
|
32
|
+
endpoints: '/api/v1/jobs/createTask',
|
|
33
|
+
request: { builder: params => {
|
|
34
|
+
const images = resolveKieImageSources(params);
|
|
35
|
+
const reference = params.kieHappyHorse11Mode === 'reference-to-video';
|
|
36
|
+
if (images.length > (reference ? 9 : 1) || (reference && !images.length)) {
|
|
37
|
+
throw new Error(reference ? '参考模式需要 1–9 张图片' : '图生视频只接受 1 张图片');
|
|
38
|
+
}
|
|
39
|
+
const mode = reference ? 'reference-to-video' : images.length ? 'image-to-video' : 'text-to-video';
|
|
40
|
+
const prompt = typeof params.prompt === 'string' ? params.prompt.trim() : '';
|
|
41
|
+
if ((!prompt && mode !== 'image-to-video') || prompt.length > (mode === 'text-to-video' ? 4999 : 5000)) {
|
|
42
|
+
throw new Error('HappyHorse 1.1 提示词为空或超出长度限制');
|
|
43
|
+
}
|
|
44
|
+
const input = { duration: duration(params), resolution: params.kieHappyHorse11Resolution === '720p' ? '720p' : '1080p' };
|
|
45
|
+
if (prompt)
|
|
46
|
+
input.prompt = prompt;
|
|
47
|
+
if (mode === 'image-to-video')
|
|
48
|
+
input.image_urls = images;
|
|
49
|
+
else {
|
|
50
|
+
const raw = String(params.kieHappyHorse11AspectRatio ?? 'smart');
|
|
51
|
+
const hint = typeof params.__firstImageRatio === 'number' && params.__firstImageRatio > 0 ? params.__firstImageRatio : 16 / 9;
|
|
52
|
+
input.aspect_ratio = RATIOS.includes(raw) ? raw : RATIOS.reduce((best, ratio) => {
|
|
53
|
+
const distance = (value) => { const [w, h] = value.split(':').map(Number); return Math.abs(w / h - hint); };
|
|
54
|
+
return distance(ratio) < distance(best) ? ratio : best;
|
|
55
|
+
}, '16:9');
|
|
56
|
+
if (reference)
|
|
57
|
+
input.reference_image = images;
|
|
58
|
+
}
|
|
59
|
+
return { model: `happyhorse-1-1/${mode}`, input };
|
|
60
|
+
} },
|
|
61
|
+
pricing: {
|
|
62
|
+
currency: '$',
|
|
63
|
+
calculator: params => duration(params) * (params.kieHappyHorse11Resolution === '720p' ? 0.1125 : 0.145),
|
|
64
|
+
description: '720p $0.1125/秒;1080p $0.145/秒;三种模式同价',
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
export default kieHappyHorse11Model;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createSeedream50Model } from './seedream-5.0.js';
|
|
2
|
+
export const volcengineSeedream50FlashModel = createSeedream50Model({
|
|
3
|
+
id: 'volcengine-seedream-5.0-flash', canonicalModelId: 'seedream-5.0-flash',
|
|
4
|
+
apiModel: 'doubao-seedream-5-0-flash-260915', paramPrefix: 'volcengineSeedream50Flash',
|
|
5
|
+
aliases: ['seedream-5-flash-official'], flash: true,
|
|
6
|
+
});
|
|
7
|
+
export default volcengineSeedream50FlashModel;
|