@ninkch/dsh-infinite-canvas 0.19.11 → 0.19.13
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/assets/director/engine.js +62 -11
- package/client.js +76 -32
- package/package.json +1 -1
|
@@ -958,14 +958,16 @@ export const BONE_POSES = [
|
|
|
958
958
|
RightForeArm: [-0.24, -0.05, 0.22]
|
|
959
959
|
} },
|
|
960
960
|
{ id: 'ap_hands_head', zh: '双手抱头', en: 'Hands on head', rootY: 0,
|
|
961
|
-
//
|
|
961
|
+
// 方向约束替代旧的固定欧拉:肘向上抬,前臂向头顶收拢,手落在头附近而不是髋外侧。
|
|
962
962
|
base: {
|
|
963
|
-
Spine: [-0.
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
963
|
+
Spine: [-0.04, 0, 0]
|
|
964
|
+
},
|
|
965
|
+
dirs: [
|
|
966
|
+
{ bone: 'LeftArm', to: [0.15, 1.0, 0.10] },
|
|
967
|
+
{ bone: 'RightArm', to: [-0.15, 1.0, 0.10] },
|
|
968
|
+
{ bone: 'LeftForeArm', to: [-0.10, -0.05, 0.25] },
|
|
969
|
+
{ bone: 'RightForeArm', to: [0.10, -0.05, 0.25] }
|
|
970
|
+
] },
|
|
969
971
|
{ id: 'ap_talk_open', zh: '说话 · 张开', en: 'Talk open', rootY: 0,
|
|
970
972
|
// 来源:awplanet DIRECTOR_POSE_RECIPES(加法欧拉)→ 本表 base 四元数(同语义)
|
|
971
973
|
base: {
|
|
@@ -1585,14 +1587,20 @@ export function decodeModelPack(pack, actionClips) {
|
|
|
1585
1587
|
rawHeight: pack.rawHeight,
|
|
1586
1588
|
verts: pack.verts, tris: pack.tris,
|
|
1587
1589
|
};
|
|
1590
|
+
// 骨架来源:动作轨道的 node 索引与局部轴向只在同源骨架上成立。
|
|
1591
|
+
// 旧包没有 rig 字段时按资产 id 兜底;Explorer 是 awplanet 动作库的源骨架。
|
|
1592
|
+
asset.rig = String(pack.rig || pack.sourceRig || (pack.id === 'explorer' ? 'awplanet-explorer' : pack.id || 'default'));
|
|
1588
1593
|
// 动作库(内置成熟动作:three.js AnimationClip 转 tracks,base64 Float32)
|
|
1589
1594
|
if (Array.isArray(actionClips)) {
|
|
1590
1595
|
for (const c of actionClips) {
|
|
1591
1596
|
if (!c || !c.name || !Array.isArray(c.tracks)) continue;
|
|
1597
|
+
// 异骨架动作绝不能盲加:node 索引不同、局部轴向不同,套错骨架会整身扭曲。
|
|
1598
|
+
if (c.sourceRig && c.sourceRig !== asset.rig) continue;
|
|
1592
1599
|
// 只追加同名不存在的动作:内置片段(待机/行走/奔跑/潜行)保持原样,绝不被覆盖
|
|
1593
1600
|
if (asset.animations.some((a) => a.name === c.name)) continue;
|
|
1594
1601
|
asset.animations.push({
|
|
1595
1602
|
name: c.name, duration: Number(c.duration) || 0, label: c.label || c.name, loop: !!c.loop,
|
|
1603
|
+
sourceRig: c.sourceRig || '',
|
|
1596
1604
|
tracks: c.tracks.map((t) => ({ node: t.node, path: t.path, times: b64ToF32(t.times), vals: b64ToF32(t.vals) })),
|
|
1597
1605
|
});
|
|
1598
1606
|
}
|
|
@@ -1608,6 +1616,7 @@ export function decodeActionClips(list) {
|
|
|
1608
1616
|
label: c.label || c.name || '',
|
|
1609
1617
|
duration: Number(c.duration) || 0,
|
|
1610
1618
|
loop: !!c.loop,
|
|
1619
|
+
sourceRig: c.sourceRig ? String(c.sourceRig) : '',
|
|
1611
1620
|
tracks: (c.tracks || []).map((t) => ({ node: t.node, path: t.path, times: t.times, vals: t.vals })),
|
|
1612
1621
|
}));
|
|
1613
1622
|
}
|
|
@@ -3023,7 +3032,11 @@ export function buildStageFromSpec(spec) {
|
|
|
3023
3032
|
if (Array.isArray(c.poseKeys)) ob.poseKeys = c.poseKeys.map((k) => ({ t: num(k.t, 0), bonePose: JSON.parse(JSON.stringify(k.bonePose || {})), ease: String(k.ease || 'auto') })).sort((a, b) => a.t - b.t);
|
|
3024
3033
|
if (Array.isArray(c.poseAnim)) {
|
|
3025
3034
|
ob.poseAnim = c.poseAnim.map((k) => ({ t: num(k.t, 0), poseId: poseOf(k.pose || k.poseId) || 'none' })).sort((a, b) => a.t - b.t);
|
|
3026
|
-
if (c.loop) { ob.poseLoop = num(c.loopPeriod, ob.poseAnim[ob.poseAnim.length - 1].t); }
|
|
3035
|
+
if (c.loop) { ob.loop = true; ob.poseLoop = num(c.loopPeriod, ob.poseAnim[ob.poseAnim.length - 1].t); }
|
|
3036
|
+
}
|
|
3037
|
+
if (c.loop && !ob.loop) {
|
|
3038
|
+
ob.loop = true;
|
|
3039
|
+
ob.poseLoop = num(c.loopPeriod, 0);
|
|
3027
3040
|
}
|
|
3028
3041
|
if (Array.isArray(c.keys)) {
|
|
3029
3042
|
ob.keys = c.keys.map((k) => ({ t: num(k.t, 0), pos: v3of(k.pos, 0), rotY: num(k.rotY, 0), rx: num(k.rx, 0), rz: num(k.rz, 0), ease: String(k.ease || 'auto') })).sort((a, b) => a.t - b.t);
|
|
@@ -3168,6 +3181,10 @@ export function compileStageSpec(scene) {
|
|
|
3168
3181
|
}
|
|
3169
3182
|
if (ob.locomotion) c.locomotion = { ...ob.locomotion };
|
|
3170
3183
|
if (Array.isArray(ob.poseAnim) && ob.poseAnim.length) c.poseAnim = ob.poseAnim.map((k) => ({ t: round3(k.t), pose: k.poseId }));
|
|
3184
|
+
if (ob.loop === true || Number(ob.poseLoop) > 0) {
|
|
3185
|
+
c.loop = true;
|
|
3186
|
+
c.loopPeriod = round3(Number(ob.poseLoop) || Number((ob.poseAnim || []).at(-1)?.t) || 0);
|
|
3187
|
+
}
|
|
3171
3188
|
if (Array.isArray(ob.poseKeys) && ob.poseKeys.length) c.poseKeys = ob.poseKeys.map((k) => ({ t: round3(k.t), bonePose: JSON.parse(JSON.stringify(k.bonePose || {})), ease: k.ease || 'auto' }));
|
|
3172
3189
|
if (Array.isArray(ob.keys) && ob.keys.length) c.keys = ob.keys.map((k) => ({ t: round3(k.t), pos: arr(k.pos), rotY: round3(k.rotY || 0), rx: round3(k.rx || 0), rz: round3(k.rz || 0), ease: k.ease || 'auto' }));
|
|
3173
3190
|
characters.push(c);
|
|
@@ -3444,7 +3461,12 @@ export function applyPlayhead(scene, t) {
|
|
|
3444
3461
|
if (locoSrc === 'clip') next.animTime = motion.animTime;
|
|
3445
3462
|
else if (locoSrc === 'action') next.poseTime = motion.poseTime;
|
|
3446
3463
|
}
|
|
3447
|
-
|
|
3464
|
+
let poseSampleTime = next.poseTime !== undefined && next.poseTime !== null ? next.poseTime : time;
|
|
3465
|
+
// 用户动作循环:poseLoop 是姿态序列周期;只作用于 poseAnim/自定义姿态,不改变对象/镜头时间轴。
|
|
3466
|
+
if (o.loop === true && Number(o.poseLoop) > 1e-6) {
|
|
3467
|
+
const period = Number(o.poseLoop);
|
|
3468
|
+
poseSampleTime = ((poseSampleTime % period) + period) % period;
|
|
3469
|
+
}
|
|
3448
3470
|
// 姿态动画:poseAnim=[{t,poseId}] → 混合权重(在蒙皮时按权重 slerp)
|
|
3449
3471
|
if (Array.isArray(o.poseAnim) && o.poseAnim.length) {
|
|
3450
3472
|
const bl = poseBlendAt(BONE_POSES, o.poseAnim, poseSampleTime);
|
|
@@ -3576,6 +3598,23 @@ export function applyPlayhead(scene, t) {
|
|
|
3576
3598
|
return out;
|
|
3577
3599
|
}
|
|
3578
3600
|
|
|
3601
|
+
/**
|
|
3602
|
+
* 蒙皮缓存的统一姿态键:静态姿态、poseAnim、poseKeys、NLA clips 都会改变顶点,
|
|
3603
|
+
* 任一字段漏进缓存键都会让时间轴播放命中旧网格,表现为“关键帧没动”。
|
|
3604
|
+
*/
|
|
3605
|
+
export function directorPoseCacheKey(ob) {
|
|
3606
|
+
if (!ob) return '';
|
|
3607
|
+
return [
|
|
3608
|
+
ob.poseId || '',
|
|
3609
|
+
ob.bonePose ? JSON.stringify(ob.bonePose) : '',
|
|
3610
|
+
Array.isArray(ob.poseAnim) ? JSON.stringify(ob.poseAnim) : '',
|
|
3611
|
+
Array.isArray(ob.poseKeys) ? JSON.stringify(ob.poseKeys) : '',
|
|
3612
|
+
Array.isArray(ob.clips) ? JSON.stringify(ob.clips) : '',
|
|
3613
|
+
ob.poseBlend ? JSON.stringify(ob.poseBlend) : '',
|
|
3614
|
+
ob.loop === true ? 'loop:' + (Number(ob.poseLoop) || 0) : '',
|
|
3615
|
+
].join('|');
|
|
3616
|
+
}
|
|
3617
|
+
|
|
3579
3618
|
/** 复位到默认(新建布景时)的机位视角。 */
|
|
3580
3619
|
export function resetView(scene) {
|
|
3581
3620
|
const def = directorDefaultScene();
|
|
@@ -4548,6 +4587,10 @@ export function saveUserAction(pid, action) {
|
|
|
4548
4587
|
poseId: action.poseId || null,
|
|
4549
4588
|
bonePose: action.bonePose && Object.keys(action.bonePose).length ? action.bonePose : null,
|
|
4550
4589
|
poseAnim: Array.isArray(action.poseAnim) && action.poseAnim.length ? action.poseAnim : null,
|
|
4590
|
+
poseKeys: Array.isArray(action.poseKeys) && action.poseKeys.length ? JSON.parse(JSON.stringify(action.poseKeys)) : null,
|
|
4591
|
+
clips: Array.isArray(action.clips) && action.clips.length ? JSON.parse(JSON.stringify(action.clips)) : null,
|
|
4592
|
+
loop: action.loop === true,
|
|
4593
|
+
loopPeriod: Number(action.loopPeriod) > 0 ? Number(action.loopPeriod) : 0,
|
|
4551
4594
|
duration: Number(action.duration) || 0,
|
|
4552
4595
|
createdAt: Date.now(),
|
|
4553
4596
|
};
|
|
@@ -4570,6 +4613,14 @@ export function applyUserAction(ob, action) {
|
|
|
4570
4613
|
ob.poseId = action.poseId || null;
|
|
4571
4614
|
ob.bonePose = action.bonePose ? JSON.parse(JSON.stringify(action.bonePose)) : {};
|
|
4572
4615
|
ob.poseAnim = Array.isArray(action.poseAnim) ? JSON.parse(JSON.stringify(action.poseAnim)) : [];
|
|
4616
|
+
ob.poseKeys = Array.isArray(action.poseKeys) ? JSON.parse(JSON.stringify(action.poseKeys)) : [];
|
|
4617
|
+
ob.clips = Array.isArray(action.clips) ? JSON.parse(JSON.stringify(action.clips)) : [];
|
|
4618
|
+
ob.loop = action.loop === true;
|
|
4619
|
+
ob.poseLoop = Number(action.loopPeriod) > 0 ? Number(action.loopPeriod) : 0;
|
|
4620
|
+
if (!ob.poseKeys.length) delete ob.poseKeys;
|
|
4621
|
+
if (!ob.clips.length) delete ob.clips;
|
|
4622
|
+
if (!ob.loop) delete ob.loop;
|
|
4623
|
+
if (!ob.poseLoop) delete ob.poseLoop;
|
|
4573
4624
|
return ob;
|
|
4574
4625
|
}
|
|
4575
4626
|
export function saveStageDoc(pid, scene) {
|
|
@@ -5142,7 +5193,7 @@ export function createDirectorGlRenderer(canvas) {
|
|
|
5142
5193
|
if (ob.kind === "model" || ob.kind === "gltf") {
|
|
5143
5194
|
const asset = gltfAssetOf(ob.assetId);
|
|
5144
5195
|
if (!asset) continue;
|
|
5145
|
-
const poseKey = (ob
|
|
5196
|
+
const poseKey = directorPoseCacheKey(ob);
|
|
5146
5197
|
const kk = ob.id + ":" + (ob.clip || "") + ":" + (Number(ob.animTime) || 0).toFixed(3) + ":" + (ob.typeId || "") + ":" + (ob.skinning || "lbs") + ":" + (ob.ik ? JSON.stringify(ob.ik) : "") + ":" + (ob.constraints ? JSON.stringify(ob.constraints) : "") + ":" + poseKey + ":shadowV2";
|
|
5147
5198
|
let sk = skCache.get(kk);
|
|
5148
5199
|
if (!sk) {
|
|
@@ -5616,7 +5667,7 @@ export function createDirectorGlRenderer(canvas) {
|
|
|
5616
5667
|
const asset = gltfAssetOf(ob.assetId);
|
|
5617
5668
|
if (asset) {
|
|
5618
5669
|
// 缓存键必须包含「体型 + 骨骼姿态」:姿态一改就得重新蒙皮,否则永远命中旧网格
|
|
5619
|
-
const poseKey = (ob
|
|
5670
|
+
const poseKey = directorPoseCacheKey(ob);
|
|
5620
5671
|
const k = ob.id + ':' + (ob.clip || '') + ':' + (Number(ob.animTime) || 0).toFixed(3) + ':' + (ob.typeId || '') + ':' + (ob.skinning || 'lbs') + ':' + (ob.ik ? JSON.stringify(ob.ik) : '') + ':' + (ob.constraints ? JSON.stringify(ob.constraints) : '') + ':' + poseKey;
|
|
5621
5672
|
let sk = skCache.get(k);
|
|
5622
5673
|
if (!sk) {
|
package/client.js
CHANGED
|
@@ -5646,6 +5646,24 @@ function queueThumb(assetId) {
|
|
|
5646
5646
|
if (!v || typeof v !== 'object' || Array.isArray(v)) throw new Error('扩展参数必须是 JSON 对象(如 {"watermark":false})');
|
|
5647
5647
|
return v;
|
|
5648
5648
|
}
|
|
5649
|
+
/**
|
|
5650
|
+
* 厂商字段校验型 400 的自愈:报错文案指出某字段不被支持(如「watermark 不是文生图队列支持的字段」),
|
|
5651
|
+
* 返回该字段名;不匹配则返回 null。识别规则(大小写不敏感,覆盖中英文两种文案习惯):
|
|
5652
|
+
* ① 「X 不是 … 支持的字段/参数」(中文,X 与"不是"之间可有限定词)
|
|
5653
|
+
* ② "X is not (a )?supported (field|parameter)" / "unknown (field|parameter) X" / "unsupported field X"(英文)
|
|
5654
|
+
* 只在 HTTP 400(invalid_request 类)时调用——4xx 之外不剥字段,避免掩盖真实错误。
|
|
5655
|
+
*/
|
|
5656
|
+
function unsupportedFieldName(errText) {
|
|
5657
|
+
const t = String(errText || '');
|
|
5658
|
+
const zh = /([A-Za-z_][A-Za-z0-9_]*)\s*不是[^。\n]{0,24}?(支持的字段|支持的参数|有效参数|合法参数|有效字段|合法字段)/.exec(t);
|
|
5659
|
+
if (zh) return zh[1];
|
|
5660
|
+
const en1 = /(?:unsupported|unknown|invalid)\s+(?:field|parameter)\s*["']?([A-Za-z_][A-Za-z0-9_]*)/.exec(t);
|
|
5661
|
+
if (en1) return en1[1];
|
|
5662
|
+
const en2 = /["']?([A-Za-z_][A-Za-z0-9_]*)["']?\s+is not (?:a )?supported (?:field|parameter)/.exec(t);
|
|
5663
|
+
if (en2) return en2[1];
|
|
5664
|
+
return null;
|
|
5665
|
+
}
|
|
5666
|
+
|
|
5649
5667
|
async function apiImage(prompt, refBlobs, s, opts) {
|
|
5650
5668
|
if (!s.baseUrl) throw new Error('未配置图片 API');
|
|
5651
5669
|
// URL 归一化:裸域 → /v1;粘贴完整端点也不会被二次拼接
|
|
@@ -5715,11 +5733,27 @@ function queueThumb(assetId) {
|
|
|
5715
5733
|
else { const dims = imageDimsFor(opts); body.size = `${dims.w}x${dims.h}`; }
|
|
5716
5734
|
// 厂商专属扩展参数最后合并(可覆盖以上任何字段):换厂商不需要改代码
|
|
5717
5735
|
if (extra) Object.assign(body, extra);
|
|
5718
|
-
|
|
5736
|
+
// 发送(含一次字段校验型 400 的自愈重试):有些厂商把 /images/generations 转成自己的
|
|
5737
|
+
// 队列式文生图接口,字段表严格(实测某厂商拒绝 watermark 字段)。收到「X 不是…支持的
|
|
5738
|
+
// 字段」类 400 时,剥掉 X 重试一次;仍失败则带上下文抛出。
|
|
5739
|
+
const send = (b, label) => fetchViaProxy(base + '/images/generations', {
|
|
5719
5740
|
headers: { 'Content-Type': 'application/json', ...auth },
|
|
5720
|
-
body, timeoutMs: upstreamTimeout, label
|
|
5741
|
+
body: b, timeoutMs: upstreamTimeout, label,
|
|
5721
5742
|
});
|
|
5722
|
-
|
|
5743
|
+
let res = await send(body, '图片 API');
|
|
5744
|
+
if (!res.ok && res.status === 400) {
|
|
5745
|
+
const bad = unsupportedFieldName(res.text);
|
|
5746
|
+
if (bad && Object.prototype.hasOwnProperty.call(body, bad)) {
|
|
5747
|
+
const retried = { ...body };
|
|
5748
|
+
delete retried[bad];
|
|
5749
|
+
res = await send(retried, '图片 API(剥字段重试)');
|
|
5750
|
+
if (!res.ok) throw new Error('图片 API HTTP ' + res.status + '(已剥离 ' + bad + ' 重试):' + res.text.slice(0, 300));
|
|
5751
|
+
} else {
|
|
5752
|
+
throw new Error('图片 API HTTP 400:' + res.text.slice(0, 300));
|
|
5753
|
+
}
|
|
5754
|
+
} else if (!res.ok) {
|
|
5755
|
+
throw new Error('图片 API HTTP ' + res.status + ':' + res.text.slice(0, 300));
|
|
5756
|
+
}
|
|
5723
5757
|
let j = null;
|
|
5724
5758
|
try { j = JSON.parse(res.text); } catch { j = null; }
|
|
5725
5759
|
const d = j && j.data && j.data[0];
|
|
@@ -5945,6 +5979,7 @@ function queueThumb(assetId) {
|
|
|
5945
5979
|
j.video && j.video.url,
|
|
5946
5980
|
j.output && (j.output.url || j.output.video_url),
|
|
5947
5981
|
j.result && (j.result.url || j.result.video_url),
|
|
5982
|
+
j.data && j.data.result_url,
|
|
5948
5983
|
// OpenAI 风格视频任务(如 JUAI):完成响应把结果放在 metadata.url
|
|
5949
5984
|
j.metadata && (j.metadata.url || j.metadata.video_url),
|
|
5950
5985
|
Array.isArray(j.data) && j.data[0] && (j.data[0].url || j.data[0].video_url),
|
|
@@ -6229,22 +6264,12 @@ function queueThumb(assetId) {
|
|
|
6229
6264
|
}
|
|
6230
6265
|
function detectVideoVendor(s) {
|
|
6231
6266
|
if (!s) return 'openai';
|
|
6267
|
+
// 厂商格式(设置下拉)= 唯一权威路由:选了什么就用什么,模型名绝不参与。
|
|
6268
|
+
// 曾经按模型名猜(wan3.0-video → 误走 DashScope 官方格式),中转站收不到认识的字段直接 502。
|
|
6232
6269
|
if (s.vendor) return s.vendor;
|
|
6233
6270
|
const url = String(s.url || '').toLowerCase();
|
|
6234
|
-
|
|
6235
|
-
//
|
|
6236
|
-
if (/wanx|万相|(^|[^a-z])wan(\d|[-_]\d|x)/.test(model)) return 'wan';
|
|
6237
|
-
if (/minimax-?h3|hailuo-?03/.test(model)) return 'minimaxv2'; // H3 走 V2 协议(必须先于 V1 minimax 判定)
|
|
6238
|
-
if (/(^|[^a-z])kling/.test(model)) return 'kling';
|
|
6239
|
-
if (/minimax|hailuo/.test(model)) return 'minimax';
|
|
6240
|
-
if (/vidu/.test(model)) return 'vidu';
|
|
6241
|
-
if (/runway/.test(model)) return 'runway';
|
|
6242
|
-
if (/(^|[^a-z])veo/.test(model)) return 'veo';
|
|
6243
|
-
if (/luma|ray[-_]?[12]/.test(model)) return 'luma';
|
|
6244
|
-
if (/pixverse/.test(model)) return 'pixverse';
|
|
6245
|
-
if (/stable-?video|(^|[^a-z])svd/.test(model)) return 'stability';
|
|
6246
|
-
if (/seedance/.test(model)) return 'seedance';
|
|
6247
|
-
// URL 兜底识别
|
|
6271
|
+
// URL 特征兜底:URL 也是用户显式配置的一部分(旧配置 vendor 字段为空时走这里,
|
|
6272
|
+
// 设置卡片渲染时会按此回填 vendor,之后恒走显式值)。
|
|
6248
6273
|
if (url.includes('dashscope')) return 'wan';
|
|
6249
6274
|
if (url.includes('klingai')) return 'kling';
|
|
6250
6275
|
if (url.includes('minimax')) return 'minimax';
|
|
@@ -6732,6 +6757,9 @@ function queueThumb(assetId) {
|
|
|
6732
6757
|
if (!base.replace(/^https?:\/\//i, '').includes('/')) base = base + '/v1';
|
|
6733
6758
|
else if (/\/v1$/.test(base)) base = base + '/video/generations';
|
|
6734
6759
|
const isOpenaiVideo = /\/video\/generations$/.test(base);
|
|
6760
|
+
// moyu 类中转站:OpenAI 风格但图片字段用 input_reference / images:string[](dataURL 直接放),
|
|
6761
|
+
// 不收 [{url,role}] 对象数组;resolution 用大写枚举;无 generate_audio/output_format 参数。
|
|
6762
|
+
const isMoyuFlavor = /moyu\.info/i.test(base);
|
|
6735
6763
|
const headers = { 'Content-Type': 'application/json', ...(s.apiKey ? { Authorization: 'Bearer ' + s.apiKey } : {}) };
|
|
6736
6764
|
// 尾帧+参考图同连(跨镜衔接)→ 尾帧降级为第一张衔接参考图(first_frame/reference_image 互斥),标注写在提示词里
|
|
6737
6765
|
const vRefs = o.hardFrame ? [] : (o.refs || []).slice(0, 8);
|
|
@@ -6740,24 +6768,30 @@ function queueThumb(assetId) {
|
|
|
6740
6768
|
const body = {
|
|
6741
6769
|
...(s.model ? { model: s.model } : {}),
|
|
6742
6770
|
prompt,
|
|
6743
|
-
duration: Number(o.duration) || 5,
|
|
6771
|
+
duration: Math.min(30, Math.max(2, Number(o.duration) || 5)),
|
|
6744
6772
|
// 分辨率一律小写(Seedance 系为 '720p'/'1080p';'720P' 会被部分网关判为不支持)
|
|
6745
6773
|
resolution: (o.resolution || '720p').toLowerCase(),
|
|
6746
6774
|
ratio: o.ratio || '16:9',
|
|
6747
6775
|
};
|
|
6776
|
+
if (isMoyuFlavor) body.resolution = String(o.resolution || '1080P').toUpperCase(); // moyu 枚举 480P/720P/1080P
|
|
6748
6777
|
// 首帧图生视频:构图以首帧为准——Seedance 系要求首帧模式必须 ratio=adaptive(仅纯首帧模式)
|
|
6749
6778
|
if (frameBlob && !downgrade) {
|
|
6750
6779
|
body.ratio = 'adaptive';
|
|
6751
|
-
|
|
6780
|
+
if (isMoyuFlavor) body.input_reference = await blobToDataUrlScaled(frameBlob);
|
|
6781
|
+
else try { body.image = await blobToDataUrlScaled(frameBlob); } catch { /* 忽略首帧编码失败 */ }
|
|
6752
6782
|
} else if (vRefs.length) {
|
|
6753
6783
|
const imgs = downgrade ? [frameBlob].concat(vRefs) : vRefs;
|
|
6754
|
-
body.images =
|
|
6755
|
-
? await Promise.all(imgs.map(
|
|
6756
|
-
:
|
|
6784
|
+
body.images = isMoyuFlavor
|
|
6785
|
+
? await Promise.all(imgs.map((b) => blobToDataUrlScaled(b)))
|
|
6786
|
+
: isOpenaiVideo
|
|
6787
|
+
? await Promise.all(imgs.map(async (b) => ({ url: await blobToDataUrlScaled(b), role: 'reference_image' })))
|
|
6788
|
+
: await Promise.all(imgs.map((b) => blobToDataUrlScaled(b)));
|
|
6757
6789
|
}
|
|
6758
6790
|
// 可选参数:勾选才发送 generate_audio;output_format 留空不发送
|
|
6759
|
-
if (
|
|
6760
|
-
|
|
6791
|
+
if (!isMoyuFlavor) {
|
|
6792
|
+
if (s.generateAudio === true) body.generate_audio = true;
|
|
6793
|
+
if (String(s.outputFormat || '').trim()) body.output_format = String(s.outputFormat).trim();
|
|
6794
|
+
}
|
|
6761
6795
|
// 角色声音参考(@引用实体名下的音频资产)→ audios[]:模型生成的对白/声音向参考音色对齐;
|
|
6762
6796
|
// 带声音参考时强制开启同步音频(否则参考无意义)
|
|
6763
6797
|
if (o.audioRefs && o.audioRefs.length) {
|
|
@@ -6835,7 +6869,7 @@ function queueThumb(assetId) {
|
|
|
6835
6869
|
const DONE = ['succeeded', 'success', 'completed', 'complete', 'done', 'finished'];
|
|
6836
6870
|
if (status && FAIL.includes(status)) {
|
|
6837
6871
|
const msg = (st.error && (st.error.message || st.error.msg)) || st.message || st.msg || st.reason
|
|
6838
|
-
|| (st.data && st.data.error && (st.data.error.message || st.data.error)) || status;
|
|
6872
|
+
|| (st.data && (st.data.fail_reason || (st.data.error && (st.data.error.message || st.data.error)))) || status;
|
|
6839
6873
|
return String(msg).slice(0, 300);
|
|
6840
6874
|
}
|
|
6841
6875
|
if (status && DONE.includes(status)) return null; // 成功但没解析出地址:交给调用方超时/后续处理
|
|
@@ -14933,7 +14967,9 @@ const DIRECTOR_KEY_HELP = [
|
|
|
14933
14967
|
const curKeysRef = () => {
|
|
14934
14968
|
const cam2 = (scene.cameras || []).find((c) => c.id === scene.activeCameraId);
|
|
14935
14969
|
const ob2 = (scene.objects || []).find((x) => x.id === S.directorSel);
|
|
14936
|
-
if (ob2
|
|
14970
|
+
if (ob2) return (Array.isArray(ob2.keys) ? ob2.keys : [])
|
|
14971
|
+
.concat(Array.isArray(ob2.poseKeys) ? ob2.poseKeys.map((k) => ({ ...k, _poseKey: true })) : [])
|
|
14972
|
+
.concat(Array.isArray(ob2.poseAnim) ? ob2.poseAnim.map((k) => ({ ...k, _poseAnim: true })) : []);
|
|
14937
14973
|
if (cam2 && Array.isArray(cam2.keys)) return cam2.keys;
|
|
14938
14974
|
return [];
|
|
14939
14975
|
};
|
|
@@ -14960,8 +14996,10 @@ const DIRECTOR_KEY_HELP = [
|
|
|
14960
14996
|
patch((n) => {
|
|
14961
14997
|
const cam2 = (n.cameras || []).find((c) => c.id === n.activeCameraId);
|
|
14962
14998
|
if (cam2 && Array.isArray(cam2.keys)) { const idx = E.keyIndexAt(cam2.keys, playT); if (idx >= 0) cam2.keys.splice(idx, 1); }
|
|
14963
|
-
|
|
14964
|
-
|
|
14999
|
+
const ob2 = (n.objects || []).find((x) => x.id === S.directorSel);
|
|
15000
|
+
if (ob2 && Array.isArray(ob2.keys)) { const idx = E.keyIndexAt(ob2.keys, playT); if (idx >= 0) ob2.keys.splice(idx, 1); }
|
|
15001
|
+
if (ob2 && Array.isArray(ob2.poseKeys)) { const idx = E.keyIndexAt(ob2.poseKeys, playT); if (idx >= 0) ob2.poseKeys.splice(idx, 1); }
|
|
15002
|
+
if (ob2 && Array.isArray(ob2.poseAnim)) { const idx = E.keyIndexAt(ob2.poseAnim, playT); if (idx >= 0) ob2.poseAnim.splice(idx, 1); }
|
|
14965
15003
|
});
|
|
14966
15004
|
setMsg({ kind: 'ok', text: T('dirKeyDeleted') });
|
|
14967
15005
|
} }, '✖|'),
|
|
@@ -14973,9 +15011,11 @@ const DIRECTOR_KEY_HELP = [
|
|
|
14973
15011
|
patch((n) => {
|
|
14974
15012
|
const cam2 = (n.cameras || []).find((c) => c.id === n.activeCameraId);
|
|
14975
15013
|
if (cam2 && Array.isArray(cam2.keys)) { const idx = E.keyIndexAt(cam2.keys, playT); if (idx >= 0) cam2.keys[idx].ease = mode; }
|
|
14976
|
-
|
|
14977
|
-
|
|
14978
|
-
|
|
15014
|
+
const ob2 = (n.objects || []).find((x) => x.id === S.directorSel);
|
|
15015
|
+
if (ob2 && Array.isArray(ob2.keys)) { const idx = E.keyIndexAt(ob2.keys, playT); if (idx >= 0) ob2.keys[idx].ease = mode; }
|
|
15016
|
+
if (ob2 && Array.isArray(ob2.poseKeys)) { const idx = E.keyIndexAt(ob2.poseKeys, playT); if (idx >= 0) ob2.poseKeys[idx].ease = mode; }
|
|
15017
|
+
if (ob2 && Array.isArray(ob2.poseAnim)) { const idx = E.keyIndexAt(ob2.poseAnim, playT); if (idx >= 0) ob2.poseAnim[idx].ease = mode; }
|
|
15018
|
+
});
|
|
14979
15019
|
bumpView();
|
|
14980
15020
|
},
|
|
14981
15021
|
}, [
|
|
@@ -16573,7 +16613,9 @@ const DIRECTOR_KEY_HELP = [
|
|
|
16573
16613
|
if (!nm) { setMsg({ kind: 'err', text: T('dirActionNeedName') }); return; }
|
|
16574
16614
|
const rec = E.saveUserAction(S.activeId, {
|
|
16575
16615
|
name: nm, poseId: sel.poseId, bonePose: sel.bonePose,
|
|
16576
|
-
poseAnim: sel.poseAnim,
|
|
16616
|
+
poseAnim: sel.poseAnim, poseKeys: sel.poseKeys, clips: sel.clips,
|
|
16617
|
+
loop: sel.loop === true, loopPeriod: sel.poseLoop,
|
|
16618
|
+
duration: Number((scene.shot || {}).duration) || 0,
|
|
16577
16619
|
});
|
|
16578
16620
|
if (rec) {
|
|
16579
16621
|
markDirty();
|
|
@@ -17933,6 +17975,8 @@ const DIRECTOR_KEY_HELP = [
|
|
|
17933
17975
|
kind === 'video' ? h('div', { key: 'vendor', className: 'dshic-field' },
|
|
17934
17976
|
h('div', { className: 'dshic-row' },
|
|
17935
17977
|
h('span', { className: 'dshic-field-label' }, T('vendorLabel')),
|
|
17978
|
+
// 旧配置迁移:vendor 字段后加,早期供应商为空 → 按 URL 特征回填一次(此后恒走显式值)
|
|
17979
|
+
(() => { if (!p.vendor) { const d = detectVideoVendor(p); patchProvider(p.id, 'vendor', d); p.vendor = d; } return null; })(),
|
|
17936
17980
|
InfoTip((VIDEO_VENDORS[detectVideoVendor(p)] || {}).note || '')),
|
|
17937
17981
|
h('select', {
|
|
17938
17982
|
className: 'dshic-select', value: detectVideoVendor(p),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ninkch/dsh-infinite-canvas",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.13",
|
|
4
4
|
"description": "无限画布(Infinite Canvas)for DeepSeek Harness:节点式创作工作室(剧本/分镜/生成/成片),内置「媒体创作」预设模式(导演第一视角 + 引导工作坊)。Version-agnostic: reads the live catalog from the installed package at load time.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dsh",
|