@q253595422/dsh-imagegen-video 1.15.0 → 1.15.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 CHANGED
@@ -5,6 +5,34 @@ Attribution for third-party code is in [NOTICE](./NOTICE).
5
5
 
6
6
  ## Releases
7
7
 
8
+ ### 1.15.1 — 火山适配的收口修复
9
+
10
+ - **Ark pixel sizes stay inside the budget.** At 4K / 16:9 the solved
11
+ `2866x1612` rounds up to 16,779,264 pixels, 2048 over the 4096² ceiling, and
12
+ the provider rejects it. The height is now scanned near the target for an
13
+ even pair that is both legal and nearest the requested ratio, with a scale
14
+ fallback when none exists. lite and 4.5 also get their own tier floor
15
+ (`2560x1440`, not 5.0 pro's `1280x720`), so 1K stops being refused there.
16
+ - **Capabilities are read from the upstream id, not the alias.** A channel can
17
+ map `seedance-hd` to `doubao-seedance-2-0-fast-260128`, and the 720p ceiling
18
+ belongs to the latter. Both the engine and the panel described the alias, so
19
+ the panel offered 1080P and the submit got a 400. `resolveVideoModelId`
20
+ resolves the id first; the resolution fallback also stops collapsing 1080P to
21
+ 480P (it now picks the highest tier at or below the request).
22
+ - **The `ep-…` claim was wrong** and is corrected in the README, the preset
23
+ hint and the release notes: the family comes from the model id prefix, so an
24
+ inference endpoint is refused before submit instead of being sent a
25
+ malformed body.
26
+ - **A `renderer: code` submit no longer demands a channel.** Code rendering
27
+ needs no image/video channel, but both submit routes validated one and
28
+ refused the request before rendering started.
29
+ - **Code detection no longer uses a method whitelist.** A model writing
30
+ `ctx.fillRect(...)` — a method this renderer does not have — had the whole
31
+ answer filed as prose and silently replaced with the fallback title card,
32
+ hiding the actual problem. Any `ctx.<method>(` now counts as code and the
33
+ executor reports `code-runtime` with the method name; a prose answer also
34
+ quotes what the model said, so a refusal is distinguishable from a wrong API.
35
+
8
36
  ### 1.15.0 — Volcengine Ark, properly
9
37
 
10
38
  - **Seedream gets the real Ark contract.** The official ids
@@ -31,12 +59,17 @@ Attribution for third-party code is in [NOTICE](./NOTICE).
31
59
  is `ratio`, resolution is lowercase, and duration is an integer.
32
60
  - **Values are narrowed where the model would reject them.** Seedance 2.x
33
61
  accepts 4–15 seconds and 1.0 accepts 2–12; the `fast`/`mini` ids cap at
34
- 720p and reject 1080p and 4k upstream. Requests are clamped to the window
35
- and degraded to the best tier the id does support (a 1080P ask on a fast id
36
- becomes 720p, not 480p) instead of being sent as a guaranteed 400.
37
- - **Silent by default, not by accident.** `generate_audio` also defaults to
38
- true upstream; the panel has no audio control, so both flags are sent
39
- explicitly as `false`.
62
+ 720p and reject 1080p and 4k upstream, and 1.0 does not accept the
63
+ `reference_image` role (`1.0 pro fast` also has no last frame). Requests are
64
+ clamped to the window, degraded to the best tier the id does support (a
65
+ 1080P ask on a fast id becomes 720p, not 480p), and modes the id cannot
66
+ express are dropped from the panel instead of being sent as a 400.
67
+ - **Silent by default, not by accident.** Seedream's `watermark` defaults to
68
+ `true` (a visible "AI生成" stamp), so it is sent as `false`. On the video
69
+ side `watermark` already defaults to `false` but is still sent explicitly,
70
+ while `generate_audio` — which exists on 2.x and defaults to `true` — is
71
+ sent as `false`; 1.0 ids do not receive the field at all, since they have no
72
+ audio track to switch off.
40
73
  - **One channel, both halves.** The built-in preset is now "字节 · 火山方舟
41
74
  (Seedream / Seedance)" with real model ids and a video catalog, so one
42
75
  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`,分辨率小写,时长 2.x 为 4–15 秒、1.0 为 2–12 秒。`fast` / `mini` 型号上游只到 720p,面板会把 1080P 收敛到 720p 而不是让请求 400。 |
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 下是 `2866x1612`),这样比例才真的生效;`auto` 才回落到档位字符串。
200
- - **水印**:方舟的 `watermark` 默认是 **true**(右下角「AI生成」),插件每次都显式发 `watermark: false`。生视频同理,并额外关掉 `generate_audio`(面板没有音轨控制,不想凭空多一条声音)。
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**:预置里是方舟控制台的模型 ID;如果用的是推理接入点,把模型 id 换成 `ep-…` 也能工作(协议族按请求形状判断,不依赖具体 id)。
203
+ - **模型 ID**:请填方舟控制台的模型 ID(`doubao-seedream-*` / `doubao-seedance-*`)——协议族是从这个 id 前缀判断的。方舟的**推理接入点**(`ep-…`)目前无法判断协议族:图片会被当成通用渠道、生视频会在提交前直接报「协议族未知」而不是静默发一个形状错误的请求。要在接入点上用,请把该渠道的模型 ID 填成对应的方舟模型 ID。
203
204
 
204
205
  </details>
205
206
 
@@ -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 → `2866x1612`(比例 1.7779,总像素 4,619,992,在预算内)。
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。越界的请求会被收进窗口,并把分辨率降到该型号真正支持的最高档(1080P 在 fast 型号上降为 720p,而不是掉到 480p)。
54
- - `watermark` 与 `generate_audio` 在方舟都默认 true,插件每次都显式发 `false`。
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
- 用推理接入点(`ep-…`)也能工作:协议族按请求形状与模型 id 前缀判断,不依赖固定 id。
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
- - 仍只支持方舟文档化的字段;未文档化的参数(如多图参考在 1.0 上)不发送,面板也会把不支持的选项收起来。
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-*`。
package/lib/client.js CHANGED
@@ -60490,20 +60490,17 @@ probe: "/api/dsh-imagegen/code/probe" };
60490
60490
  const base = ENTRIES.seedance;
