diff --git a/plugins/antianqi/ai-node-canvas/.minimax-plugin/plugin.json b/plugins/antianqi/ai-node-canvas/.minimax-plugin/plugin.json index 89c7a9d6..c6222a7a 100644 --- a/plugins/antianqi/ai-node-canvas/.minimax-plugin/plugin.json +++ b/plugins/antianqi/ai-node-canvas/.minimax-plugin/plugin.json @@ -2,7 +2,7 @@ "schemaVersion": 1, "name": "ai-node-canvas", "displayName": "节点画布", - "version": "1.22.9", + "version": "1.22.10", "description": "无限画布节点编排:把 MiniMax 模型生成的文本、图片、视频串成工作流,连线即数据流,上游产物可直接被下游引用。", "author": "antianqi", "icon": "icon.png", diff --git a/plugins/antianqi/ai-node-canvas/README.md b/plugins/antianqi/ai-node-canvas/README.md index c9fd2712..732577d0 100644 --- a/plugins/antianqi/ai-node-canvas/README.md +++ b/plugins/antianqi/ai-node-canvas/README.md @@ -5,7 +5,7 @@ English | [简体中文](README.zh-CN.md) An infinite-canvas node graph for MiniMax Code, modelled on the canvas of `work.batvid.com`. -Author: [antianqi](https://github.com/antianqi) · Version: `1.22.9` +Author: [antianqi](https://github.com/antianqi) · Version: `1.22.10` ![The canvas with the 图片复刻 template on it: a reference picture goes in, the prompt is read back out of that picture, and a new picture is made from the prompt](docs/preview.png) @@ -465,7 +465,7 @@ video. They are not one request with different parameters: | Request | What is sent | Who can run it | | --- | --- | --- | | First frame | `input_image` + `reference_type: first_frame` | all three models | -| First+last frame | the first frame + `last_frame_image` | H3 and H3-Max | +| First+last frame | `input_image` + `reference_type: first_frame` + `last_frame_image` | H3 and H3-Max | | Last frame | `input_image` + `reference_type: last_frame` | H3 and H3-Max | | Reference set | `reference_images` / `reference_videos` / `reference_audios` | H3 only | diff --git a/plugins/antianqi/ai-node-canvas/README.zh-CN.md b/plugins/antianqi/ai-node-canvas/README.zh-CN.md index b0a27169..9a5d3fa8 100644 --- a/plugins/antianqi/ai-node-canvas/README.zh-CN.md +++ b/plugins/antianqi/ai-node-canvas/README.zh-CN.md @@ -5,7 +5,7 @@ MiniMax Code 里的无限画布节点图。每个节点是一次模型运行,每条连线是一条数据通路—— 把文本节点连到图片节点,上游文本会自动注入下游提示词。 -作者:[antianqi](https://github.com/antianqi) · 版本:`1.22.9` +作者:[antianqi](https://github.com/antianqi) · 版本:`1.22.10` ![画布:铺了「图片复刻」模板——参考图进去,提示词从这张图里反推出来,再照着它重新生成一张](docs/preview.png) @@ -264,7 +264,7 @@ provider 有**几种不同的请求**把素材变成视频,不是同一个请 | 请求 | 送什么 | 谁会跑 | | --- | --- | --- | | 首帧 | `input_image` + `reference_type: first_frame` | 三个模型都会 | -| 首尾帧 | 首帧 + `last_frame_image` | H3、H3-Max | +| 首尾帧 | `input_image` + `reference_type: first_frame` + `last_frame_image` | H3、H3-Max | | 末帧 | `input_image` + `reference_type: last_frame` | H3、H3-Max | | 参考集合 | `reference_images` / `reference_videos` / `reference_audios` | 只有 H3 | diff --git a/plugins/antianqi/ai-node-canvas/miniapp/node/connector-runner.mjs b/plugins/antianqi/ai-node-canvas/miniapp/node/connector-runner.mjs index a7c02fc3..49a504cf 100644 --- a/plugins/antianqi/ai-node-canvas/miniapp/node/connector-runner.mjs +++ b/plugins/antianqi/ai-node-canvas/miniapp/node/connector-runner.mjs @@ -555,9 +555,11 @@ export function createConnectorRunner(context, options = {}) { // one when the mode says the picture is the ending. const anchor = shape.kind === 'lastFrame' ? shape.last.url : shape.first.url; request.input_image = { url: anchor }; - // reference_type says which end the picture is: the first frame, - // the last one, or a clip that ends on it. - request.reference_type = shape.kind === 'keyframe' ? 'first_frame' : 'last_frame'; + // reference_type says what input_image is. The provider takes + // ONE ending: when last_frame_image stands beside it, input_image + // has to be declared the first frame — declaring it the last one + // there is two endings, and the provider refuses the request. + request.reference_type = shape.kind === 'lastFrame' ? 'last_frame' : 'first_frame'; // The frame decides the shape, so the provider ignores a ratio here. // Without a frame there is nothing to follow, and the run is a plain // text-to-video one that needs a shape of its own. diff --git a/plugins/antianqi/ai-node-canvas/package.json b/plugins/antianqi/ai-node-canvas/package.json index 31ccc807..275e47d9 100644 --- a/plugins/antianqi/ai-node-canvas/package.json +++ b/plugins/antianqi/ai-node-canvas/package.json @@ -1,6 +1,6 @@ { "name": "ai-node-canvas", - "version": "1.22.9", + "version": "1.22.10", "private": true, "description": "Node-graph canvas MiniApp for MiniMax Code: wire MiniMax model runs into a visual workflow.", "mcode": { diff --git a/plugins/antianqi/ai-node-canvas/tests/smoke.test.mjs b/plugins/antianqi/ai-node-canvas/tests/smoke.test.mjs index ef956739..946dcef7 100644 --- a/plugins/antianqi/ai-node-canvas/tests/smoke.test.mjs +++ b/plugins/antianqi/ai-node-canvas/tests/smoke.test.mjs @@ -3473,7 +3473,7 @@ test('a picture becomes a video in three different ways, and the provider is ask const firstLast = await submitWith('firstLast'); assert.deepEqual(firstLast.input_image, { url: 'https://cdn.example.com/first.png' }); assert.deepEqual(firstLast.last_frame_image, { url: 'https://cdn.example.com/last.png' }); - assert.equal(firstLast.reference_type, 'last_frame'); + assert.equal(firstLast.reference_type, 'first_frame'); assert.equal(firstLast.ratio, 'adaptive'); assert.equal(firstLast.reference_images, undefined); @@ -12078,3 +12078,43 @@ test('an audio the provider would refuse is converted before it goes up', async const leftovers = await readdir(workDir).catch(() => []); assert.deepEqual(leftovers.filter((name) => name.endsWith('.mp3')), [], 'the converted copy was left behind'); }); + +test('the first and last frame request declares one ending only', async (t) => { + // The provider takes ONE ending. When last_frame_image stands beside + // input_image, input_image has to be declared the first frame — declaring + // it the last one there is two endings, and the provider refuses the + // request outright. + const connector = createMockHostConnector(undefined, { videoState: 'succeeded' }); + const h = await createHarness({ hostConnector: connector }); + t.after(() => h.cleanup()); + + const started = await fetch(`${h.base}/api/runs`, { + method: 'POST', + headers: { 'content-type': 'application/json' }, + body: JSON.stringify({ + nodeId: 'n_both_frames', + mode: 'video', + prompt: '一只猫在跑', + modelKey: 'MiniMax-H3', + params: { resolution: '768P', duration: 6 }, + path: 'firstLast', + frames: [ + { id: 'n_first', kind: 'image', role: 'first', url: 'https://cdn.example.com/first.png' }, + { id: 'n_last', kind: 'image', role: 'last', url: 'https://cdn.example.com/last.png' }, + ], + references: [ + { id: 'n_first', title: '首帧', kind: 'image', text: '', media: [{ url: 'https://cdn.example.com/first.png', kind: 'image' }] }, + { id: 'n_last', title: '末帧', kind: 'image', text: '', media: [{ url: 'https://cdn.example.com/last.png', kind: 'image' }] }, + ], + }), + }); + assert.equal(started.status, 202); + await waitForCall(connector.calls, (call) => call.toolRef.endsWith('submit-video-generation')); + const calls = connector.calls.filter((call) => call.toolRef.endsWith('submit-video-generation')); + const args = calls[calls.length - 1].args; + // The first picture is the first frame, and it says so. + assert.deepEqual(args.input_image, { url: 'https://cdn.example.com/first.png' }); + assert.equal(args.reference_type, 'first_frame'); + // The ending rides in its own field, so the two never both claim the end. + assert.deepEqual(args.last_frame_image, { url: 'https://cdn.example.com/last.png' }); +});