fix(canvas): 分镜视频参数 - 按模型能力约束同步音频与水印
This commit is contained in:
@@ -3,7 +3,7 @@ import { describe, expect, test } from "bun:test";
|
||||
import { canvasConnectionError } from "../src/lib/canvas/canvas-connection-policy";
|
||||
import { assertCanvasImageReferenceLimit, buildGenerationConfig, canvasImageReferenceLimitError, resolveCanvasGenerationModel } from "../src/lib/canvas/canvas-project-generation";
|
||||
import { defaultModelCapabilityConfig } from "../src/lib/model-capabilities";
|
||||
import { groupModelsByDisplayName, inferVideoOperation, modelCompatibilityError, modelGroupReferenceLimits, modelPromptLengthError, resolveCompatibleModel, resolveModelGenerationDefaults } from "../src/lib/model-selection";
|
||||
import { groupModelsByDisplayName, inferVideoOperation, modelCompatibilityError, modelGroupReferenceLimits, modelPromptLengthError, resolveCompatibleModel, resolveModelGenerationDefaults, resolveModelVideoBooleanOptions } from "../src/lib/model-selection";
|
||||
import { defaultConfig, normalizeModelOptionValue, type AiConfig, type ModelChannel } from "../src/stores/use-config-store";
|
||||
import { CanvasNodeType, type CanvasConnection, type CanvasNodeData } from "../src/types/canvas";
|
||||
|
||||
@@ -141,6 +141,59 @@ describe("逻辑模型选择", () => {
|
||||
expect(resolveModelGenerationDefaults(config, model, "video", {}, { videoSeconds: "6" }).videoSeconds).toBe("15");
|
||||
});
|
||||
|
||||
test("镜头视频不会向不支持同步音频的模型提交全局 true 默认值", () => {
|
||||
const model = "platform::silent-video";
|
||||
const profile = defaultModelCapabilityConfig(undefined, "silent-video");
|
||||
profile.video!.generateAudio = { supported: false, default: false };
|
||||
profile.video!.watermark = { supported: false, default: false };
|
||||
const config: AiConfig = {
|
||||
...defaultConfig,
|
||||
videoGenerateAudio: "true",
|
||||
videoWatermark: "true",
|
||||
channels: [{
|
||||
id: "platform",
|
||||
name: "平台模型",
|
||||
baseUrl: "/api",
|
||||
apiKey: "system",
|
||||
apiFormat: "openai",
|
||||
scope: "system",
|
||||
models: ["silent-video"],
|
||||
modelCosts: [{
|
||||
model: "silent-video",
|
||||
capability: "video",
|
||||
billingMode: "per_second",
|
||||
unitPriceMicrocredits: 1,
|
||||
logicalModelId: "silent-video",
|
||||
logicalCapabilitySpec: {
|
||||
version: 1,
|
||||
capability: "video",
|
||||
options: {
|
||||
videoGenerateAudio: { values: [false] },
|
||||
videoWatermark: { values: [false] },
|
||||
},
|
||||
},
|
||||
capabilityConfig: profile,
|
||||
}],
|
||||
}],
|
||||
models: [model],
|
||||
videoModels: [model],
|
||||
videoModel: model,
|
||||
model,
|
||||
};
|
||||
|
||||
expect(resolveModelVideoBooleanOptions(config, model, {}, {
|
||||
videoGenerateAudio: config.videoGenerateAudio,
|
||||
videoWatermark: config.videoWatermark,
|
||||
})).toEqual({ videoGenerateAudio: "false", videoWatermark: "false" });
|
||||
|
||||
profile.video!.generateAudio = { supported: true, default: true };
|
||||
config.videoGenerateAudio = "false";
|
||||
expect(resolveModelVideoBooleanOptions(config, model, {}, {
|
||||
videoGenerateAudio: config.videoGenerateAudio,
|
||||
videoWatermark: config.videoWatermark,
|
||||
})).toEqual({ videoGenerateAudio: "true", videoWatermark: "false" });
|
||||
});
|
||||
|
||||
|
||||
test("渠道视频能力配置优先于旧的全局 6 秒和 1:1 配置", () => {
|
||||
const model = "autodl-channel::MiniMax H3";
|
||||
|
||||
Reference in New Issue
Block a user