Skip to content

[bugfix] canvas: fill the last frame for models that declare it - #98

Merged
nikiwang-125 merged 1 commit into
mainfrom
fix/canvas-last-frame-autofill
Nov 5, 2026
Merged

nikiwang-125 merged 1 commit into
mainfrom
fix/canvas-last-frame-autofill

Conversation

@nikiwang-125

Copy link
Copy Markdown
Collaborator

Summary

首尾帧模式下,依次把两张图片连到视频节点,只要节点选的是已配置的服务模型,第二张图片就不会填入尾帧。连线的命令层对所有服务模型都直接跳过尾帧槽位,没有读取模型实际的帧能力。因此像 MiniMax V2(frameRoles=[first_frame, last_frame])这样支持首尾帧的模型,第二张图会保持 reference 角色,提交时被标为 context_only 而不会发给模型。

Fixes #83

Changes

  • fillConnectedFrames 新增可选参数 FrameCapabilities,由它决定是否自动填尾帧;新增 modelFrameCapabilities(models),从所选模型配置的 inputRules.frameRoles 读取尾帧能力。
  • applyCommand / executeCommand 透传该参数,覆盖单条连线、批量连线和切换到首尾帧模式三种情况。画布工作区根据当前模型目录传入能力。
  • 未传入能力时(旧文档初始化、其他调用方)保持原有保守行为:已配置的服务模型只填首帧,避免填入模型不支持的尾帧而导致无法生成。
  • 已手动选择或清空的槽位依旧不会被自动重新填充。

Validation

  • node --test tests/frameReferences.test.ts:8 passed,新增 3 个用例(声明尾帧的模型按连线顺序填首尾帧;批量连线和切换模式时同样生效;未知模型或仅支持首帧的模型不会填尾帧)。
  • npm test:568 passed,0 failed。
  • tsc --noEmit、vite build:通过。
  • npm run check:i18n:未通过,原因是已有的 src/canvas/AssistantTracePage.tsx 有 16 行中文超出基线,main 上同样失败,与本次改动无关;本次没有新增文案。

Remaining validation

  • 未在真实浏览器中走一遍端到端流程,也未调用真实的 MiniMax 服务。后端 reference_policy 在尾帧槽位已选定时的行为与 issue 中的验证一致,本次未改动后端。

🤖 Generated with Claude Code

Connecting two images to a first-last video node skipped the last-frame
slot for every configured service model, so a MiniMax V2 model that
declares frameRoles=[first_frame, last_frame] only ever received the
first image; the second stayed a context-only reference and was never
sent.

The command layer now takes optional frame capabilities. The workspace
derives them from the configured model's inputRules, so the last slot is
filled in edge order only when the model accepts it. Without the
capabilities (legacy initialisation, other callers) a configured model is
still treated as first-frame only.

Fixes #83

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nikiwang-125
nikiwang-125 merged commit f9e358c into main Nov 5, 2026
nikiwang-125 added a commit that referenced this pull request Nov 5, 2026
* [test] browser: connect two images to a first-last video node

Add an isolated browser check for #83. It uploads two real images, adds a
blank video node on a MiniMax model that declares first and last frames,
switches to first-last mode without touching the frame pickers, and drags
both images onto the node on the canvas. It then checks that the composer
shows the first and last frames in edge order, that the project stores
first_frame and last_frame references, and that the assignment survives a
reload.

The check fails on the code before #98 (the last frame stays empty) and
passes on main. No remote generation is called.

Refs #83

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* [test] browser: pick the MiniMax config by id in the frame check

Other browser checks register their own MiniMax-H3 configurations on the
shared fixture, so choosing the model by its label matched several options
and the picker click failed in strict mode. Select this check's own
configuration by its option id instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@hsliuustc0106
hsliuustc0106 deleted the fix/canvas-last-frame-autofill branch November 6, 2026 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] 画布:首尾帧模式连接第二张图片未分配尾帧,图片未传入模型

1 participant