@ninkch/dsh-infinite-canvas 0.19.12 → 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.
Files changed (2) hide show
  1. package/client.js +24 -22
  2. package/package.json +1 -1
package/client.js CHANGED
@@ -5979,6 +5979,7 @@ function queueThumb(assetId) {
5979
5979
  j.video && j.video.url,
5980
5980
  j.output && (j.output.url || j.output.video_url),
5981
5981
  j.result && (j.result.url || j.result.video_url),
5982
+ j.data && j.data.result_url,
5982
5983
  // OpenAI 风格视频任务(如 JUAI):完成响应把结果放在 metadata.url
5983
5984
  j.metadata && (j.metadata.url || j.metadata.video_url),
5984
5985
  Array.isArray(j.data) && j.data[0] && (j.data[0].url || j.data[0].video_url),
@@ -6263,22 +6264,12 @@ function queueThumb(assetId) {
6263
6264
  }
6264
6265
  function detectVideoVendor(s) {
6265
6266
  if (!s) return 'openai';
6267
+ // 厂商格式(设置下拉)= 唯一权威路由:选了什么就用什么,模型名绝不参与。
6268
+ // 曾经按模型名猜(wan3.0-video → 误走 DashScope 官方格式),中转站收不到认识的字段直接 502。
6266
6269
  if (s.vendor) return s.vendor;
6267
6270
  const url = String(s.url || '').toLowerCase();
6268
- const model = String(s.model || '').toLowerCase();
6269
- // 模型名优先:第三方网关(relayrouter 等)的 URL 看不出真实厂商,只有模型名能说明
6270
- if (/wanx|万相|(^|[^a-z])wan(\d|[-_]\d|x)/.test(model)) return 'wan';
6271
- if (/minimax-?h3|hailuo-?03/.test(model)) return 'minimaxv2'; // H3 走 V2 协议(必须先于 V1 minimax 判定)
6272
- if (/(^|[^a-z])kling/.test(model)) return 'kling';
6273
- if (/minimax|hailuo/.test(model)) return 'minimax';
6274
- if (/vidu/.test(model)) return 'vidu';
6275
- if (/runway/.test(model)) return 'runway';
6276
- if (/(^|[^a-z])veo/.test(model)) return 'veo';
6277
- if (/luma|ray[-_]?[12]/.test(model)) return 'luma';
6278
- if (/pixverse/.test(model)) return 'pixverse';
6279
- if (/stable-?video|(^|[^a-z])svd/.test(model)) return 'stability';
6280
- if (/seedance/.test(model)) return 'seedance';
6281
- // URL 兜底识别
6271
+ // URL 特征兜底:URL 也是用户显式配置的一部分(旧配置 vendor 字段为空时走这里,
6272
+ // 设置卡片渲染时会按此回填 vendor,之后恒走显式值)。
6282
6273
  if (url.includes('dashscope')) return 'wan';
6283
6274
  if (url.includes('klingai')) return 'kling';
6284
6275
  if (url.includes('minimax')) return 'minimax';
@@ -6766,6 +6757,9 @@ function queueThumb(assetId) {
6766
6757
  if (!base.replace(/^https?:\/\//i, '').includes('/')) base = base + '/v1';
6767
6758
  else if (/\/v1$/.test(base)) base = base + '/video/generations';
6768
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);
6769
6763
  const headers = { 'Content-Type': 'application/json', ...(s.apiKey ? { Authorization: 'Bearer ' + s.apiKey } : {}) };
6770
6764
  // 尾帧+参考图同连(跨镜衔接)→ 尾帧降级为第一张衔接参考图(first_frame/reference_image 互斥),标注写在提示词里
6771
6765
  const vRefs = o.hardFrame ? [] : (o.refs || []).slice(0, 8);
@@ -6774,24 +6768,30 @@ function queueThumb(assetId) {
6774
6768
  const body = {
6775
6769
  ...(s.model ? { model: s.model } : {}),
6776
6770
  prompt,
6777
- duration: Number(o.duration) || 5,
6771
+ duration: Math.min(30, Math.max(2, Number(o.duration) || 5)),
6778
6772
  // 分辨率一律小写(Seedance 系为 '720p'/'1080p';'720P' 会被部分网关判为不支持)
6779
6773
  resolution: (o.resolution || '720p').toLowerCase(),
6780
6774
  ratio: o.ratio || '16:9',
6781
6775
  };
6776
+ if (isMoyuFlavor) body.resolution = String(o.resolution || '1080P').toUpperCase(); // moyu 枚举 480P/720P/1080P
6782
6777
  // 首帧图生视频:构图以首帧为准——Seedance 系要求首帧模式必须 ratio=adaptive(仅纯首帧模式)
6783
6778
  if (frameBlob && !downgrade) {
6784
6779
  body.ratio = 'adaptive';
6785
- try { body.image = await blobToDataUrlScaled(frameBlob); } catch { /* 忽略首帧编码失败 */ }
6780
+ if (isMoyuFlavor) body.input_reference = await blobToDataUrlScaled(frameBlob);
6781
+ else try { body.image = await blobToDataUrlScaled(frameBlob); } catch { /* 忽略首帧编码失败 */ }
6786
6782
  } else if (vRefs.length) {
6787
6783
  const imgs = downgrade ? [frameBlob].concat(vRefs) : vRefs;
6788
- body.images = isOpenaiVideo
6789
- ? await Promise.all(imgs.map(async (b) => ({ url: await blobToDataUrlScaled(b), role: 'reference_image' })))
6790
- : await Promise.all(imgs.map((b) => blobToDataUrlScaled(b)));
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)));
6791
6789
  }
6792
6790
  // 可选参数:勾选才发送 generate_audio;output_format 留空不发送
6793
- if (s.generateAudio === true) body.generate_audio = true;
6794
- if (String(s.outputFormat || '').trim()) body.output_format = String(s.outputFormat).trim();
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
+ }
6795
6795
  // 角色声音参考(@引用实体名下的音频资产)→ audios[]:模型生成的对白/声音向参考音色对齐;
6796
6796
  // 带声音参考时强制开启同步音频(否则参考无意义)
6797
6797
  if (o.audioRefs && o.audioRefs.length) {
@@ -6869,7 +6869,7 @@ function queueThumb(assetId) {
6869
6869
  const DONE = ['succeeded', 'success', 'completed', 'complete', 'done', 'finished'];
6870
6870
  if (status && FAIL.includes(status)) {
6871
6871
  const msg = (st.error && (st.error.message || st.error.msg)) || st.message || st.msg || st.reason
6872
- || (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;
6873
6873
  return String(msg).slice(0, 300);
6874
6874
  }
6875
6875
  if (status && DONE.includes(status)) return null; // 成功但没解析出地址:交给调用方超时/后续处理
@@ -17975,6 +17975,8 @@ const DIRECTOR_KEY_HELP = [
17975
17975
  kind === 'video' ? h('div', { key: 'vendor', className: 'dshic-field' },
17976
17976
  h('div', { className: 'dshic-row' },
17977
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; })(),
17978
17980
  InfoTip((VIDEO_VENDORS[detectVideoVendor(p)] || {}).note || '')),
17979
17981
  h('select', {
17980
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.12",
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",