From 46bd187600df00a4270445c1c0feb14970a64554 Mon Sep 17 00:00:00 2001 From: Jaylea <17256627+jaylea@user.noreply.gitee.com> Date: Tue, 15 Sep 2026 21:47:04 +0800 Subject: [PATCH] =?UTF-8?q?test(model-capability):=20=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=20-=20=E8=A1=A5=E5=85=85=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E6=8F=90=E7=A4=BA=E8=AF=8D=E4=B8=8A=E9=99=90?= =?UTF-8?q?=E5=9B=9E=E5=BD=92=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #511 只改了后端与前端两处默认值,但没有前端测试锁定该默认值,任何一次 「顺手改回小值」都不会被 CI 拦住。这里补上回归断言: - 默认常量必须为 8000,且各协议默认能力配置都引用它; - 文本/图片默认上限(32000)不受本次调整影响,避免顺带改变判定口径。 同时锁住画布实际合成量级(技能上下文预算 32000)所需的余量。 --- web/test/model-capabilities.test.ts | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/web/test/model-capabilities.test.ts b/web/test/model-capabilities.test.ts index 3e32cfa70..d320615ca 100644 --- a/web/test/model-capabilities.test.ts +++ b/web/test/model-capabilities.test.ts @@ -2,7 +2,7 @@ import assert from "node:assert/strict"; import test from "node:test"; // Bun 直接执行 TypeScript 测试时需要保留扩展名;生产 tsconfig 不包含 test/。 -import { defaultModelCapabilityConfig, normalizeVideoValue } from "../src/lib/model-capabilities.ts"; +import { DEFAULT_VIDEO_PROMPT_MAX_CHARS, defaultModelCapabilityConfig, normalizeVideoValue } from "../src/lib/model-capabilities.ts"; test("switching to MiniMax H3 replaces an unsupported 720p value with 768P", () => { const profile = defaultModelCapabilityConfig("minimax-video", "MiniMax-H3").video!; @@ -13,3 +13,21 @@ test("switching to MiniMax H3 replaces an unsupported 720p value with 768P", () resolution: "768P", }); }); + +// 视频提示词由「输入框文本 + 连线内容 + 技能上下文」合成,技能上下文预算为 32000, +// 合成结果远长于用户手输内容。默认上限过小会把正常可用的画布工作流拦在本地预检。 +// 这里锁定默认值本身,避免被改回偏小值(前端放行/后端拒绝的判定必须同源)。 +test("video prompt default allows a composed canvas prompt", () => { + assert.equal(DEFAULT_VIDEO_PROMPT_MAX_CHARS, 8000); + for (const protocol of [undefined, "seedance-videos-compatible", "agnes-video", "volcengine-ark-video"]) { + const profile = defaultModelCapabilityConfig(protocol, "test-model"); + assert.equal(profile.video!.references.promptMaxChars, DEFAULT_VIDEO_PROMPT_MAX_CHARS); + } +}); + +test("raising the video default leaves text and image limits untouched", () => { + // 只放宽视频默认值,避免顺带改变其它能力的判定口径。 + const profile = defaultModelCapabilityConfig("seedance-videos-compatible", "sd-2.5"); + assert.equal(profile.text!.references.promptMaxChars, 32000); + assert.equal(profile.image!.references.promptMaxChars, 32000); +});