@q253595422/dsh-imagegen-video 1.15.0 → 1.15.2
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 +52 -6
- package/README.md +5 -4
- package/docs/releases/v1.15.0.md +6 -5
- package/docs/releases/v1.15.1.md +39 -0
- package/docs/releases/v1.15.2.md +29 -0
- package/lib/client.js +1603 -423
- package/lib/client.js.map +1 -1
- package/lib/index.js +104 -32
- package/lib/locale-tables-chunk.js +123 -12
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,47 @@ Attribution for third-party code is in [NOTICE](./NOTICE).
|
|
|
5
5
|
|
|
6
6
|
## Releases
|
|
7
7
|
|
|
8
|
+
### 1.15.2 — 视频取片支持 `/content` 回退
|
|
9
|
+
|
|
10
|
+
- **A finished task with no URL in its body is now downloaded instead of
|
|
11
|
+
failed (#9).** OpenAI's video API — and the OpenAI-compatible relays that
|
|
12
|
+
copy it — report `status: "completed"` with no `url` anywhere and serve the
|
|
13
|
+
bytes only from `GET /videos/{id}/content`. `readPoll()` treated that body as
|
|
14
|
+
"completed but no video address" and failed a render the provider had already
|
|
15
|
+
finished. The poll now reports the content endpoint as the clip source, and
|
|
16
|
+
the download leg fetches it unchanged — same-origin key forwarding, MIME
|
|
17
|
+
inference and the size cap all still apply. A body URL is still preferred,
|
|
18
|
+
and a `/content` that 404s reports the download leg rather than passing as a
|
|
19
|
+
silent success.
|
|
20
|
+
|
|
21
|
+
### 1.15.1 — 火山适配的收口修复
|
|
22
|
+
|
|
23
|
+
- **Ark pixel sizes stay inside the budget.** At 4K / 16:9 the solved
|
|
24
|
+
`2866x1612` rounds up to 16,779,264 pixels, 2048 over the 4096² ceiling, and
|
|
25
|
+
the provider rejects it. The height is now scanned near the target for an
|
|
26
|
+
even pair that is both legal and nearest the requested ratio, with a scale
|
|
27
|
+
fallback when none exists. lite and 4.5 also get their own tier floor
|
|
28
|
+
(`2560x1440`, not 5.0 pro's `1280x720`), so 1K stops being refused there.
|
|
29
|
+
- **Capabilities are read from the upstream id, not the alias.** A channel can
|
|
30
|
+
map `seedance-hd` to `doubao-seedance-2-0-fast-260128`, and the 720p ceiling
|
|
31
|
+
belongs to the latter. Both the engine and the panel described the alias, so
|
|
32
|
+
the panel offered 1080P and the submit got a 400. `resolveVideoModelId`
|
|
33
|
+
resolves the id first; the resolution fallback also stops collapsing 1080P to
|
|
34
|
+
480P (it now picks the highest tier at or below the request).
|
|
35
|
+
- **The `ep-…` claim was wrong** and is corrected in the README, the preset
|
|
36
|
+
hint and the release notes: the family comes from the model id prefix, so an
|
|
37
|
+
inference endpoint is refused before submit instead of being sent a
|
|
38
|
+
malformed body.
|
|
39
|
+
- **A `renderer: code` submit no longer demands a channel.** Code rendering
|
|
40
|
+
needs no image/video channel, but both submit routes validated one and
|
|
41
|
+
refused the request before rendering started.
|
|
42
|
+
- **Code detection no longer uses a method whitelist.** A model writing
|
|
43
|
+
`ctx.fillRect(...)` — a method this renderer does not have — had the whole
|
|
44
|
+
answer filed as prose and silently replaced with the fallback title card,
|
|
45
|
+
hiding the actual problem. Any `ctx.<method>(` now counts as code and the
|
|
46
|
+
executor reports `code-runtime` with the method name; a prose answer also
|
|
47
|
+
quotes what the model said, so a refusal is distinguishable from a wrong API.
|
|
48
|
+
|
|
8
49
|
### 1.15.0 — Volcengine Ark, properly
|
|
9
50
|
|
|
10
51
|
- **Seedream gets the real Ark contract.** The official ids
|
|
@@ -31,12 +72,17 @@ Attribution for third-party code is in [NOTICE](./NOTICE).
|
|
|
31
72
|
is `ratio`, resolution is lowercase, and duration is an integer.
|
|
32
73
|
- **Values are narrowed where the model would reject them.** Seedance 2.x
|
|
33
74
|
accepts 4–15 seconds and 1.0 accepts 2–12; the `fast`/`mini` ids cap at
|
|
34
|
-
720p and reject 1080p and 4k upstream.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
75
|
+
720p and reject 1080p and 4k upstream, and 1.0 does not accept the
|
|
76
|
+
`reference_image` role (`1.0 pro fast` also has no last frame). Requests are
|
|
77
|
+
clamped to the window, degraded to the best tier the id does support (a
|
|
78
|
+
1080P ask on a fast id becomes 720p, not 480p), and modes the id cannot
|
|
79
|
+
express are dropped from the panel instead of being sent as a 400.
|
|
80
|
+
- **Silent by default, not by accident.** Seedream's `watermark` defaults to
|
|
81
|
+
`true` (a visible "AI生成" stamp), so it is sent as `false`. On the video
|
|
82
|
+
side `watermark` already defaults to `false` but is still sent explicitly,
|
|
83
|
+
while `generate_audio` — which exists on 2.x and defaults to `true` — is
|
|
84
|
+
sent as `false`; 1.0 ids do not receive the field at all, since they have no
|
|
85
|
+
audio track to switch off.
|
|
40
86
|
- **One channel, both halves.** The built-in preset is now "字节 · 火山方舟
|
|
41
87
|
(Seedream / Seedance)" with real model ids and a video catalog, so one
|
|
42
88
|
Ark channel serves images and videos.
|
package/README.md
CHANGED
|
@@ -185,7 +185,7 @@ dsh plugin --profile web add ./q253595422-dsh-imagegen-video-1.7.8.tgz
|
|
|
185
185
|
| 协议族 | 模型示例 | 说明 |
|
|
186
186
|
| --- | --- | --- |
|
|
187
187
|
| Agnes 视频 | `agnes-video-2.5-flash`、`agnes-video-2.5` | 提交 `POST /v1/videos`,轮询 `GET /v1/videos/{id}`,取 `metadata.url`;支持文生视频、首尾帧、多参考图、`seed`。 |
|
|
188
|
-
| 火山 Seedance(方舟) | `doubao-seedance-2-0-260128`、`doubao-seedance-2-0-fast-260128`、`doubao-seedance-1-0-pro-250528` | 方舟原生任务协议:提交 `POST /contents/generations/tasks`,轮询 `GET /contents/generations/tasks/{id}`,成片在 `content.video_url`。提示词与参考图放在 `content` 数组里(参考图带 `role`:`first_frame` / `last_frame` / `reference_image`),比例字段是 `ratio
|
|
188
|
+
| 火山 Seedance(方舟) | `doubao-seedance-2-0-260128`、`doubao-seedance-2-0-fast-260128`、`doubao-seedance-1-0-pro-250528` | 方舟原生任务协议:提交 `POST /contents/generations/tasks`,轮询 `GET /contents/generations/tasks/{id}`,成片在 `content.video_url`。提示词与参考图放在 `content` 数组里(参考图带 `role`:`first_frame` / `last_frame` / `reference_image`),比例字段是 `ratio`,分辨率小写。时长:2.x 为 4–15 秒、1.0 为 2–12 秒。分辨率:2.0 支持 480p/720p/1080p/4k,`fast` / `mini` 只到 720p;1.0 为 480p/720p/1080p。1.0 不支持 `reference_image` 角色,`1.0 pro fast` 也不支持尾帧,面板会把这两种模式从该型号上收起来。 |
|
|
189
189
|
| 算力萌 comemoe | `wan2.2-t2v`、`zhimeng-h3-local` | `wan2.2-t2v` 仅文生视频;`zhimeng-h3-local` 支持图生视频。比例只接受 16:9 / 9:16 / 1:1;5 秒片子实测约 9 分钟。 |
|
|
190
190
|
| xAI Grok | `grok-imagine-video-1.5`、`grok-imagine-video-1.5-lite` | 提交 `POST /videos/generations`(注意不是 `/videos`),轮询 `GET /videos/{id}`,取 `video.url` 与 `video.duration`。 |
|
|
191
191
|
| 通用视频 | 其他视频模型 id | 按 OpenAI 兼容视频端点尽力适配;未识别的协议族会明确报错,不会静默发出错误请求。 |
|
|
@@ -196,10 +196,11 @@ dsh plugin --profile web add ./q253595422-dsh-imagegen-video-1.7.8.tgz
|
|
|
196
196
|
|
|
197
197
|
**火山方舟(Seedream / Seedance)** 的生图与生视频可以共用一个渠道(`https://ark.cn-beijing.volces.com/api/v3`),渠道里分别填图片模型与视频模型即可:
|
|
198
198
|
|
|
199
|
-
- **生图(Seedream)**:方舟的 `size` 只能是档位(`1K`/`1.5K`/`2K`/`3K`/`4K`)**或** `宽x高`,二选一,且没有 `aspect_ratio` 参数。所以选了具体比例时,插件按该模型的像素预算换算出显式的偶数宽高(例如 5.0 pro 在 16:9 / 4K 下是 `
|
|
200
|
-
-
|
|
199
|
+
- **生图(Seedream)**:方舟的 `size` 只能是档位(`1K`/`1.5K`/`2K`/`3K`/`4K`)**或** `宽x高`,二选一,且没有 `aspect_ratio` 参数。所以选了具体比例时,插件按该模型的像素预算换算出显式的偶数宽高(例如 5.0 pro 在 16:9 / 4K 下是 `2784x1566`),这样比例才真的生效;`auto` 才回落到档位字符串。
|
|
200
|
+
- **水印**:生图的 `watermark` 默认是 **true**(右下角「AI生成」),插件每次都显式发 `watermark: false`。生视频的默认值是 `false`,插件同样显式发送,不依赖上游默认值。
|
|
201
|
+
- **音轨**:生视频的 `generate_audio` 默认是 **true**(2.5 / 2.0 才有这个字段);面板没有音轨控制,插件显式发 `false`,1.0 系列则完全不带这个字段。
|
|
201
202
|
- **响应格式**:方舟的 Seedream 用 `response_format: 'url'`,插件随后回源下载;网关版的 Seedream 仍走 `b64_json`。
|
|
202
|
-
- **模型 ID
|
|
203
|
+
- **模型 ID**:请填方舟控制台的模型 ID(`doubao-seedream-*` / `doubao-seedance-*`)——协议族是从这个 id 前缀判断的。方舟的**推理接入点**(`ep-…`)目前无法判断协议族:图片会被当成通用渠道、生视频会在提交前直接报「协议族未知」而不是静默发一个形状错误的请求。要在接入点上用,请把该渠道的模型 ID 填成对应的方舟模型 ID。
|
|
203
204
|
|
|
204
205
|
</details>
|
|
205
206
|
|
package/docs/releases/v1.15.0.md
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
| 4.0 | `1280x720` ~ `4096x4096` |
|
|
23
23
|
| 3.0 t2i | `512x512` ~ `2048x2048`(只接受像素值) |
|
|
24
24
|
|
|
25
|
-
例:5.0 pro、比例 16:9、清晰度 4K → `
|
|
25
|
+
例:5.0 pro、比例 16:9、清晰度 4K → `2784x1566`(比例严格 16:9,总像素 4,359,744,在预算内)。换算时先按目标总像素解出宽高并取偶,然后校验取偶后的乘积**没有越过上限**(4K 16:9 四舍五入会变成 16,779,264 > 4096²,上游会直接拒绝),所以会在附近挑一个仍然合法的偶数尺寸。
|
|
26
26
|
- `auto` 保留档位字符串,这是方舟「让模型自己决定」的合法写法。
|
|
27
27
|
- 每次显式发送 `watermark: false`(文生图与图生图都一样)。
|
|
28
28
|
- 响应格式:方舟用 `response_format: 'url'` 并回源下载;网关形态的 Seedream 仍用 `b64_json`。
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
- 首尾帧模式发 `first_frame` / `last_frame`;参考图模式逐张发 `reference_image`(2.x 支持);图生视频发单张 `first_frame`。
|
|
51
51
|
- 比例字段是 `ratio`;分辨率小写;时长是整数秒。
|
|
52
52
|
- 轮询结果从 `content.video_url` 取成片,`content.last_frame_url` 作为封面回落,`duration` 作为真实时长。
|
|
53
|
-
- **收敛而不是硬发**:2.x 时长窗口 4–15 秒,1.0 为 2–12 秒;`fast` / `mini` 上游最高 720p
|
|
54
|
-
- `watermark`
|
|
53
|
+
- **收敛而不是硬发**:2.x 时长窗口 4–15 秒,1.0 为 2–12 秒;`fast` / `mini` 上游最高 720p;1.0 不支持 `reference_image` 角色,`1.0 pro fast` 也没有尾帧,所以这些模式会从对应型号上收起来。越界的请求会被收进窗口,并把分辨率降到该型号真正支持的最高档(1080P 在 fast 型号上降为 720p,而不是掉到 480p)。
|
|
54
|
+
- `watermark` 生图默认 true、生视频默认 false,插件一律显式发送 `false`;`generate_audio`(2.x 才有,默认 true)显式发 `false`,1.0 系列不带这个字段。
|
|
55
55
|
|
|
56
56
|
### 渠道预设
|
|
57
57
|
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
- `doubao-seedream-5-0-pro-260628` / `-5-0-260128` / `-4-5-251128` / `-4-0-250828`(保留旧的 `seedream-5.0-pro` / `seedream-4.0` 别名兼容)
|
|
61
61
|
- `doubao-seedance-2-0-260128` / `doubao-seedance-2-0-fast-260128` / `doubao-seedance-1-0-pro-250528`
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
模型 ID 请填方舟控制台的 `doubao-seedream-*` / `doubao-seedance-*`:协议族按这个 id 前缀判断,推理接入点(`ep-…`)识别不出协议族,生视频会在提交前明确报「协议族未知」而不是静默发出一个形状错误的请求。
|
|
64
64
|
|
|
65
65
|
## 验证
|
|
66
66
|
|
|
@@ -73,5 +73,6 @@
|
|
|
73
73
|
## 依赖与边界
|
|
74
74
|
|
|
75
75
|
- 新增依赖:**无**。
|
|
76
|
-
-
|
|
76
|
+
- 仍只支持方舟文档化的字段;未文档化的参数(如 1.0 上的多图参考)不发送,面板也会把不支持的选项收起来。
|
|
77
|
+
- 时长仍由面板的 5 / 10 秒两档控制(两者都落在所有 Seedance 型号的窗口内);通过 Agent 调用可以传入别的秒数,会被收进对应型号的区间。
|
|
77
78
|
- 收敛后的值会写进请求,但**不会改写你在面板里选的原值**:同一次生成之外,选择保持原样。
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# v1.15.1 — 火山适配的收口修复
|
|
2
|
+
|
|
3
|
+
一句话概括:v1.15.0 把 Seedream / Seedance 接上了方舟的真实契约,这一版修的是「接上之后仍然会在真上游上出问题」的几处细节——像素尺寸越界、能力按渠道别名而非上游 ID 判断、文档里对推理接入点的错误说法,以及代码生成路径在缺渠道时被误拦。
|
|
4
|
+
|
|
5
|
+
## 为什么
|
|
6
|
+
|
|
7
|
+
v1.15.0 发布后逐字段复核方舟文档,发现七处会真实影响结果的问题。它们不是风格问题,每一处都会让某类请求在真上游上失败或失真。
|
|
8
|
+
|
|
9
|
+
## 修了什么
|
|
10
|
+
|
|
11
|
+
### 生图(Seedream)
|
|
12
|
+
|
|
13
|
+
- **像素尺寸会越过上限。** 4K、16:9 时按目标总像素解出的 `2866x1612` 四舍五入后是 16,779,264 像素,比 4096² = 16,777,216 多了 2048,上游直接 400。现在改为在目标高度附近扫描偶数高度、挑出「合法且比例最接近」的一对;扫描不到时按 `sqrt(target / (w*h))` 缩放兜底。文档示例同步改成 `2784x1566`。
|
|
14
|
+
- **lite / 4.5 的档位下限不同。** 5.0 lite 与 4.5 的文档预算是 `2560x1440` 起,原先统一按 5.0 pro 的 `1280x720` 起算,1K 档会在这些型号上被拒。现在按型号分支。
|
|
15
|
+
|
|
16
|
+
### 生视频(Seedance)
|
|
17
|
+
|
|
18
|
+
- **能力判定看的是渠道别名,不是上游 ID。** 渠道可以把 `seedance-hd` 映射到 `doubao-seedance-2-0-fast-260128`,而 720p 上限属于后者。原先引擎和面板都拿别名去判,于是面板会给出 1080P、提交后 400。新增 `resolveVideoModelId`,引擎与面板都先解析出上游 ID 再判能力(`src/video-model-catalog.ts`、`src/video-engine.ts`、`src/client/VideoPanel.tsx`)。
|
|
19
|
+
- **分辨率降档会掉到最低档。** `normalizeVideoResolution` 原先回落到档位表第一项,`1080P` 在 fast 型号上会变成 `480P`,等于白白丢掉大半画面。现在取「不超过请求的最高档」,只有低于下限时才向上取。
|
|
20
|
+
- **文档对推理接入点的说法不成立。** 之前写成 `ep-…` 也能用。实际上协议族按模型 ID 前缀判断,`ep-…` 识别不出来,生视频会在提交前明确报「协议族未知」。README、预设提示与发布说明已一起改正。
|
|
21
|
+
|
|
22
|
+
### 代码生成路径
|
|
23
|
+
|
|
24
|
+
- **`renderer: code` 的提交不再要求渠道。** 代码渲染不需要任何生图/生视频渠道,但两个提交路由仍在校验渠道,缺渠道时会在真正开始渲染之前被拦下(`src/routes.ts`)。
|
|
25
|
+
- **代码识别不再用方法白名单。** 原先只有 `ctx.background/rect/roundRect/circle/line/text/gradient` 这几个调用算「代码」,模型如果写了 `ctx.fillRect(...)`(本渲染器没有这个方法),整段会被判成散文并静默换成内置标题卡——真正的问题(方法不存在)反而被藏起来。现在任何 `ctx.<方法>(` 都算代码,交给执行器报 `code-runtime`,错误里带着方法名。被判定为散文时也会引用模型原话的前 160 字,让用户能区分「模型拒绝了」和「模型写错了 API」。
|
|
26
|
+
|
|
27
|
+
## 验证
|
|
28
|
+
|
|
29
|
+
- `pnpm run typecheck`、`pnpm run build`、`pnpm test` 全绿。
|
|
30
|
+
- `scripts/smoke-video.mjs`:`V1c4` 断言面板按上游 ID 描述能力;`V1c3` 覆盖时长/分辨率收敛;`V6b` 走「别名 `hd`、上游 fast」的完整运行时路径。
|
|
31
|
+
- `scripts/smoke.mjs`:`B7b` 覆盖编辑路径的水印与 1K→2K 档位收窄,以及 6 种比例在 4K 下的尺寸扫描。
|
|
32
|
+
- `scripts/smoke-code-render.mjs` 增至 16 项,新增两条**反向验证过**的用例:
|
|
33
|
+
- `C4b2`:裸函数体 `ctx.fillRect(...)` → `code-runtime` 且错误信息含 `fillRect`。把修复临时回退后该用例失败(旧代码把它当散文换成标题卡),恢复后通过。
|
|
34
|
+
- `C3b`:散文回答的降级原因里必须引用模型原话。旧代码的失败信息是「没有 render 函数,也没有任何绘制调用」,不含原文。
|
|
35
|
+
|
|
36
|
+
## 依赖与边界
|
|
37
|
+
|
|
38
|
+
- 新增依赖:**无**。
|
|
39
|
+
- **火山真实端到端仍未在本机跑过**:开发机上没有火山方舟的 API key(凭据里只有 Agnes / Comemoe / TX 等),且 `ark.cn-beijing.volces.com` 不在安全门允许的地址列表里,直接请求会被拦下。当前验证止于「离线假上游 + 方舟官方文档逐字段对照」。若要本机真跑:设置 → 生图配置里加一个火山渠道,地址填 `https://ark.cn-beijing.volces.com/api/v3`,填 Ark key,模型用方舟控制台的 `doubao-seedream-*` / `doubao-seedance-*`。
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# v1.15.2 — 视频取片支持 `/content` 回退
|
|
2
|
+
|
|
3
|
+
一句话概括:任务已经渲染完成、轮询却因为没有 URL 被判失败的情况,现在会真的把成片取回来。
|
|
4
|
+
|
|
5
|
+
## 为什么
|
|
6
|
+
|
|
7
|
+
`readPoll()` 只在轮询响应体的六个字段里找视频地址,找不到就把任务判成失败,弹出「视频任务已完成但未返回视频地址」。
|
|
8
|
+
|
|
9
|
+
但 OpenAI 官方的视频 API——以及照抄它的 OpenAI 兼容网关——在终态里**不返回任何 URL**:`status` 走到 `completed`,成片只通过 `GET /v1/videos/{id}/content` 以二进制流提供。于是上游明明渲染好了,插件这边报失败,用户拿不到片子;对按次计费的上游来说,这次调用是白花的。
|
|
10
|
+
|
|
11
|
+
这不是某一个网关的私有行为,所以修在上游协议这一层,而不是给某个渠道加特判。
|
|
12
|
+
|
|
13
|
+
## 做了什么
|
|
14
|
+
|
|
15
|
+
- **轮询结果能表达两种取片来源**:响应体里有 URL 就照旧用 URL(优先级不变,它通常指向 CDN,比回源更省事);没有任何 URL 但状态已完成时,轮询把 `/content` 端点作为片源返回,而不是判失败。
|
|
16
|
+
- **下载沿用同一条腿**:`/content` 的字节走原有的下载函数,同源鉴权转发、MIME 推断、体积上限全部照旧生效——没有为它新开一条绕过这些约束的通道。
|
|
17
|
+
- **失败仍然是失败**:`/content` 返回 404 之类的错误时,报的是下载环节的真实错误,不会静默当作成功。任务真失败(`failed` / `expired`)的判定也完全没变。
|
|
18
|
+
|
|
19
|
+
## 验证
|
|
20
|
+
|
|
21
|
+
- `scripts/smoke-video.mjs` 新增两条用例:一条让 mock 上游只给 `/content`、响应体不含 URL,断言成片被取回;一条让 `/content` 返回 404,断言报出的是下载错误而不是「已完成但无地址」。
|
|
22
|
+
- `scripts/verify-negative.mjs` 加了对应的缺陷注入:把回退移除后,新用例会变红,确认这两条测试确实在看这件事。
|
|
23
|
+
- `node scripts/smoke-video.mjs` 全绿。
|
|
24
|
+
|
|
25
|
+
## 影响面
|
|
26
|
+
|
|
27
|
+
只影响「轮询响应体里没有视频地址」的分支;有 URL 的渠道走的是原来那条路径,行为不变。
|
|
28
|
+
|
|
29
|
+
Closes #9.
|