@ninkch/dsh-infinite-canvas 0.20.3 → 0.20.5
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/canvas-director/SKILL.md +1 -1
- package/assets/canvas-director/moves/fight-rhythm.md +10 -5
- package/client.js +571 -38
- package/combat-semantics.js +147 -0
- package/cordis.patch.yml +9 -2
- package/index.js +72 -7
- package/package.json +2 -1
- package/production.js +2 -2
- package/shot-segments.js +1 -1
- package/skill-pack.js +12 -12
package/client.js
CHANGED
|
@@ -456,6 +456,12 @@ function revealCanvasInRight() {
|
|
|
456
456
|
'segPlanHint': '按真实镜头边界把分镜切成若干次生成:切点只在换场/特写插入/新角色入场处;同一段连续动作不拆开。',
|
|
457
457
|
'segMaxLabel': '单段上限',
|
|
458
458
|
'segMaxHint': '单次生成的最大秒数(按厂商上限填,MiniMax 这类弱衔接模型建议 6–10 秒)',
|
|
459
|
+
'targetDurationLabel': '分镜总时长',
|
|
460
|
+
'targetDurationAuto': '按镜头节奏自动',
|
|
461
|
+
'combatModeLabel': '打斗判定:命中打斗的场才注入战斗契约与打斗节奏(on=本场强制按打斗,off=强制不注入,auto=按剧本检测)',
|
|
462
|
+
'combatAuto': '打斗·自动',
|
|
463
|
+
'combatOn': '打斗·开',
|
|
464
|
+
'combatOff': '打斗·关',
|
|
459
465
|
'customValuePh': '自定义后回车',
|
|
460
466
|
'customCountPh': '自定义 1–100 镜',
|
|
461
467
|
'customSegMaxPh': '自定义 1–300 秒',
|
|
@@ -1461,6 +1467,12 @@ function revealCanvasInRight() {
|
|
|
1461
1467
|
'segPlanHint': 'Split the storyboard into several generations at real shot boundaries: cuts only land on scene change / insert / new character; one continuous action is never split.',
|
|
1462
1468
|
'segMaxLabel': 'Per-segment max',
|
|
1463
1469
|
'segMaxHint': 'Max seconds per generation (match the vendor limit; for weak-continuity models like MiniMax use 6-10s)',
|
|
1470
|
+
'targetDurationLabel': 'Storyboard total duration',
|
|
1471
|
+
'targetDurationAuto': 'Auto by shot pacing',
|
|
1472
|
+
'combatModeLabel': 'Combat gating: only scenes detected as real combat inject the combat contract & fight-rhythm card (on = force combat for this scene, off = force none, auto = detect from script)',
|
|
1473
|
+
'combatAuto': 'Combat · Auto',
|
|
1474
|
+
'combatOn': 'Combat · On',
|
|
1475
|
+
'combatOff': 'Combat · Off',
|
|
1464
1476
|
'customValuePh': 'Custom, press Enter',
|
|
1465
1477
|
'customCountPh': 'Custom 1-100 shots',
|
|
1466
1478
|
'customSegMaxPh': 'Custom 1-300 seconds',
|
|
@@ -3585,6 +3597,7 @@ body[data-ds-dark-theme] .dshic-storage-details{border-color:var(--dsw-alias-bor
|
|
|
3585
3597
|
.dshic-pick-menu{position:fixed;z-index:240;background:var(--dsw-alias-bg-layer-1);border:1px solid var(--dshic-line2);border-radius:14px;box-shadow:var(--dshic-shadow-lg);display:flex;flex-direction:column;max-height:280px;overflow:hidden;box-sizing:border-box;}
|
|
3586
3598
|
body[data-ds-dark-theme] .dshic-pick-menu{border-color:var(--dsw-alias-border-l2);}
|
|
3587
3599
|
.dshic-pick-search{padding:7px;border-bottom:1px solid var(--dshic-line);flex:none;}
|
|
3600
|
+
.dshic-pick-search.is-flipped{border-bottom:none;border-top:1px solid var(--dshic-line);}
|
|
3588
3601
|
.dshic-pick-search .dshic-input{height:26px;font-size:12px;}
|
|
3589
3602
|
.dshic-pick-list{overflow-y:auto;padding:5px;flex:1;}
|
|
3590
3603
|
/* 下拉 / 文本正文 / 分镜清单:滚动条必须可见且可命中;不能用系统默认的淡细条。
|
|
@@ -6633,6 +6646,7 @@ function queueThumb(assetId) {
|
|
|
6633
6646
|
kling: { label: '快手可灵 Kling', base: 'https://api.klingai.com', keyPh: 'AK:SK(冒号分隔)', note: 'Key 填 AK:SK,代码自动签 JWT;国际站把 Base URL 改为 api-singapore.klingai.com;时长按官方 5/10s 取整' },
|
|
6634
6647
|
wan: { label: '阿里通义万相 Wan(DashScope)', base: 'https://dashscope.aliyuncs.com', note: '异步任务制;国际站把 Base URL 改为 dashscope-intl.aliyuncs.com;图生视频走 img_url' },
|
|
6635
6648
|
sanbao: { label: '三宝影像工坊(Sanbao 多参考)', base: 'https://sanbaobeauty.com', keyPh: 'sk-sanbao-…', note: '任务制 /openapi/v1/videos;本地素材 dataURL 直传(全模型 media_inputs 含 data_url,已实测);报图片格式错误自动用扩展参数 {"uploadKey":"sk-sanbao-…"} 指定的专用 key 上传 /openapi/v1/uploads/raw 转公网 URL 后重试一次;resolution 小写(480p/720p/1080p/2k);reference 固定 all(可扩展参数覆盖);参考图上限按模型:wan/kling 系 10、hailuo/SD2.0 系 9、SD2.5 系 30,音频 3–10' },
|
|
6649
|
+
api6789: { label: '6789API(任务制 /v1/videos)', base: '', keyPh: 'sk-…', note: '任务制三段式:POST /v1/videos(Idempotency-Key 幂等)→ GET /v1/videos/{id} 每 5s 轮询 → file/download_url 或 /content 下载(任务成功后 CDN 就绪需等待:10 分钟重试窗口每 30s 一次)。请求体按模型分两族:seedance* 用 duration/ratio/resolution/image_urls(resolution 小写;seedance2.5 参考图 30 张、其余 9 张);minimax* 用 seconds/size/workflow_id/images(比例×清晰度映射精确像素尺寸,2K/4K 大写且必须至少 1 张参考图,seconds 5–15)。Base URL 填站点根(…/v1、…/v1/videos 自动归一);任何同格式站点都能用。本地参考图 dataURL 直发,站方要求公网直链时用扩展参数 {"image_urls":["https://…"]}(minimax 系字段名 images)直给' },
|
|
6636
6650
|
minimax: { label: 'MiniMax 海螺视频(V1 协议)', base: 'https://api.minimaxi.com', note: '异步任务制;时长按官方 6/10s 取整;首帧图支持 base64' },
|
|
6637
6651
|
minimaxv2: { label: 'MiniMax H3 · V2 协议(优云智算 / 官方)', base: 'https://cp.compshare.cn', keyPh: 'sk-ml-…', note: 'V2 协议自动适配:优云智算走 /minimax/v2,官方(api.minimax.io/.cn)走 /v2;content[] 多模态(首帧/尾帧/参考图≤9/视频≤3/音频≤3),原生音频,分辨率 480P/768P/1080P/2K/4K(大小写敏感),时长 4-30s;use_context_ir / mute_audio 等走扩展参数' },
|
|
6638
6652
|
vidu: { label: '生数科技 Vidu', base: 'https://api.vidu.com', note: '图片支持 base64;时长按官方 4/8s 取整' },
|
|
@@ -6882,6 +6896,133 @@ function queueThumb(assetId) {
|
|
|
6882
6896
|
if (!/^https?:/.test(String(url || ''))) throw new Error('Sanbao 素材上传未返回 file.url');
|
|
6883
6897
|
return url;
|
|
6884
6898
|
}
|
|
6899
|
+
// —— 6789API:任务制 /v1/videos(同一路径按模型分两族请求体:seedance* / minimax*)——
|
|
6900
|
+
/** 6789 图片数组上限(纯函数供回归断言):seedance2.5 系 30 张、其余 9 张。 */
|
|
6901
|
+
function api6789ImageCap(model) {
|
|
6902
|
+
return /2\.5/.test(String(model || '')) ? 30 : 9;
|
|
6903
|
+
}
|
|
6904
|
+
/** 6789 请求体(纯函数供回归断言):按模型名分两族——
|
|
6905
|
+
* · seedance*:{model, prompt, duration, ratio, resolution(小写), image_urls?}
|
|
6906
|
+
* 时长/比例/分辨率一律透传(站方校验、报错可见,绝不静默裁剪);
|
|
6907
|
+
* · minimax*:{model, prompt, seconds, size, workflow_id, images?}
|
|
6908
|
+
* 比例×清晰度必须映射为精确像素 size(2K/4K 大写);workflow_id 自动选:
|
|
6909
|
+
* 无图 text-to-video / 有图普通 multi-reference / 有图 2K/4K cf-multi-reference。
|
|
6910
|
+
* images:首帧在前、参考图在后(dataURL 直发;站方要公网直链时扩展参数覆盖)。 */
|
|
6911
|
+
function build6789VideoBody(spec, media) {
|
|
6912
|
+
const sp = spec || {};
|
|
6913
|
+
const m = media || {};
|
|
6914
|
+
const model = String(sp.model || '').toLowerCase();
|
|
6915
|
+
const frame = String(m.frameDataUrl || '');
|
|
6916
|
+
const refs = (Array.isArray(m.refDataUrls) ? m.refDataUrls : []).map(String).filter(Boolean);
|
|
6917
|
+
const isMini = model.includes('minimax');
|
|
6918
|
+
if (isMini) {
|
|
6919
|
+
const out = {
|
|
6920
|
+
model,
|
|
6921
|
+
prompt: String(sp.prompt || ''),
|
|
6922
|
+
seconds: Math.round(Number(sp.duration)) || 5,
|
|
6923
|
+
size: api6789SizeOf(sp.ratio, sp.resolution),
|
|
6924
|
+
workflow_id: 'text-to-video',
|
|
6925
|
+
};
|
|
6926
|
+
const images = (frame ? [frame] : []).concat(refs);
|
|
6927
|
+
if (images.length) {
|
|
6928
|
+
out.images = images;
|
|
6929
|
+
out.workflow_id = /^2K$|^4K$/i.test(String(out.size)) ? 'cf-multi-reference' : 'multi-reference';
|
|
6930
|
+
}
|
|
6931
|
+
return out;
|
|
6932
|
+
}
|
|
6933
|
+
const out = {
|
|
6934
|
+
model,
|
|
6935
|
+
prompt: String(sp.prompt || ''),
|
|
6936
|
+
duration: Math.round(Number(sp.duration)) || 5,
|
|
6937
|
+
ratio: String(sp.ratio || '16:9'),
|
|
6938
|
+
resolution: String(sp.resolution || '720p').toLowerCase(),
|
|
6939
|
+
};
|
|
6940
|
+
const images = (frame ? [frame] : []).concat(refs);
|
|
6941
|
+
if (images.length) out.image_urls = images;
|
|
6942
|
+
return out;
|
|
6943
|
+
}
|
|
6944
|
+
/** 6789 minimax 系尺寸映射(纯函数供回归断言):普通清晰度 = 比例×清晰度档的精确像素;
|
|
6945
|
+
* 2K/4K 直接大写(站方要求)。480p 不在枚举 → 按最接近的 768P 档处理并告警可见。 */
|
|
6946
|
+
function api6789SizeOf(ratio, resolution) {
|
|
6947
|
+
const res = String(resolution || '720p').toLowerCase();
|
|
6948
|
+
if (res.includes('2k')) return '2K';
|
|
6949
|
+
if (res.includes('4k')) return '4K';
|
|
6950
|
+
const hd = res.includes('1080');
|
|
6951
|
+
const r = String(ratio || '16:9');
|
|
6952
|
+
const MAP = {
|
|
6953
|
+
// 720P 档 1080P 档
|
|
6954
|
+
'16:9': ['1376x768', '1920x1088'],
|
|
6955
|
+
'9:16': ['768x1376', '1088x1920'],
|
|
6956
|
+
'1:1': ['1024x1024', '1440x1440'],
|
|
6957
|
+
'4:3': ['1184x896', '1664x1248'],
|
|
6958
|
+
'3:4': ['896x1184', '1248x1664'],
|
|
6959
|
+
'21:9': ['1568x672', '2208x960'],
|
|
6960
|
+
};
|
|
6961
|
+
const pair = MAP[r] || MAP['16:9'];
|
|
6962
|
+
return hd ? pair[1] : pair[0];
|
|
6963
|
+
}
|
|
6964
|
+
/** 6789 任务 id(纯函数):顶层 id / task_id,兼容 data 包装(data.task_id / data.id)。 */
|
|
6965
|
+
function api6789TaskIdOf(j) {
|
|
6966
|
+
if (!j || typeof j !== 'object') return null;
|
|
6967
|
+
return j.id ?? j.task_id ?? (j.data && (j.data.task_id ?? j.data.id)) ?? null;
|
|
6968
|
+
}
|
|
6969
|
+
/** 6789 状态(纯函数):顶层 status,兼容 data 包装(data.status)。 */
|
|
6970
|
+
function api6789StatusOf(j) {
|
|
6971
|
+
if (!j || typeof j !== 'object') return '';
|
|
6972
|
+
return String(j.status ?? (j.data && j.data.status) ?? '').trim().toLowerCase();
|
|
6973
|
+
}
|
|
6974
|
+
/** 6789 结果地址(纯函数):new-api 系中转站的字段谱系很宽,按站方官方 VideoTaskResponse
|
|
6975
|
+
* 与常见兼容形状全量覆盖——metadata.url(官方主字段)→ download_url → video_url/url →
|
|
6976
|
+
* content/output/result 包装 → data 包装 → 数组形状(output[]/data[])→ file(相对路径
|
|
6977
|
+
* 或绝对地址)。空串/缺失一律视为「未提供」(由轮询层与 /content 兜底处理,绝不在此判死)。 */
|
|
6978
|
+
function api6789VideoUrlOf(j) {
|
|
6979
|
+
if (!j || typeof j !== 'object') return '';
|
|
6980
|
+
const d = (j.data && typeof j.data === 'object') ? j.data : {};
|
|
6981
|
+
const md = (j.metadata && typeof j.metadata === 'object') ? j.metadata : (d.metadata && typeof d.metadata === 'object' ? d.metadata : {});
|
|
6982
|
+
const firstOf = (v) => (Array.isArray(v) && v.length && typeof v[0] === 'object' ? v[0] : null);
|
|
6983
|
+
const out0 = firstOf(j.output) || (typeof j.output === 'object' && !Array.isArray(j.output) ? j.output : null);
|
|
6984
|
+
const data0 = firstOf(j.data);
|
|
6985
|
+
const cands = [
|
|
6986
|
+
md.url, md.video_url, md.download_url, // new-api 官方:metadata.url
|
|
6987
|
+
j.download_url, j.video_url, j.url, j.videoUrl, j.result_url,
|
|
6988
|
+
d.download_url, d.video_url, d.url,
|
|
6989
|
+
j.content && (j.content.video_url || j.content.url),
|
|
6990
|
+
out0 && (out0.url || out0.video_url), // output 对象或 output[0]
|
|
6991
|
+
j.result && (j.result.url || j.result.video_url),
|
|
6992
|
+
data0 && (data0.url || data0.video_url), // data 数组首项
|
|
6993
|
+
];
|
|
6994
|
+
const abs = cands.find((u) => typeof u === 'string' && /^https?:/i.test(u));
|
|
6995
|
+
if (abs) return abs;
|
|
6996
|
+
const file = [j.file, d.file].find((u) => typeof u === 'string' && (u.startsWith('/') || /^https?:/i.test(u)));
|
|
6997
|
+
return file || '';
|
|
6998
|
+
}
|
|
6999
|
+
/** 6789 失败原因(纯函数):error → fail_reason → message → data.error。 */
|
|
7000
|
+
function api6789ErrorOf(j) {
|
|
7001
|
+
if (!j || typeof j !== 'object') return '';
|
|
7002
|
+
const d = (j.data && typeof j.data === 'object') ? j.data : {};
|
|
7003
|
+
const v = j.error || j.fail_reason || j.message || d.error || '';
|
|
7004
|
+
if (!v) return '';
|
|
7005
|
+
return (typeof v === 'string' ? v : JSON.stringify(v)).slice(0, 300);
|
|
7006
|
+
}
|
|
7007
|
+
/** 6789 轮询判定(纯函数):queued/running/in_progress 及未知状态 = 继续等待(new-api 官方
|
|
7008
|
+
* 用 in_progress);成功集合取地址——**有地址才 done,无地址继续等**(部分中转站 completed
|
|
7009
|
+
* 后才异步转存出 metadata.url,立即判死会丢掉刚成功的任务);失败集合报错。 */
|
|
7010
|
+
function api6789PollState(j) {
|
|
7011
|
+
const st = api6789StatusOf(j);
|
|
7012
|
+
if (['succeeded', 'completed', 'success'].includes(st)) {
|
|
7013
|
+
const url = api6789VideoUrlOf(j);
|
|
7014
|
+
return url ? { state: 'done', url } : { state: 'wait' };
|
|
7015
|
+
}
|
|
7016
|
+
if (['failed', 'error', 'cancelled', 'canceled', 'expired'].includes(st)) {
|
|
7017
|
+
return { state: 'fail', error: api6789ErrorOf(j) || st };
|
|
7018
|
+
}
|
|
7019
|
+
return { state: 'wait' };
|
|
7020
|
+
}
|
|
7021
|
+
/** 6789 本地素材是否需要「公网直链」类重试提示(纯函数):只认图片/URL/格式类错误。 */
|
|
7022
|
+
function needs6789MediaHint(errText) {
|
|
7023
|
+
const t = String(errText || '');
|
|
7024
|
+
return /https?:|url|图片|image|格式|format/i.test(t);
|
|
7025
|
+
}
|
|
6885
7026
|
/** 读取生成视频的真实尺寸与时长(用于「厂商是否忽略了参数」的可见校验)。 */
|
|
6886
7027
|
function probeVideoMeta(blob) {
|
|
6887
7028
|
return new Promise((resolve) => {
|
|
@@ -7138,6 +7279,104 @@ function queueThumb(assetId) {
|
|
|
7138
7279
|
throw err;
|
|
7139
7280
|
}
|
|
7140
7281
|
},
|
|
7282
|
+
// —— 6789API:任务制 /v1/videos,同一路径按模型分两族请求体(seedance* / minimax*)——
|
|
7283
|
+
async api6789(prompt, frameBlob, s, o) {
|
|
7284
|
+
if (!s.url) throw new Error('未配置视频 API(6789API 格式:Base URL 填站点根,…/v1 自动归一)');
|
|
7285
|
+
if (!s.model) throw new Error('请在设置里为该视频 API 填写模型名(如 seedance2.0fast / minimax-h3)');
|
|
7286
|
+
const base = vendorBase(s.url, '');
|
|
7287
|
+
if (!base) throw new Error('6789API 需要填写 Base URL');
|
|
7288
|
+
const headers = { 'Content-Type': 'application/json', Authorization: 'Bearer ' + (s.apiKey || '') };
|
|
7289
|
+
const model = String(s.model || '').toLowerCase();
|
|
7290
|
+
const isMini = model.includes('minimax');
|
|
7291
|
+
// 参考图装填:首帧在前、参考图在后;上限按模型(2.5 系 30、其余 9)——超限告警可见
|
|
7292
|
+
const cap = api6789ImageCap(model);
|
|
7293
|
+
const rawRefs = o.hardFrame ? [] : (o.refs || []).slice(0, cap);
|
|
7294
|
+
if (o.warn && (o.refs || []).length > rawRefs.length) {
|
|
7295
|
+
o.warn('参考图 ' + (o.refs || []).length + ' 张超过「' + model + '」上限 ' + cap + ' 张,本次只使用前 ' + cap + ' 张');
|
|
7296
|
+
}
|
|
7297
|
+
let text = prompt;
|
|
7298
|
+
if (frameBlob && rawRefs.length) text = videoRefNote(o.refNames) + '\n' + prompt;
|
|
7299
|
+
// 本地素材 dataURL 直发(宽松尝试,与通用链同口径);站方要求公网直链时报错原文透传
|
|
7300
|
+
const media = {
|
|
7301
|
+
frameDataUrl: frameBlob ? await blobToDataUrlScaled(frameBlob) : '',
|
|
7302
|
+
refDataUrls: await Promise.all(rawRefs.map((b) => blobToDataUrlScaled(b))),
|
|
7303
|
+
};
|
|
7304
|
+
const spec = { model, prompt: text, duration: o.duration, ratio: o.ratio, resolution: o.resolution || '720p' };
|
|
7305
|
+
const body = build6789VideoBody(spec, media);
|
|
7306
|
+
// minimax 系 2K/4K 必须至少 1 张参考图(站方文档硬约束)——提交前明确报错
|
|
7307
|
+
if (isMini && /^2K$|^4K$/i.test(String(body.size)) && !(body.images || []).length) {
|
|
7308
|
+
throw new Error('「' + model + '」的 ' + body.size + ' 清晰度必须至少提供 1 张参考图(站方硬约束):请连线参考图,或把清晰度改成 720P/1080P');
|
|
7309
|
+
}
|
|
7310
|
+
// 480p 不在 minimax 尺寸枚举 → 降档可见告警(build 内已按 768P 档映射)
|
|
7311
|
+
if (isMini && o.warn && String(o.resolution || '').toLowerCase().includes('480')) {
|
|
7312
|
+
o.warn('「' + model + '」没有 480p 尺寸档,本次按 768P 档发送(可选 720P/1080P/2K/4K)');
|
|
7313
|
+
}
|
|
7314
|
+
// 扩展参数:逃生舱(可覆盖任意字段,如 {"image_urls":["https://…"]} 公网直链直给)
|
|
7315
|
+
mergeExtra(body, s);
|
|
7316
|
+
// 幂等键:本次生成固定一个 UUID,网络重试复用(站方文档要求)
|
|
7317
|
+
const idem = (globalThis.crypto && crypto.randomUUID) ? crypto.randomUUID() : ('idem-' + Date.now().toString(36) + Math.random().toString(36).slice(2));
|
|
7318
|
+
const submitUrl = base + '/v1/videos';
|
|
7319
|
+
const r1 = await fetchViaProxy(submitUrl, { headers: { ...headers, 'Idempotency-Key': idem }, body, timeoutMs: Number(s.timeoutMs) > 0 ? Number(s.timeoutMs) : 120000, label: '6789 提交' });
|
|
7320
|
+
if (!r1.ok) {
|
|
7321
|
+
const hint = needs6789MediaHint(r1.text) && (frameBlob || rawRefs.length)
|
|
7322
|
+
? '——该站参考图要求公网 https 直链:可在扩展参数填 {"image_urls":["https://…"]}(minimax 系字段名 images)直给,或改用文生视频'
|
|
7323
|
+
: '';
|
|
7324
|
+
throw new Error('6789 提交 HTTP ' + r1.status + ' @ ' + submitUrl + ':' + r1.text.slice(0, 300) + hint);
|
|
7325
|
+
}
|
|
7326
|
+
let j1 = null; try { j1 = JSON.parse(r1.text); } catch { throw new Error('6789 响应非 JSON:' + r1.text.slice(0, 200)); }
|
|
7327
|
+
const tid = api6789TaskIdOf(j1);
|
|
7328
|
+
if (!tid) throw new Error('6789 响应中没有任务 id:' + r1.text.slice(0, 200));
|
|
7329
|
+
const taskUrl = base + '/v1/videos/' + encodeURIComponent(tid);
|
|
7330
|
+
if (o.onTask) { try { o.onTask(tid, taskUrl); } catch { /* 持久化失败不影响生成 */ } }
|
|
7331
|
+
const queryTask = async (label) => {
|
|
7332
|
+
const r = await fetchViaProxy(taskUrl, { method: 'GET', headers, timeoutMs: 60000, label });
|
|
7333
|
+
if (!r || !r.ok) return null;
|
|
7334
|
+
try { return JSON.parse(r.text); } catch { return null; }
|
|
7335
|
+
};
|
|
7336
|
+
// 站方建议每 5s 查询一次;画布最长轮询 30 分钟(任务 id 已挂节点,超时可凭 id 回查)。
|
|
7337
|
+
// 查询层兼容 new-api 官方枚举(in_progress)与各站变体;成功但无地址继续等(转存延迟)。
|
|
7338
|
+
const pollStartAt = Date.now();
|
|
7339
|
+
const contentUrl = base + '/v1/videos/' + encodeURIComponent(tid) + '/content';
|
|
7340
|
+
const url = await vendorPoll('6789', 5000, async () => {
|
|
7341
|
+
const j = await queryTask('6789 查询');
|
|
7342
|
+
if (!j) return { state: 'wait' };
|
|
7343
|
+
const st = api6789PollState(j);
|
|
7344
|
+
if (st.state === 'done') return st;
|
|
7345
|
+
// 任务已终态成功但响应始终没给地址 → 放弃轮询,走 /content 代理下载兜底
|
|
7346
|
+
// (站方文档:/content 在查询无 video_url 时代理返回视频流;409 video_not_ready 可重试)。
|
|
7347
|
+
const statusNow = api6789StatusOf(j);
|
|
7348
|
+
if (['succeeded', 'completed', 'success'].includes(statusNow) && Date.now() - (pollStartAt + 20000) > 0) {
|
|
7349
|
+
try { console.info('[IC] 6789 task ' + tid + ' succeeded without a URL in the response — falling back to /content download'); } catch { /* 忽略 */ }
|
|
7350
|
+
return { state: 'done', url: contentUrl };
|
|
7351
|
+
}
|
|
7352
|
+
return st;
|
|
7353
|
+
});
|
|
7354
|
+
// 任务成功 ≠ 文件可下载:CDN 就绪窗口内重试(10 分钟、每 30s 一次,与三宝同款口径)。
|
|
7355
|
+
// file 相对路径 → 拼 origin 且带 Bearer 下载;绝对地址裸 GET、401/403 自动带鉴权重试;
|
|
7356
|
+
// 每次重试前重查任务刷新地址(download_url 可能是带 exp 的签名地址,会过期)。
|
|
7357
|
+
const origin = (() => { try { return new URL(base).origin; } catch { return ''; } })();
|
|
7358
|
+
const dlHeaders = (u) => String(u || '').startsWith('/') ? headers
|
|
7359
|
+
: (() => { try { return new URL(u).origin === origin ? headers : {}; } catch { return {}; } })();
|
|
7360
|
+
try {
|
|
7361
|
+
return await downloadVideoWithRetry(url, dlHeaders(url), {
|
|
7362
|
+
windowMs: SANBAO_DOWNLOAD_RETRY_MS,
|
|
7363
|
+
stepMs: SANBAO_DOWNLOAD_RETRY_STEP_MS,
|
|
7364
|
+
refreshUrl: async () => {
|
|
7365
|
+
const j = await queryTask('6789 缓存查询');
|
|
7366
|
+
if (!j) return '';
|
|
7367
|
+
const st = api6789PollState(j);
|
|
7368
|
+
return st.state === 'done' ? st.url : '';
|
|
7369
|
+
},
|
|
7370
|
+
onRetry: (e, n) => {
|
|
7371
|
+
try { console.info('[IC] 6789 download not ready (' + ((e && e.message) || e) + ') — retry ' + n); } catch { /* 忽略 */ }
|
|
7372
|
+
},
|
|
7373
|
+
});
|
|
7374
|
+
} catch (e) {
|
|
7375
|
+
const err = new Error('6789 视频下载失败(任务 ' + tid + '):' + ((e && e.message) || e));
|
|
7376
|
+
err.status = e && e.status;
|
|
7377
|
+
throw err;
|
|
7378
|
+
}
|
|
7379
|
+
},
|
|
7141
7380
|
// —— MiniMax 海螺:异步 task_id + query 接口 ——
|
|
7142
7381
|
async minimax(prompt, frameBlob, s, o) {
|
|
7143
7382
|
const base = vendorBase(s.url, VIDEO_VENDORS.minimax.base);
|
|
@@ -7431,6 +7670,8 @@ function queueThumb(assetId) {
|
|
|
7431
7670
|
// 三宝:按最保守通用模型(hailuo/SD2.0 系 9 图 3 音频;wan/kling 系 10 图、SD2.5 系 30 图,见厂商 note)
|
|
7432
7671
|
sanbao: { img: 9, audio: 3 },
|
|
7433
7672
|
minimaxv2: { img: 9, audio: 3 },
|
|
7673
|
+
// 6789:seedance2.5 系 30 图、其余 9 图(api6789ImageCap 按模型取精确值,此处按保守 9 告警)
|
|
7674
|
+
api6789: { img: 9 },
|
|
7434
7675
|
openai: { img: 8 },
|
|
7435
7676
|
seedance: { img: 8 },
|
|
7436
7677
|
// img:0 = 该厂商的协议**没有任何实体参考图入口**(已核对各自 runner:只收首帧/提示词)——
|
|
@@ -9319,6 +9560,15 @@ function queueThumb(assetId) {
|
|
|
9319
9560
|
const bible = bibleBlock(loadBible(S.activeId));
|
|
9320
9561
|
const zh = effLang() !== 'en';
|
|
9321
9562
|
const contOn = !(opts && opts.cont === false); // 分镜衔接开关(默认开)
|
|
9563
|
+
// 按场打斗检测(用户定稿口径:真实有打斗才注入,绝不按题材整表灌):
|
|
9564
|
+
// 三态覆盖 data.combatMode(auto/on/off,默认 auto);on/off 用户显式覆盖优先于检测。
|
|
9565
|
+
const combatMode = String((opts && opts.combatMode) || 'auto').toLowerCase();
|
|
9566
|
+
const combat = detectCombatScene(scriptText, { mode: combatMode });
|
|
9567
|
+
// 分镜总时长(issue:下拉硬约束):targetDuration > 0 = 用户手动设定的**本分镜节点总时长**,
|
|
9568
|
+
// 严格 =X 秒——不论切 5 镜还是 50 镜,所有镜头 duration 之和必须等于 X;技能只管按节奏谱系
|
|
9569
|
+
// 把 X 分配到各镜(快冲突 0.3-0.8s / 对白 2-4s / 情绪长镜 ≥5s),装不下压每镜时长而非删戏。
|
|
9570
|
+
// 0/缺省 = 自动档:与旧版逐字一致(节奏自然决定,无硬上限)。
|
|
9571
|
+
const targetDuration = Math.max(0, Math.round(Number(opts && opts.targetDuration) * 10) / 10) || 0;
|
|
9322
9572
|
// 特效演绎开关:任一所选题材/影调卡 fx_motion:true → 追加特效演绎扩展块(见 FX_RULES)
|
|
9323
9573
|
const fxOn = await fxMotionEnabledFor(S.activeId);
|
|
9324
9574
|
const contFields = (() => {
|
|
@@ -9375,7 +9625,7 @@ function queueThumb(assetId) {
|
|
|
9375
9625
|
'- **按情绪选景别**:孤独/绝望/宏大危机=远景;对峙/动作/关系建立=全景;对话/试探/信息交换=中景;震惊/怀疑/内心动摇=近景;崩溃/嘶吼/情绪爆发=特写;关键细节/道具揭示=大特写——冲突用全景、揭秘转近景、爆发给特写、反转可拉远,景别变化本身在讲情绪;',
|
|
9376
9626
|
'- **快切镜头(<1.5s)的 visual/motion 要极短**(一个动作、一句画内信息),信息量大的镜头才配长时长——时长与内容量必须匹配;',
|
|
9377
9627
|
'- 只输出 JSON,不要输出任何其他内容。',
|
|
9378
|
-
].concat(FX_RULES, contOn ? [
|
|
9628
|
+
].concat(FX_RULES, combat.hit ? [combatContractAddendum(zh)] : [], contOn ? [
|
|
9379
9629
|
'',
|
|
9380
9630
|
'**【分镜衔接·硬性】成片是分段生成的,每段模型看不到上一段画面——衔接只能靠写在分镜里的"接点"。除末镜外,每镜都必须写 tail 与 cam:**',
|
|
9381
9631
|
'- **tail(接点尾态)**:本镜**最后一刻**的状态,一行写清——人物姿势停在哪个动作的中途、朝向、视线落点、手持物位置、位置关系(如「右手抬到胸口一半,视线仍锁在 @陈拾@ 脸上,@糯糯@ 停在他左后方半步」「已侧身转到 3/4 面,还没完全转身面对对方」)。**必须是"动作进行中"的状态,不能写成"已经完成/站定/看向"**——切点停在静止定格,下一镜就没有动作可接,接缝必然暴露;',
|
|
@@ -9407,11 +9657,15 @@ function queueThumb(assetId) {
|
|
|
9407
9657
|
'- **Never use straight double quotes " inside JSON string values** — quoted text (signs/subtitles/lines) uses 「」 instead;',
|
|
9408
9658
|
'- **Split shots by actual content**: one continuous action beat = one shot; the count is decided by the content (3-10 shots are all normal) — never pad, never use a fixed number;',
|
|
9409
9659
|
'- **[SEGMENTATION-FRIENDLY - HARD] shot boundaries must land where a cut can actually happen**: the system splits this storyboard into several generations, and a split is only allowed on a "cut" boundary - scene change / insert close-up / new character enters. Therefore: never break ONE character\'s ONE continuous action into several `continuation` shots (give that single shot a longer duration instead) - if it gets split across two generations, the two clips cannot be matched. When you genuinely change the camera, make the next shot one of scene change / insert close-up / new character (even a single insert close-up is enough) so the boundary is a clean cut rather than a forced match. **Do not fake it**: never label shots `scene_change` just to create cut points inside the same space - that reads as a jump;',
|
|
9410
|
-
'- duration is the shot length in seconds, **one decimal allowed**; **assign by pacing spectrum, never uniform**: normal narrative/dialogue 2-4s, fast conflict/fight/chase 0.3-0.8s (rapid cuts), key reversal/impact 1-2s, long emotional take >=5s — every scene must contain at least one obvious rhythm change (e.g. 3s narrative -> 0.6s cuts x2 -> 1.5s reversal -> 5s emotional take); identical durations kill the rhythm;
|
|
9660
|
+
'- duration is the shot length in seconds, **one decimal allowed**; **assign by pacing spectrum, never uniform**: normal narrative/dialogue 2-4s, fast conflict/fight/chase 0.3-0.8s (rapid cuts), key reversal/impact 1-2s, long emotional take >=5s — every scene must contain at least one obvious rhythm change (e.g. 3s narrative -> 0.6s cuts x2 -> 1.5s reversal -> 5s emotional take); identical durations kill the rhythm; '
|
|
9661
|
+
+ (targetDuration
|
|
9662
|
+
? '**[TOTAL DURATION - HARD USER OVERRIDE] the user has fixed this storyboard\'s TOTAL duration at exactly ' + targetDuration + 's**: the sum of ALL shot durations must equal ' + targetDuration + 's (±0.3s rounding tolerance on the last shot, then settle). Distribute ' + targetDuration + 's across shots by the pacing spectrum above; more shots = each shot gets proportionally less, fewer shots = more each; when content cannot fit, compress per-shot durations — never drop dialogue or key actions; a shot may go below its usual spectrum floor if needed (a 0.5s beat is legal), but the TOTAL is inviolable'
|
|
9663
|
+
: 'total duration follows what the scene needs - no hard cap (vendor limits differ and change; if exceeded the video call reports it explicitly, then you split or adjust)')
|
|
9664
|
+
+ '; shot order = narrative order; last shot lands the emotion; **if a CONTINUITY CONSTRAINT is given below, shot 1 must continue the previous scene\'s last frame and character state (no re-establishing, no wide reset); only without a constraint does shot 1 establish the scene**;',
|
|
9411
9665
|
'- **Pick the shot size by emotion**: loneliness/despair/grand crisis = wide; confrontation/action/relationship = full; dialogue/probing/info exchange = medium; shock/suspicion/inner shake = close-up; breakdown/screaming/emotional burst = extreme close-up; key detail/prop reveal = big close-up — conflicts play wide, reveals move close, bursts go extreme, reversals can pull wide; the changing distance itself tells the emotion;',
|
|
9412
9666
|
'- **Rapid cuts (<1.5s) get minimal visual/motion** (one action, one piece of in-frame information); long durations are earned by information density — duration must match content;',
|
|
9413
9667
|
'- Output JSON only.',
|
|
9414
|
-
].concat(FX_RULES, contOn ? [
|
|
9668
|
+
].concat(FX_RULES, combat.hit ? [combatContractAddendum(zh)] : [], contOn ? [
|
|
9415
9669
|
'',
|
|
9416
9670
|
'**[CONTINUITY - HARD] the film is generated in segments and each segment cannot see the previous one, so the "hand-off point" must be written into the storyboard. Every shot except the last MUST carry tail and cam:**',
|
|
9417
9671
|
'- **tail (hand-off tail state)**: the state at the LAST instant of this shot, in one line - where the posture stops mid-motion, facing, gaze target, hand/prop position, blocking (e.g. "right hand half-way up to the chest, eyes still locked on @Chen@, @Nuonuo@ half a step behind his left shoulder"). It MUST be a mid-motion state, never a settled/completed pose: a cut on a static freeze leaves nothing for the next shot to continue, which is exactly what makes the seam visible;',
|
|
@@ -9448,6 +9702,14 @@ function queueThumb(assetId) {
|
|
|
9448
9702
|
? `镜头数量:必须输出恰好 ${countNum} 镜(用户手动设置;硬性参数,不是参考值)。`
|
|
9449
9703
|
: `Shot count: output EXACTLY ${countNum} shots (set by the user; hard parameter, not a reference).`)
|
|
9450
9704
|
: `${zh ? '镜头数量' : 'Shot count'}:**不固定**——按实际动作节拍切分,由内容自然决定`;
|
|
9705
|
+
// 分镜总时长行:手动档 = 硬性参数(与 countLine 同款口径);自动档 = 如实说「不固定」。
|
|
9706
|
+
const durationLine = targetDuration
|
|
9707
|
+
? (zh
|
|
9708
|
+
? `分镜总时长:所有镜头时长之和必须**恰好等于 ${targetDuration} 秒**(用户手动设定;硬性参数,不是参考值)。切 5 镜还是 50 镜都可以,镜头数由内容按节奏决定,但每个镜头 duration 相加必须等于 ${targetDuration} 秒。`
|
|
9709
|
+
: `Storyboard total duration: the sum of ALL shot durations must be EXACTLY ${targetDuration} seconds (set by the user; hard parameter, not a reference). 5 shots or 50 are both fine — shot count follows the content's pacing, but the durations must add up to ${targetDuration}s.`)
|
|
9710
|
+
: (zh
|
|
9711
|
+
? `分镜总时长:**不固定**——由技能按节奏自然分配`
|
|
9712
|
+
: `Storyboard total duration: **not fixed** — distributed by pacing naturally`);
|
|
9451
9713
|
// 承接约束:由连线指定(分镜表「衔接上一镜」输入口 ← 上游分镜表「尾镜」输出口)。
|
|
9452
9714
|
// 只承接尾镜的**结尾瞬间**(≤0.2s 重叠),不重演上一镜——视频模型按秒计费,重演等于白花钱。
|
|
9453
9715
|
const cont = (() => {
|
|
@@ -9498,6 +9760,7 @@ function queueThumb(assetId) {
|
|
|
9498
9760
|
`${zh ? '剧本' : 'Script'}:\n${String(scriptText ?? '').trim()}`,
|
|
9499
9761
|
`${zh ? '额外要求' : 'Extra requirements'}:${String(requirement ?? '').trim() || (zh ? '无' : 'none')}`,
|
|
9500
9762
|
countLine,
|
|
9763
|
+
durationLine,
|
|
9501
9764
|
prevLine,
|
|
9502
9765
|
].filter(Boolean).join('\n\n');
|
|
9503
9766
|
const text = await aiCompleteStream({
|
|
@@ -9537,6 +9800,14 @@ function queueThumb(assetId) {
|
|
|
9537
9800
|
camera: String(s.camera || '').trim().slice(0, 160),
|
|
9538
9801
|
vfx: String(s.vfx || '').trim().slice(0, 160),
|
|
9539
9802
|
negative: String(s.negative || '').trim().slice(0, 200),
|
|
9803
|
+
// 战斗因果字段(打斗镜专用,全部可选):逐镜存分镜数据,编译与衔接链透传——
|
|
9804
|
+
// attack/reaction/impact/initiative/nextCombat,tail 追加「|战斗态:…」段。
|
|
9805
|
+
// 与 timeBeats 同一「没写就是空、绝不臆造」口径;宿主 index.js 三处映射同步放行。
|
|
9806
|
+
attack: String(s.attack || '').trim().slice(0, 160),
|
|
9807
|
+
reaction: String(s.reaction || '').trim().slice(0, 160),
|
|
9808
|
+
impact: String(s.impact || '').trim().slice(0, 160),
|
|
9809
|
+
initiative: String(s.initiative || '').trim().slice(0, 80),
|
|
9810
|
+
nextCombat: String(s.nextCombat || '').trim().slice(0, 80),
|
|
9540
9811
|
characters: Array.isArray(s.characters) ? s.characters.map(String).slice(0, 6) : [],
|
|
9541
9812
|
scene: String(s.scene || ''),
|
|
9542
9813
|
props: Array.isArray(s.props) ? s.props.map(String).slice(0, 6) : [],
|
|
@@ -10488,6 +10759,10 @@ function queueThumb(assetId) {
|
|
|
10488
10759
|
if (cam) parts.push((zh ? '机位/焦段/运镜' : 'Camera/lens/move') + ':' + cam);
|
|
10489
10760
|
const vfx = String(s.vfx || '').trim();
|
|
10490
10761
|
if (vfx) parts.push((zh ? '特效(必须可见)' : 'VFX (must be visible)') + ':' + vfx);
|
|
10762
|
+
// 打斗因果块(V3.1 嫁接):打斗镜把「攻击指向/对手回应/受力破坏/攻守归属」编进视频
|
|
10763
|
+
// 提示词——分段生成时模型看不到别的段,因果只能靠写在提示词里。空字段不注入。
|
|
10764
|
+
const cct = combatCausalityText(s, zh);
|
|
10765
|
+
if (cct) parts.push(cct);
|
|
10491
10766
|
const dls = (s.dialogue || []).map((d) => String(d && d.role || '').trim() + ':' + String(d && d.line || '').trim()).filter((x) => x.replace(':', '').trim());
|
|
10492
10767
|
if (dls.length) {
|
|
10493
10768
|
parts.push(zh
|
|
@@ -10701,7 +10976,24 @@ function queueThumb(assetId) {
|
|
|
10701
10976
|
flushSave();
|
|
10702
10977
|
try {
|
|
10703
10978
|
const prev = prevSceneTail(n); // 场 N-1 的尾镜 → 作为本场第 1 镜的硬性承接约束
|
|
10704
|
-
const
|
|
10979
|
+
const targetDur = Math.max(0, Math.round(Number(n.data.targetDuration) * 10) / 10) || 0;
|
|
10980
|
+
const shots = await aiStoryboardShots(st, n.data.requirement, Number(n.data.count) || 0, n.data.model, (kind, d) => aiStreamAppend(n.id, kind, d), prev, { cont: n.data.cont !== false, targetDuration: targetDur, combatMode: String(n.data.combatMode || 'auto') });
|
|
10981
|
+
// 总时长机械归位(issue:下拉硬约束的执行侧保底):模型 Σ≠X 时按比例缩放各镜 duration,
|
|
10982
|
+
// 末镜吸收舍入残差 → Σ 恰等于 X。只缩放时长,绝不动内容字段;自动档(targetDur=0)零操作。
|
|
10983
|
+
if (targetDur && shots.length) {
|
|
10984
|
+
const sum = shots.reduce((a, s) => a + (Number(s.duration) || 0), 0);
|
|
10985
|
+
if (sum > 0 && Math.abs(sum - targetDur) > 0.05) {
|
|
10986
|
+
const k = targetDur / sum;
|
|
10987
|
+
let acc = 0;
|
|
10988
|
+
for (let i = 0; i < shots.length; i++) {
|
|
10989
|
+
const scaled = i === shots.length - 1
|
|
10990
|
+
? Math.round((targetDur - acc) * 10) / 10 // 末镜吸收残差
|
|
10991
|
+
: Math.max(0.3, Math.round(Number(shots[i].duration) * k * 10) / 10);
|
|
10992
|
+
shots[i].duration = scaled;
|
|
10993
|
+
acc += scaled;
|
|
10994
|
+
}
|
|
10995
|
+
}
|
|
10996
|
+
}
|
|
10705
10997
|
// 未闭合引用自愈:句尾丢闭合 @ 的引用按设定集名补全(否则参考图静默丢失)
|
|
10706
10998
|
const _known = bibleNames(loadBible(S.activeId));
|
|
10707
10999
|
for (const sh of shots) {
|
|
@@ -10718,6 +11010,13 @@ function queueThumb(assetId) {
|
|
|
10718
11010
|
if (shots.length > MAX_STORYBOARD_SHOTS) {
|
|
10719
11011
|
warnings.push(T('warnShotsOverCapacity').replace('{n}', String(shots.length)));
|
|
10720
11012
|
}
|
|
11013
|
+
// 打斗镜几何最小校验(用户定稿:只告警不拦截——防误杀):朝向矛盾/无回应攻击/缺战斗态 tail。
|
|
11014
|
+
// combatMode!=='off' 时生效;与一致性告警同一 warnings 表面,用户在节点上直接可见。
|
|
11015
|
+
if (String(n.data.combatMode || 'auto') !== 'off') {
|
|
11016
|
+
for (const sh of shots) {
|
|
11017
|
+
for (const w of validateCombatGeometry(sh, zh)) warnings.push(w);
|
|
11018
|
+
}
|
|
11019
|
+
}
|
|
10721
11020
|
update((s) => {
|
|
10722
11021
|
const nd = s.graph.nodes[n.id];
|
|
10723
11022
|
if (nd) { nd.data.shots = shots; nd.data.aiStatus = 'idle'; nd.data.warnings = warnings; nd.data.status = 'done'; nd.data.error = null; nd.data.contFrom = prev ? prev.label : null; }
|
|
@@ -12572,22 +12871,41 @@ function queueThumb(assetId) {
|
|
|
12572
12871
|
const [open, setOpen] = useState(false);
|
|
12573
12872
|
const [q, setQ] = useState('');
|
|
12574
12873
|
const [custom, setCustom] = useState('');
|
|
12575
|
-
const [pos, setPos] = useState({ left: 0, top: 0, width: width || 160 });
|
|
12874
|
+
const [pos, setPos] = useState({ left: 0, top: 0, width: width || 160, flipped: false });
|
|
12576
12875
|
const btnRef = useRef(null);
|
|
12577
12876
|
const menuRef = useRef(null);
|
|
12578
|
-
|
|
12579
|
-
|
|
12877
|
+
/** 统一定位器(三处同源:openMenu 初定位 / composerReposition 跟随 / layout effect 实高校正)。
|
|
12878
|
+
* 镜像贴附语义:下翻菜单顶=按钮底+6(搜索框贴按钮);上翻菜单底=按钮顶-6(搜索框在菜单
|
|
12879
|
+
* 最下仍贴按钮)。menuH 传实际高度(layout effect 量得);初定位/跟随阶段传 0 用估算 280。 */
|
|
12880
|
+
const placeMenu = (menuH) => {
|
|
12580
12881
|
const btn = btnRef.current;
|
|
12581
|
-
if (btn
|
|
12582
|
-
|
|
12583
|
-
|
|
12584
|
-
|
|
12585
|
-
|
|
12586
|
-
|
|
12587
|
-
|
|
12588
|
-
|
|
12589
|
-
|
|
12882
|
+
if (!btn || !btn.getBoundingClientRect) return null;
|
|
12883
|
+
const r = btn.getBoundingClientRect();
|
|
12884
|
+
const mw = Math.max(Number(width) || 160, 200);
|
|
12885
|
+
const vw = window.innerWidth || 1200;
|
|
12886
|
+
const vh = window.innerHeight || 800;
|
|
12887
|
+
const pad = 8;
|
|
12888
|
+
const gap = 6;
|
|
12889
|
+
const left = Math.max(8, Math.min(r.left, vw - mw - 8));
|
|
12890
|
+
const h = Math.max(60, Number(menuH) || 280);
|
|
12891
|
+
// 空间裁决:向下放不下且上方更宽裕 → 上翻;否则下翻(下翻越界时夹视口底)。
|
|
12892
|
+
const downOver = r.bottom + gap + h - (vh - pad); // 下翻超出视口底的量
|
|
12893
|
+
const upSpace = r.top - gap - h - pad; // 上翻后距视口顶的余量
|
|
12894
|
+
const flipped = downOver > 0 && upSpace > -downOver; // 哪边溢出少选哪边
|
|
12895
|
+
let top;
|
|
12896
|
+
if (flipped) {
|
|
12897
|
+
top = r.top - gap - h; // 上翻:菜单底贴按钮顶
|
|
12898
|
+
if (top < pad) { top = Math.max(pad, Math.min(r.bottom + gap, vh - h - pad)); flipped = false; }
|
|
12899
|
+
} else {
|
|
12900
|
+
top = r.bottom + gap; // 下翻:菜单顶贴按钮底
|
|
12901
|
+
if (top + h > vh - pad) top = Math.max(pad, vh - h - pad);
|
|
12590
12902
|
}
|
|
12903
|
+
return { left, top, width: mw, flipped };
|
|
12904
|
+
};
|
|
12905
|
+
const openMenu = () => {
|
|
12906
|
+
if (disabled) return;
|
|
12907
|
+
const p = placeMenu(0); // 初定位用估算高度(菜单未渲染);layout effect 随后按实际高度校正
|
|
12908
|
+
if (p) setPos(p);
|
|
12591
12909
|
setQ('');
|
|
12592
12910
|
setCustom('');
|
|
12593
12911
|
setOpen(true);
|
|
@@ -12614,7 +12932,24 @@ function queueThumb(assetId) {
|
|
|
12614
12932
|
setOpen(false);
|
|
12615
12933
|
};
|
|
12616
12934
|
document.addEventListener('pointerdown', onDown, true);
|
|
12935
|
+
// 菜单跟随:composer 是活的(跟随节点拖动/画布缩放重定位),菜单坐标若只是打开瞬间的
|
|
12936
|
+
// 快照就会「飞离选择位置」。把自己挂进 composerReposition 链——composer 每次重定位时
|
|
12937
|
+
// 菜单同步重算(与 layout effect 同一 placeMenu:镜像方向 + flipped 一并保持)。
|
|
12938
|
+
const reposition = () => {
|
|
12939
|
+
const menu = menuRef.current;
|
|
12940
|
+
const p = placeMenu(menu && menu.getBoundingClientRect ? menu.getBoundingClientRect().height : 0);
|
|
12941
|
+
if (p) setPos(p);
|
|
12942
|
+
};
|
|
12943
|
+
const prevReposition = composerReposition;
|
|
12944
|
+
composerReposition = () => { try { reposition(); } catch { /* 定位失败不影响画布 */ } if (prevReposition) prevReposition(); };
|
|
12945
|
+
window.addEventListener('resize', reposition);
|
|
12946
|
+
// 打开瞬间校正一次:composer 自身刚完成定位(点击内容区 → composer 挂载 → 立刻点下拉),
|
|
12947
|
+
// openMenu 算到的 btn rect 可能来自 composer 定位前的那一帧——下一帧按已就位的 rect 校正。
|
|
12948
|
+
const raf = requestAnimationFrame(reposition);
|
|
12617
12949
|
return () => {
|
|
12950
|
+
cancelAnimationFrame(raf);
|
|
12951
|
+
composerReposition = prevReposition;
|
|
12952
|
+
window.removeEventListener('resize', reposition);
|
|
12618
12953
|
delete document.body.dataset.dshicPickOpen;
|
|
12619
12954
|
document.removeEventListener('pointerdown', onDown, true);
|
|
12620
12955
|
};
|
|
@@ -12628,6 +12963,19 @@ function queueThumb(assetId) {
|
|
|
12628
12963
|
const shown = (searchable && query)
|
|
12629
12964
|
? options.filter((o) => (String(o.label) + ' ' + String(o.sub || '') + ' ' + String(o.value)).toLowerCase().includes(query))
|
|
12630
12965
|
: options;
|
|
12966
|
+
// 菜单实际高度就位后的精确定位(useLayoutEffect 绘制前,无闪烁):与 placeMenu 同源——
|
|
12967
|
+
// 量真实高度重算镜像方向与贴附(初定位用估算 280,渲染后按实际高度修正)。
|
|
12968
|
+
useLayoutEffect(() => {
|
|
12969
|
+
if (!open) return;
|
|
12970
|
+
const menu = menuRef.current;
|
|
12971
|
+
if (!menu || !menu.getBoundingClientRect) return;
|
|
12972
|
+
const mr = menu.getBoundingClientRect();
|
|
12973
|
+
if (!mr.height) return;
|
|
12974
|
+
const p = placeMenu(mr.height);
|
|
12975
|
+
if (!p) return;
|
|
12976
|
+
const changed = Math.abs(p.top - pos.top) > 0.5 || Math.abs((p.left ?? 0) - (pos.left ?? 0)) > 0.5 || !!p.flipped !== !!pos.flipped;
|
|
12977
|
+
if (changed) setPos(p);
|
|
12978
|
+
}, [open, shown.length, editable]);
|
|
12631
12979
|
return h('span', {
|
|
12632
12980
|
className: cls('dshic-pick-wrap', className),
|
|
12633
12981
|
// 可收缩的下拉(模型):flex-basis = 期望宽度,min-width:0 允许被压到省略号
|
|
@@ -12647,11 +12995,11 @@ function queueThumb(assetId) {
|
|
|
12647
12995
|
h('span', { className: 'dshic-pick-car' }, '▾')),
|
|
12648
12996
|
open
|
|
12649
12997
|
? h('div', {
|
|
12650
|
-
ref: menuRef, className: 'dshic-pick-menu',
|
|
12998
|
+
ref: menuRef, className: cls('dshic-pick-menu', pos.flipped && 'is-flipped'),
|
|
12651
12999
|
style: { left: pos.left, top: pos.top, width: pos.width },
|
|
12652
13000
|
onPointerDown: (e) => e.stopPropagation(),
|
|
12653
13001
|
},
|
|
12654
|
-
searchable
|
|
13002
|
+
searchable && !pos.flipped
|
|
12655
13003
|
? h('div', { className: 'dshic-pick-search' },
|
|
12656
13004
|
h('input', {
|
|
12657
13005
|
className: 'dshic-input', autoFocus: true, placeholder: T('searchModelPh'), value: q,
|
|
@@ -12671,7 +13019,29 @@ function queueThumb(assetId) {
|
|
|
12671
13019
|
h('span', { className: 'dshic-pick-name' }, o.label),
|
|
12672
13020
|
o.sub ? h('span', { className: 'dshic-pick-sub' }, o.sub) : null))
|
|
12673
13021
|
: h('div', { className: 'dshic-pick-empty' }, T('noModelMatch'))),
|
|
12674
|
-
|
|
13022
|
+
// 上翻(镜像):搜索框/自定义输入框贴按钮的一侧(菜单最下)→ 渲染顺序整体倒置
|
|
13023
|
+
searchable && pos.flipped
|
|
13024
|
+
? h('div', { className: 'dshic-pick-search is-flipped' },
|
|
13025
|
+
h('input', {
|
|
13026
|
+
className: 'dshic-input', autoFocus: true, placeholder: T('searchModelPh'), value: q,
|
|
13027
|
+
onChange: (e) => setQ(e.target.value), onPointerDown: (e) => e.stopPropagation(),
|
|
13028
|
+
}))
|
|
13029
|
+
: null,
|
|
13030
|
+
editable && pos.flipped
|
|
13031
|
+
? h('div', { className: 'dshic-pick-custom is-flipped' },
|
|
13032
|
+
h('input', {
|
|
13033
|
+
className: 'dshic-input', type: 'text',
|
|
13034
|
+
inputMode: integer ? 'numeric' : 'decimal',
|
|
13035
|
+
placeholder: customPlaceholder || T('customValuePh'),
|
|
13036
|
+
title: customPlaceholder || T('customValuePh'),
|
|
13037
|
+
value: custom,
|
|
13038
|
+
onChange: (e) => setCustom(e.target.value),
|
|
13039
|
+
onKeyDown: (e) => { if (e && e.key === 'Enter') { e.preventDefault(); submitCustom(); } },
|
|
13040
|
+
onBlur: submitCustom,
|
|
13041
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
13042
|
+
}))
|
|
13043
|
+
: null,
|
|
13044
|
+
editable && !pos.flipped
|
|
12675
13045
|
? h('div', { className: 'dshic-pick-custom' },
|
|
12676
13046
|
h('input', {
|
|
12677
13047
|
className: 'dshic-input', type: 'text',
|
|
@@ -12773,12 +13143,15 @@ function queueThumb(assetId) {
|
|
|
12773
13143
|
|
|
12774
13144
|
// —— 模型选项:只列已配置的模型(文本取 Harness 会话可用模型;图片/视频取插件设置里的供应商+模型)——
|
|
12775
13145
|
const modelOptions = (() => {
|
|
12776
|
-
const opts = [
|
|
13146
|
+
const opts = [];
|
|
12777
13147
|
if (isTextLike) {
|
|
13148
|
+
// 文本模型才有「跟随设置」:语言模型由 Harness 会话提供,节点不选 = 用当前会话模型。
|
|
13149
|
+
opts.push({ value: '', label: T('followSettings'), sub: '' });
|
|
12778
13150
|
for (const p of ((llm && llm.providers) || [])) {
|
|
12779
13151
|
for (const m of (p.models || [])) opts.push({ value: p.id + '|' + m.id, label: m.name, sub: p.name, title: p.name + ' · ' + m.name });
|
|
12780
13152
|
}
|
|
12781
13153
|
} else if (isImage) {
|
|
13154
|
+
// 图片/视频无「跟随设置」:设置页有真实默认(★ 星标),节点不选 = 直接用 ★(resolveImageModelCfg 同语义)。
|
|
12782
13155
|
for (const m of flattenImageModels(settings)) opts.push({ value: m.ref, label: m.model, sub: m.providerName, title: m.providerName + ' · ' + m.model + (m.ref === settings.imageStar ? ' ★' : '') });
|
|
12783
13156
|
} else if (isVideo) {
|
|
12784
13157
|
for (const m of flattenVideoModels(settings)) opts.push({ value: m.ref, label: m.model, sub: m.providerName, title: m.providerName + ' · ' + m.model + (m.ref === settings.videoStar ? ' ★' : '') });
|
|
@@ -12786,6 +13159,11 @@ function queueThumb(assetId) {
|
|
|
12786
13159
|
return opts;
|
|
12787
13160
|
})();
|
|
12788
13161
|
const modelRef = isImage ? nodeImageModelRef(n) : isVideo ? nodeVideoModelRef(n) : (n.data.model || '');
|
|
13162
|
+
// 图片/视频:节点未选模型时显示 ★ 默认模型(而非「跟随设置」)——下拉里它就是普通一项,
|
|
13163
|
+
// 点它 = 显式把节点钉到该模型(写 ref),与「未选时请求侧走 ★」同一结论。
|
|
13164
|
+
const modelValue = modelRef || (!isTextLike
|
|
13165
|
+
? (isImage ? settings.imageStar : settings.videoStar) || ''
|
|
13166
|
+
: '');
|
|
12789
13167
|
const setModel = (v) => update((s) => {
|
|
12790
13168
|
const nd = s.graph.nodes[n.id];
|
|
12791
13169
|
if (!nd) return;
|
|
@@ -13041,7 +13419,7 @@ function queueThumb(assetId) {
|
|
|
13041
13419
|
// finalcut 无模型(只有比例/分辨率);其余类型模型永远排在最前
|
|
13042
13420
|
!isFinalCut
|
|
13043
13421
|
? h(PopupSelect, {
|
|
13044
|
-
value:
|
|
13422
|
+
value: modelValue, options: modelOptions, onChange: setModel, width: 172,
|
|
13045
13423
|
title: T('modelLabel'), searchable: true, className: 'is-model', shrink: true,
|
|
13046
13424
|
})
|
|
13047
13425
|
: null,
|
|
@@ -13061,17 +13439,31 @@ function queueThumb(assetId) {
|
|
|
13061
13439
|
onChange: (v) => setStoryboardPrev(n.id, v || null),
|
|
13062
13440
|
})
|
|
13063
13441
|
: null,
|
|
13064
|
-
//
|
|
13065
|
-
//
|
|
13442
|
+
// 分镜总时长(issue:下拉硬约束):首选项「按镜头节奏自动」(默认,data.targetDuration 缺省)
|
|
13443
|
+
// = 技能按节奏谱系自然分配各镜时长;选任何秒数(预设或自定义 1–300)= 本分镜节点总时长
|
|
13444
|
+
// 硬约束——不论切几镜,所有镜头 duration 之和严格等于该值(生成侧提示词注入 + 机械归位)。
|
|
13445
|
+
// 与切段规划器(planShotSegments 的 maxSeconds,恒用默认 15)解耦:本下拉只管总时长。
|
|
13066
13446
|
isStoryboard
|
|
13067
13447
|
? h(PopupSelect, {
|
|
13068
|
-
value:
|
|
13069
|
-
|
|
13070
|
-
|
|
13448
|
+
value: n.data.targetDuration != null && Number(n.data.targetDuration) > 0 ? String(Number(n.data.targetDuration)) : '',
|
|
13449
|
+
width: 84, title: T('targetDurationLabel'), className: 'is-segmax',
|
|
13450
|
+
options: [{ value: '', label: T('targetDurationAuto') }].concat([6, 8, 10, 12, 15, 20, 30].map((x) => ({ value: String(x), label: x + 's' }))),
|
|
13451
|
+
onChange: (v) => setData('targetDuration', v === '' ? null : Number(v)),
|
|
13071
13452
|
editable: true, min: 1, max: 300, integer: false, decimals: 1,
|
|
13072
13453
|
customLabel: (v) => String(v) + 's', customPlaceholder: T('customSegMaxPh'),
|
|
13073
13454
|
})
|
|
13074
13455
|
: null,
|
|
13456
|
+
isStoryboard
|
|
13457
|
+
? h(PopupSelect, {
|
|
13458
|
+
value: String(n.data.combatMode || 'auto'), width: 88, title: T('combatModeLabel'),
|
|
13459
|
+
options: [
|
|
13460
|
+
{ value: 'auto', label: T('combatAuto') },
|
|
13461
|
+
{ value: 'on', label: T('combatOn') },
|
|
13462
|
+
{ value: 'off', label: T('combatOff') },
|
|
13463
|
+
],
|
|
13464
|
+
onChange: (v) => setData('combatMode', v),
|
|
13465
|
+
})
|
|
13466
|
+
: null,
|
|
13075
13467
|
(isImage || isVideo || isFinalCut)
|
|
13076
13468
|
? h(PopupSelect, { value: n.data.ratio || '16:9', options: ratioOpts, onChange: onRatio, width: 74, title: T('ratioLabel') })
|
|
13077
13469
|
: null,
|
|
@@ -14089,7 +14481,7 @@ function queueThumb(assetId) {
|
|
|
14089
14481
|
const totalDur = shots.reduce((a, sh) => a + Math.max(0, Number(sh.duration) || 0), 0);
|
|
14090
14482
|
// 切段预览:把"这张分镜表会被切成几次生成、每次几镜几秒、哪些段要接尾帧"直接显示在节点上,
|
|
14091
14483
|
// 用户铺开前就知道会切成什么样——不用等到生成完才发现接不上。
|
|
14092
|
-
const segPlan = shots.length ? planShotSegments(shots, { maxSeconds: Number(n.data.
|
|
14484
|
+
const segPlan = shots.length ? planShotSegments(shots, { maxSeconds: Number(n.data.targetDuration) || 15 }) : null;
|
|
14093
14485
|
// 一致性告警的重校验:告警是**生成时刻**算的;设定集更新后有 bibleTick 自动重算(见下),
|
|
14094
14486
|
// 这里保留手动入口兜底——点刷新按当前设定集重算(checkShotConsistency 读的是实时 bible/资产名索引)
|
|
14095
14487
|
const [wvChecking, setWvChecking] = useState(false);
|
|
@@ -14228,7 +14620,7 @@ function queueThumb(assetId) {
|
|
|
14228
14620
|
if (!shots.length) { toast(T('expandNoShots')); return; }
|
|
14229
14621
|
const zh = effLang() !== 'en';
|
|
14230
14622
|
// 切段规划:纯函数,可在面板上预览,也由 scripts/test-segment-plan.mjs 直接断言
|
|
14231
|
-
const plan = planShotSegments(shots, { maxSeconds: Number(n.data.
|
|
14623
|
+
const plan = planShotSegments(shots, { maxSeconds: Number(n.data.targetDuration) || 15 });
|
|
14232
14624
|
const segs = plan.segments.length ? plan.segments : [{ index: 0, shots, startIndex: 0, endIndex: shots.length - 1, duration: plan.total, firstSeg: 'opening', lastSeg: 'continuation', opensOnCut: true, closesOnCut: true, seamRisk: 'none', needsTailChain: false, reason: '' }];
|
|
14233
14625
|
// 项目资产名称索引(用于把角色/场景/道具连接到已有资产节点)
|
|
14234
14626
|
const recs = await idbByProject(S.activeId).catch(() => []);
|
|
@@ -15283,12 +15675,151 @@ function queueThumb(assetId) {
|
|
|
15283
15675
|
notify();
|
|
15284
15676
|
}
|
|
15285
15677
|
|
|
15286
|
-
|
|
15287
|
-
|
|
15288
|
-
|
|
15289
|
-
|
|
15290
|
-
|
|
15291
|
-
|
|
15678
|
+
// ============================================================
|
|
15679
|
+
// 战斗语义(打斗分镜因果链):嫁接自 _refs/LucianAIGC-打斗skill-V3.1。
|
|
15680
|
+
//
|
|
15681
|
+
// 为什么:画布的连续性管道(tail → prevTail → 衔接块 → 首帧锚定)只传「画面尾态」,
|
|
15682
|
+
// 打斗的攻势归属/受击结果/攻守转换不随镜传递 → 各打各的、站桩接招、打完就散。
|
|
15683
|
+
// V3.1 的流畅来自显式战斗因果状态链(出招→接招→反击→攻守转换→位移)+ 逐镜结束状态。
|
|
15684
|
+
// 本模块把「战斗态」补进同一管道:tail 追加|战斗态段,衔接链自动跨镜、跨生成段传递。
|
|
15685
|
+
//
|
|
15686
|
+
// 注入口径(用户定稿):只在**真实有打斗的场**注入——按场自动检测 + 三态覆盖
|
|
15687
|
+
// (auto/on/off),绝不按题材整表灌;非打斗项目零变化。
|
|
15688
|
+
// 与宿主侧 combat-semantics.js 必须逐字同构(漂移守卫:scripts/test-combat-semantics.mjs)。
|
|
15689
|
+
// ============================================================
|
|
15690
|
+
/** 打斗动作语义词表:把 3D 导演台 BONE_POSES 打斗段(assets/director/engine.js,12 式)
|
|
15691
|
+
* 的关节力学翻译成「可见身体发力词」。模型演不出招式名、只能演姿势——给它可见的
|
|
15692
|
+
* 身体状态词,motion/timeBeats 才有真动作可写(打斗机械/平移的直接解药)。
|
|
15693
|
+
* id 与 3D 姿势 id 对齐(回归测试断言两表一致)。 */
|
|
15694
|
+
const COMBAT_ACTION_LEXICON = [
|
|
15695
|
+
{ id: 'spear_ready', zh: '侧身沉肩、重心压到后腿、双手前后持械', en: 'side-on stance, shoulders sunk, weight on the back leg, weapon held fore-aft' },
|
|
15696
|
+
{ id: 'spear_thrust', zh: '腰胯先拧、后腿蹬地发力把双手推出、前腿落成弓步', en: 'hips twist first, back leg drives the arms forward, front leg lands in a bow stance' },
|
|
15697
|
+
{ id: 'palm_block', zh: '单臂斜上架、掌面外翻、上身侧倾把力卸向体侧', en: 'one arm angles up, palm turned out, torso tilts to shed the force sideways' },
|
|
15698
|
+
{ id: 'dodge_lean', zh: '髋部后坐、上身后仰避开来势、双手收回护身', en: 'hips sit back, upper body leans away from the strike, hands pull in to guard' },
|
|
15699
|
+
{ id: 'dash_forward', zh: '前腿蹬直、上身前压、双臂前后摆开冲刺', en: 'front leg extends, torso presses forward, arms swing in opposition while dashing' },
|
|
15700
|
+
{ id: 'grit_advance', zh: '上身前探、双臂收紧、下颌压低逼近', en: 'torso leans in, arms tighten, jaw drops while closing in' },
|
|
15701
|
+
{ id: 'low_sweep', zh: '深蹲转体、持械手贴地横扫、另一手撑地', en: 'deep-squat pivot, weapon hand sweeps low along the ground, other hand plants on the floor' },
|
|
15702
|
+
{ id: 'spear_ground', zh: '单膝下沉、持械手直下压、上身俯冲', en: 'one knee sinks, weapon hand drives straight down, torso dives' },
|
|
15703
|
+
{ id: 'crouch_low', zh: '单膝跪地、上身压到近地、持械手垂落收势', en: 'kneeling, torso pressed near the ground, weapon hand settling low' },
|
|
15704
|
+
{ id: 'ult_charge', zh: '抬头挺胸、双臂外展上举、重心拔起蓄力', en: 'chest open, both arms spread and raised, weight rising as power gathers' },
|
|
15705
|
+
{ id: 'hit_recoil', zh: '上身后折、双臂散开、后脚撤半步卸力', en: 'upper body folds back, arms fly open, rear foot steps back to absorb the hit' },
|
|
15706
|
+
{ id: 'knockdown', zh: '全身放倒、四肢摊开、重心彻底失守', en: 'body laid flat, limbs sprawled, balance fully broken' },
|
|
15707
|
+
];
|
|
15708
|
+
/** 按场打斗检测(纯函数):命中词 = 明确动作谓语(不是氛围词);排除 = 对白行 /
|
|
15709
|
+
* 回忆·讲述语境(命中词前 6 字含过去式/叙事标记);mode: auto=按文本,on=强制开,
|
|
15710
|
+
* off=强制关(用户显式覆盖优先于检测)。只看本场剧本文本,绝不看题材标签。 */
|
|
15711
|
+
function detectCombatScene(text, opts) {
|
|
15712
|
+
const o = opts || {};
|
|
15713
|
+
const mode = String(o.mode || o.combatMode || 'auto').toLowerCase();
|
|
15714
|
+
if (mode === 'on') return { hit: true, matched: [], mode: 'on' };
|
|
15715
|
+
if (mode === 'off') return { hit: false, matched: [], mode: 'off' };
|
|
15716
|
+
const t = String(text || '');
|
|
15717
|
+
if (!t.trim()) return { hit: false, matched: [], mode: 'auto' };
|
|
15718
|
+
const HIT = new RegExp([
|
|
15719
|
+
'出招', '过招', '交手', '开打', '对打', '搏杀', '厮杀', '互殴', '挥拳', '出拳', '出腿',
|
|
15720
|
+
'肘击', '膝撞', '挥刀', '拔刀', '挥剑', '出剑', '劈', '砍', '斩', '刺出', '突刺', '横扫',
|
|
15721
|
+
'扫堂腿', '鞭腿', '摆拳', '勾拳', '直拳', '抡', '格挡', '招架', '挡开', '架开', '闪避',
|
|
15722
|
+
'躲开', '闪身', '翻滚', '侧身避开', '击中', '命中', '打中', '一拳', '一掌', '一剑', '一刀',
|
|
15723
|
+
'一枪', '受击', '挨打', '被打', '击退', '击飞', '打飞', '撂倒', '打倒', '击倒', '摔倒',
|
|
15724
|
+
'摔出', '撞飞', '撞碎', '掀翻', '锁喉', '擒拿', '反关节', '压制', '按倒', '反击', '还击',
|
|
15725
|
+
'回击', '追击', '对轰', '火并', '枪战', '交火', '开枪', '射击', '扫射', '暗器', '箭矢',
|
|
15726
|
+
'刀光', '剑气', '掌风', '拳风', '破甲', '贯穿', '震飞', '踹', '砸向',
|
|
15727
|
+
].join('|'), 'g');
|
|
15728
|
+
const DIALOGUE = /说道|说:|说道:|喊道|念道|心里想|暗想|旁白|字幕|歌词/;
|
|
15729
|
+
const PAST = /(曾|当年|想起|回忆|听说|讲述|史料|新闻|棋局|牌局|谈判|演习|训练|梦里|梦中|传说|故事里|电影里)/;
|
|
15730
|
+
const lines = t.split(/\n|。|;|;|!|?|!|\?/);
|
|
15731
|
+
const matched = [];
|
|
15732
|
+
for (const ln of lines) {
|
|
15733
|
+
if (!ln || DIALOGUE.test(ln)) continue;
|
|
15734
|
+
const ms = ln.match(HIT) || [];
|
|
15735
|
+
for (const w of ms) {
|
|
15736
|
+
const i = ln.indexOf(w);
|
|
15737
|
+
if (PAST.test(ln.slice(Math.max(0, i - 6), i))) continue;
|
|
15738
|
+
matched.push(w);
|
|
15739
|
+
break;
|
|
15740
|
+
}
|
|
15741
|
+
if (matched.length >= 6) break;
|
|
15742
|
+
}
|
|
15743
|
+
return { hit: matched.length > 0, matched, mode: 'auto' };
|
|
15744
|
+
}
|
|
15745
|
+
/** 打斗镜判定(纯函数):任一战斗字段非空即为打斗镜。字段全部可选、逐镜存分镜数据,
|
|
15746
|
+
* 与 timeBeats/camera/vfx 同一「没写就是空、绝不臆造」口径。 */
|
|
15747
|
+
function shotIsCombat(s) {
|
|
15748
|
+
const sh = s || {};
|
|
15749
|
+
return ['attack', 'reaction', 'impact', 'initiative', 'nextCombat'].some((k) => String(sh[k] || '').trim());
|
|
15750
|
+
}
|
|
15751
|
+
/** 分镜契约战斗扩展块(纯函数):命中打斗的场才注入。核心三件事:
|
|
15752
|
+
* ① 战斗字段语义(attack/reaction/impact/initiative/nextCombat + tail 追加战斗态);
|
|
15753
|
+
* ② 攻防硬规则(攻击必指向对手、对手必可见回应、受力与破坏有因果、禁招式名/概括词);
|
|
15754
|
+
* ③ 动作词表(3D 姿势反哺的可见发力词,让 motion/timeBeats 有真动作可写)。 */
|
|
15755
|
+
function combatContractAddendum(zh) {
|
|
15756
|
+
if (!zh) {
|
|
15757
|
+
return [
|
|
15758
|
+
'',
|
|
15759
|
+
'**[COMBAT STORYBOARD - HARD] this script contains real combat. Shots may carry combat fields (all optional; leave them empty on non-combat shots, never invent):**',
|
|
15760
|
+
'- **attack**: "attacker -> target, locked body part, trajectory", e.g. "@Li@->@Shen@, locked on chest/shoulder, spear thrust from lower-left to upper-right" - an attack MUST point at a concrete opponent on screen;',
|
|
15761
|
+
'- **reaction (required when attack exists)**: the opponent\'s visible block/dodge/hit action - never a statue receiving a blow, never just "blocked it";',
|
|
15762
|
+
'- **impact**: contact part, force direction, knockback/imbalance and environmental damage;',
|
|
15763
|
+
'- **initiative**: who holds the attack and who turns to counter at the end of this shot;',
|
|
15764
|
+
'- **nextCombat**: the next shot\'s combat intent, echoing the tail\'s combat state;',
|
|
15765
|
+
'- **tail gains a combat state**: write "picture tail state | combat state: who holds the attack, where the weapon/effect is, the hit party\'s state, damage residue" - cross-shot momentum rides entirely on this;',
|
|
15766
|
+
'- **timeBeats on combat shots use attack-defense beats**: strike -> opponent receives/counters -> counter or displacement (each beat a visible body state);',
|
|
15767
|
+
'- **action lexicon (visible body force, take directly):** ' + COMBAT_ACTION_LEXICON.map((x) => x.en).join('; ') + ';',
|
|
15768
|
+
'- **never**: move names ("Crouching Tiger style"), summary verbs ("releases a skill / launches an attack / energy explodes"), unexplained teleports, glide drifting, statue trading; write visible body-force chains + opponent response + physical results;',
|
|
15769
|
+
'- for materialized-technique shots write vfx as a picture that could be a keyframe still; when expanding prefer keyframe-then-video (hard first frame).',
|
|
15770
|
+
];
|
|
15771
|
+
}
|
|
15772
|
+
return [
|
|
15773
|
+
'',
|
|
15774
|
+
'**【打斗分镜·战斗因果(本剧本命中打斗,以下为硬规则)】分镜镜头可携带战斗字段(全部可选;非打斗镜一律留空,绝不臆造):**',
|
|
15775
|
+
'- **attack(攻击)**:「攻击者→目标,锁定部位,轨迹方向」,如「@李寒@→@沈铁@,锁定胸肩,自左下向右上横枪突刺」——**攻击必须指向画面里的具体对手**,写明轨迹与锁定部位;',
|
|
15776
|
+
'- **reaction(对手回应;有 attack 必写)**:对手的可见防御/闪避/受击动作(如「@沈铁@ 单臂斜上架、掌面外翻、上身侧倾卸力」)——**禁止站桩接招、禁止只写「挡下了」**;',
|
|
15777
|
+
'- **impact(接触与受力)**:接触部位、受力方向、击退/失衡与环境破坏(如「枪尖擦肩、沈铁后撤半步、身后木栏断裂」);',
|
|
15778
|
+
'- **initiative(攻守归属)**:本镜结束时谁持攻、谁转入反击;',
|
|
15779
|
+
'- **nextCombat(下一镜战斗意图)**:如「@沈铁@ 借卸力之势低身横扫」——与 tail 的战斗态呼应;',
|
|
15780
|
+
'- **tail 追加战斗态**:接点尾态写成「画面尾态|战斗态:攻势在谁、武器/技能位于何处、受击者状态、破坏残留」——**跨镜攻势全靠它传递**;',
|
|
15781
|
+
'- **timeBeats 打斗镜用攻防三拍**:出招 → 对手接招/受击 → 反击或位移(每拍写可见身体状态);',
|
|
15782
|
+
'- **动作词表(可见身体发力,直接取用)**:' + COMBAT_ACTION_LEXICON.map((x) => x.zh).join(';') + ';',
|
|
15783
|
+
'- **禁止**:招式名(「回风落雁式」)、概括词(「释放技能/发动攻击/能量爆炸/华丽连招」)、无因瞬移、滑步漂移、站桩对轰;写**可见的身体发力链 + 对手回应 + 物理结果**;',
|
|
15784
|
+
'- 具象化招式镜(能量成形/武器光效)的 vfx 写成可直接出设定图的画面,铺开时优先「先出关键帧设定图 → 图生视频(hard 首帧)」。',
|
|
15785
|
+
];
|
|
15786
|
+
}
|
|
15787
|
+
/** 逐镜因果句(纯函数):视频提示词编译时追加到打斗镜。只拼存在的字段;空镜返回 ''。 */
|
|
15788
|
+
function combatCausalityText(s, zh) {
|
|
15789
|
+
const sh = s || {};
|
|
15790
|
+
if (!shotIsCombat(sh)) return '';
|
|
15791
|
+
const g = (k) => String(sh[k] || '').trim();
|
|
15792
|
+
const bits = [];
|
|
15793
|
+
if (zh) {
|
|
15794
|
+
if (g('attack')) bits.push('攻击(必须朝向该对手):' + g('attack'));
|
|
15795
|
+
if (g('reaction')) bits.push('对手回应(必须演出):' + g('reaction'));
|
|
15796
|
+
if (g('impact')) bits.push('接触与受力:' + g('impact'));
|
|
15797
|
+
if (g('initiative')) bits.push('攻守归属:' + g('initiative'));
|
|
15798
|
+
if (g('nextCombat')) bits.push('下一镜从该攻势继续:' + g('nextCombat'));
|
|
15799
|
+
return bits.length ? '【打斗因果】' + bits.join(';') : '';
|
|
15800
|
+
}
|
|
15801
|
+
if (g('attack')) bits.push('attack (must point at that opponent): ' + g('attack'));
|
|
15802
|
+
if (g('reaction')) bits.push('opponent response (must be performed): ' + g('reaction'));
|
|
15803
|
+
if (g('impact')) bits.push('contact & force: ' + g('impact'));
|
|
15804
|
+
if (g('initiative')) bits.push('initiative: ' + g('initiative'));
|
|
15805
|
+
if (g('nextCombat')) bits.push('next shot continues from this momentum: ' + g('nextCombat'));
|
|
15806
|
+
return bits.length ? '[COMBAT CAUSALITY] ' + bits.join('; ') : '';
|
|
15807
|
+
}
|
|
15808
|
+
/** 打斗镜几何最小校验(纯函数):只做四条机械可判的检查,失败产生**可见告警**,
|
|
15809
|
+
* 绝不拦截生成(防误杀)。返回告警字符串数组。 */
|
|
15810
|
+
function validateCombatGeometry(s, zh) {
|
|
15811
|
+
const sh = s || {};
|
|
15812
|
+
const out = [];
|
|
15813
|
+
const g = (k) => String(sh[k] || '').trim();
|
|
15814
|
+
const pre = String(sh.title || '').trim() ? String(sh.title).trim() + ' · ' : '';
|
|
15815
|
+
if (!shotIsCombat(sh)) return out;
|
|
15816
|
+
if (g('attack') && !g('reaction')) out.push(zh ? pre + '有攻击但无对手回应:每次攻击必须写对手的可见防御/闪避/受击(禁站桩)' : pre + 'attack without reaction: every attack needs a visible response (no statues)');
|
|
15817
|
+
if (g('attack') && !/→|@/.test(g('attack'))) out.push(zh ? pre + '攻击未指向具体对手(缺少 @对手名@ 或 →)' : pre + 'attack lacks an explicit target (@name@ or ->)');
|
|
15818
|
+
const vis = String(sh.visual || '');
|
|
15819
|
+
if (/背对|背面|背影/.test(vis) && /表情|眼神|眼眸|面容|脸上的|嘴角/.test(vis)) out.push(zh ? pre + '可见性矛盾:背对镜头却写了表情/眼神' : pre + 'visibility conflict: back to camera yet describing facial expression');
|
|
15820
|
+
if (g('attack') && g('tail') && !/战斗态|combat state/i.test(g('tail'))) out.push(zh ? pre + 'tail 建议补「|战斗态:…」(跨镜攻势靠它传递)' : pre + 'tail should append "| combat state: ..." (cross-shot momentum rides on it)');
|
|
15821
|
+
return out;
|
|
15822
|
+
}
|
|
15292
15823
|
|
|
15293
15824
|
/**
|
|
15294
15825
|
* 组装某生成能力下的注入切片文本。返回 { text, bytes };任一层缺失则跳过。
|
|
@@ -15324,10 +15855,12 @@ function queueThumb(assetId) {
|
|
|
15324
15855
|
}
|
|
15325
15856
|
if (profile.form) await push('form', (manifest.forms || []).find((x) => x.id === profile.form));
|
|
15326
15857
|
if (profile.look) await push('look', (manifest.looks || []).find((x) => x.id === profile.look));
|
|
15327
|
-
//
|
|
15858
|
+
// 运镜词典跟着分镜与提示词走;打斗节奏只在分镜且**按场检测命中打斗**时注入
|
|
15859
|
+
// (2026-11 定稿:题材不再参与判定;combatMode 三态与 Host skill-pack.js 同口径)。
|
|
15860
|
+
// 画布自生成走 aiStoryboardShots 的 combat.hit 判定,不在本函数重复检测——
|
|
15861
|
+
// 这里只服务「预览面板」(buildSkillPackText,无 sceneText 上下文)→ 保持不判定。
|
|
15328
15862
|
if (kind === 'storyboard' || kind === 'prompt') {
|
|
15329
15863
|
const mids = ['camera-moves'];
|
|
15330
|
-
if (kind === 'storyboard' && (profile.genres || []).some((g) => FIGHT_RHYTHM_GENRES.has(g))) mids.push('fight-rhythm');
|
|
15331
15864
|
for (const mid of mids) {
|
|
15332
15865
|
const mv = (manifest.moves || []).find((x) => x.id === mid);
|
|
15333
15866
|
if (mv) await push('moves', { ...mv, oneliner: mv.oneliner || '' });
|
|
@@ -22164,10 +22697,10 @@ const DIRECTOR_KEY_HELP = [
|
|
|
22164
22697
|
// IC-04:参考图上传三件套的纯函数出口(供 scripts/test-image-upload.mjs 直接断言)
|
|
22165
22698
|
window.__DSH_IC_IMGREF__ = { rawImageDims, sniffImageEncoding, registerReferenceAsset };
|
|
22166
22699
|
// IC-03:视频厂商识别/前缀归一化的纯函数出口(供 scripts/test-vendor-detect.mjs 直接断言)
|
|
22167
|
-
window.__DSH_IC_VENDOR__ = { detectVideoVendor, gatewayPrefixFor, wanEndpoints, vendorBase, VIDEO_REF_CAPS, needsSimpleMediaRetry, buildSimpleMediaRetryBody, wanTaskIdOf, wanStatusOf, wanPollState, buildSanbaoVideoBody, sanbaoTaskIdOf, sanbaoPollState, needsSanbaoMediaRetry, retryableDownloadError, downloadVideoWithRetry, SANBAO_DOWNLOAD_RETRY_MS, SANBAO_DOWNLOAD_RETRY_STEP_MS, buildSanbaoImageBody, sanbaoImageResultOf, sanbaoImagePollState, bibleStyleAnchor };
|
|
22700
|
+
window.__DSH_IC_VENDOR__ = { detectVideoVendor, gatewayPrefixFor, wanEndpoints, vendorBase, VIDEO_REF_CAPS, needsSimpleMediaRetry, buildSimpleMediaRetryBody, wanTaskIdOf, wanStatusOf, wanPollState, buildSanbaoVideoBody, sanbaoTaskIdOf, sanbaoPollState, needsSanbaoMediaRetry, retryableDownloadError, downloadVideoWithRetry, SANBAO_DOWNLOAD_RETRY_MS, SANBAO_DOWNLOAD_RETRY_STEP_MS, buildSanbaoImageBody, sanbaoImageResultOf, sanbaoImagePollState, bibleStyleAnchor, build6789VideoBody, api6789SizeOf, api6789ImageCap, api6789TaskIdOf, api6789StatusOf, api6789VideoUrlOf, api6789ErrorOf, api6789PollState, needs6789MediaHint };
|
|
22168
22701
|
// 按镜头切段(分段生成本身就是最容易出错的地方):规划器 + 强弱模型分流 + 节点段区间解析
|
|
22169
22702
|
// 供 scripts/test-segment-plan.mjs 直接断言
|
|
22170
|
-
window.__DSH_IC_SEGMENT__ = { planShotSegments, isCutPoint, segmentNeedsHardFrame, videoSegmentOf, shotContinuityPlan };
|
|
22703
|
+
window.__DSH_IC_SEGMENT__ = { planShotSegments, isCutPoint, segmentNeedsHardFrame, videoSegmentOf, shotContinuityPlan, detectCombatScene, shotIsCombat, combatContractAddendum, combatCausalityText, validateCombatGeometry, COMBAT_ACTION_LEXICON };
|
|
22171
22704
|
window.__DSH_IC_STORYBOARD_PROMPT__ = { buildStoryboardVideoPrompt };
|
|
22172
22705
|
// 视频请求组装(0.20.2):run 与「请求预览」的单一事实源——
|
|
22173
22706
|
// assembleVideoRequest(组装+校验门)/ previewVideoInputs(预览轻量 inputs)/ videoRequestContext(决策基座)
|