feat(canvas): 参数全部改下拉,支持生视频模式与视频节点

This commit is contained in:
2026-10-12 14:15:54 +08:00
parent 90a34276ef
commit af5bf84582
3 changed files with 87 additions and 36 deletions
+3 -3
View File
@@ -97,7 +97,7 @@ export function normalizeDoc(raw) {
if (!n || typeof n.id !== 'string' || ids.has(n.id)) continue
if (!Number.isFinite(n.x) || !Number.isFinite(n.y)) continue
if (!Number.isFinite(n.w) || n.w <= 0 || !Number.isFinite(n.h) || n.h <= 0) continue
const type = n.type === 'note' || n.type === 'gen' ? n.type : 'image'
const type = ['note', 'gen', 'video'].includes(n.type) ? n.type : 'image'
const node = {
id: n.id,
type,
@@ -108,9 +108,9 @@ export function normalizeDoc(raw) {
z: Number.isFinite(n.z) ? n.z : 0,
}
if (type === 'note') node.text = typeof n.text === 'string' ? n.text.slice(0, 4000) : ''
if (type === 'image') {
if (type === 'image' || type === 'video') {
node.src = typeof n.src === 'string' ? n.src.slice(0, 500) : ''
if (!node.src) continue // 图片节点必须有 src
if (!node.src) continue // 媒体节点必须有 src
if (typeof n.prompt === 'string') node.prompt = n.prompt.slice(0, 2000)
if (typeof n.model === 'string') node.model = n.model.slice(0, 120)
}