fix(canvas): 创作工作台 - 恢复连续对话并完善附件、媒体占位与生成分辨率

Fixes #231

Fixes #233
This commit is contained in:
ddCat committed 2026-08-15 22:01:42 +08:00
1 parent 11d9d469f5
commit 7804574f9f
15 files changed
+753 -115

No files matched your search

+6 -2
View File
@@ -145,14 +145,17 @@ export function defaultModelCapabilityConfig(protocol?: ModelProtocol, model = "
duration: { selection: "range", min: 1, max: 15, step: 1, default: 6 },
ratios: ["16:9", "9:16", "1:1", "4:3", "3:4", "21:9"],
defaultRatio: "16:9",
resolutions: ["480p", "720p", "1080p", "2160p"],
resolutions: ["480p", "720p", "1080p", "1440p", "2160p"],
defaultResolution: "720p",
generateAudio: { supported: false, default: false },
watermark: { supported: false, default: false },
operations: ["text_to_video", "image_to_video"],
defaultOperation: "text_to_video",
};
if (protocol === "volcengine-jimeng-video") video.duration = { selection: "enum", values: [5, 10], default: 5 };
if (protocol === "volcengine-jimeng-video") {
video.duration = { selection: "enum", values: [5, 10], default: 5 };
video.resolutions = ["720p"];
}
if (protocol === "gemini-veo") {
video.duration = { selection: "enum", values: [4, 6, 8], default: 6 };
video.resolutions = ["720p", "1080p"];
@@ -166,6 +169,7 @@ export function defaultModelCapabilityConfig(protocol?: ModelProtocol, model = "
video.references.maxAudioDurationSeconds = 15;
video.generateAudio = { supported: true, default: true };
}
if (protocol === "volcengine-ark-video" || protocol === "newapi-channel-1") video.resolutions = ["480p", "720p", "1080p"];
if (protocol === "volcengine-ark-video") video.watermark = { supported: true, default: false };
if (protocol === "novita-video") {
video.references.maxImages = 1;
+4 -7
View File
@@ -1,5 +1,5 @@
export const VIDEO_DURATION_OPTIONS = [6, 9, 10, 15] as const;
export const VIDEO_RESOLUTION_OPTIONS = [480, 720, 1080, 2160] as const;
export const VIDEO_RESOLUTION_OPTIONS = [480, 720, 1080, 1440, 2160] as const;
export const VIDEO_DURATION_MIN = 1;
export function normalizeVideoDuration(value: string | number | undefined) {
@@ -11,11 +11,8 @@ export function normalizeVideoResolution(value: string | number | undefined) {
const token = String(value || "").trim().toLowerCase();
if (token === "low") return "480";
if (token === "auto" || token === "medium" || token === "high") return "720";
if (token === "2k") return "1440";
if (token === "4k") return "2160";
const resolution = Number(token.replace(/p$/i, "")) || 720;
return String(nearestOption(resolution, VIDEO_RESOLUTION_OPTIONS));
}
function nearestOption(value: number, options: readonly number[]) {
return options.reduce((nearest, option) => Math.abs(option - value) < Math.abs(nearest - value) ? option : nearest, options[0]);
const resolution = Number(token.replace(/p$/i, ""));
return Number.isFinite(resolution) && resolution > 0 ? String(Math.floor(resolution)) : "720";
}