60491
60491
  const seedance2 = /seedance[-_.]?2/i.test(id);
60492
60492
  const resolutions = /seedance[-_.]?2(?:[-_.]\d+)*[-_.](?:fast|mini)/i.test(id) ? ["480P", "720P"] : [...base.resolutions];
60493
+ const modes = /seedance[-_.]?1[-_.]?\d+[-_.]?pro[-_.]?fast/i.test(id) ? ["text", "image"] : [...base.modes];
60493
60494
  return seedance2 ? {
60494
60495
  family: "seedance",
60495
60496
  ...base,
60496
60497
  resolutions,
60497
- modes: [
60498
- "text",
60499
- "image",
60500
- "keyframe",
60501
- "reference"
60502
- ]
60498
+ modes: [...modes, "reference"]
60503
60499
  } : {
60504
60500
  family: "seedance",
60505
60501
  ...base,
60506
- resolutions
60502
+ resolutions,
60503
+ modes
60507
60504
  };
60508
60505
  }
60509
60506
  if (isComemoeVideoModel(id)) {
@@ -60543,6 +60540,27 @@ probe: "/api/dsh-imagegen/code/probe" };
60543
60540
  }
60544
60541
  /** Default video model ids offered when a channel has no video catalog yet. */
60545
60542
  const DEFAULT_VIDEO_MODELS = ["agnes-video-2.5-flash", "agnes-video-2.5"];
60543
+ /**
60544
+ * The upstream id a channel alias actually resolves to.
60545
+ *
60546
+ * Capability checks (modes, resolutions, family) must describe the id the
60547
+ * provider RECEIVES, not the alias the user typed: a channel can map
60548
+ * `seedance-hd` → `doubao-seedance-2-0-fast-260128`, and only the latter is
60549
+ * capped at 720p. Describing the alias would offer a tier the id rejects.
60550
+ *
60551
+ * Falls back to the alias itself when no channel maps it (a request built
60552
+ * outside the panel, or a catalog edited after selection).
60553
+ */
60554
+ function resolveVideoModelId(alias, channels) {
60555
+ const wanted = alias.trim();
60556
+ if (wanted === "") return "";
60557
+ for (const channel of channels ?? []) for (const row of channel.videoModels ?? []) {
60558
+ if (row.alias !== wanted) continue;
60559
+ const upstream = (row.id ?? "").trim();
60560
+ return upstream === "" ? wanted : upstream;
60561
+ }
60562
+ return wanted;
60563
+ }
60546
60564
  //#endregion
60547
60565
  //#region src/client/VideoPanel.tsx
60548
60566
  /**
@@ -60651,9 +60669,8 @@ probe: "/api/dsh-imagegen/code/probe" };
60651
60669
  }
60652
60670
  if (!videoModels.includes(model)) setModel(videoModels[0]);
60653
60671
  }, [videoModels, model]);
60654
- model === "" || describeVideoModel(model).family;
60655
- const unknownModel = model !== "" && describeVideoModel(model).family === "unknown";
60656
- const catalog = describeVideoModel(model);
60672
+ const catalog = describeVideoModel((0, react.useMemo)(() => resolveVideoModelId(model, config?.channels), [config, model]));
60673
+ const unknownModel = model !== "" && catalog.family === "unknown";
60657
60674
  const availableModes = (0, react.useMemo)(() => {
60658
60675
  if (model === "") return ["text"];
60659
60676
  const supported = catalog.modes;