Skip to content

修复异步生图完成后错误刷新当前节点参数的问题(fix: prevent async generation from refreshing active nodes) - #178

Open
Rayen21 wants to merge 2 commits into
hero8152:mainfrom
Rayen21:pr-node-refresh
Open

修复异步生图完成后错误刷新当前节点参数的问题(fix: prevent async generation from refreshing active nodes)#178
Rayen21 wants to merge 2 commits into
hero8152:mainfrom
Rayen21:pr-node-refresh

Conversation

@Rayen21

@Rayen21 Rayen21 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

问题描述

当一个生图节点正在运行时,如果用户选中画布中的其他节点,前一个生图任务完成后,当前选中的节点会被错误地刷新为前一个生图节点的参数。

可能被覆盖的内容包括:

  • API 平台
  • 模型
  • Seed
  • 分辨率
  • 生图数量
  • 图生图或其他生成参数
  • ComfyUI 工作流参数

这会导致用户正在查看或编辑的节点参数被后台任务意外修改。

修复内容

  • 在生图任务开始时保存本次任务的参数快照。
  • 异步任务执行过程中使用参数快照,而不是继续读取全局当前参数。
  • 将参数快照传递给 API、视频、RunningHub、ModelScope 和 ComfyUI 的执行路径。
  • 生图完成后,根据原始生图节点恢复参数。
  • 如果用户在任务运行期间选中了其他节点,则保留其他节点原本的参数不变。
  • 避免后台任务完成时覆盖用户当前正在编辑的节点。

预期效果

例如:

  1. 选中节点 A 并开始生图。
  2. 节点 A 仍在运行时,选中节点 B。
  3. 节点 A 完成生图。
  4. 节点 B 的 API、模型、Seed、分辨率等参数保持不变。
  5. 节点 A 的运行参数只作用于节点 A。

验证

已通过以下检查:

  • node --check static/js/smart-canvas.js
  • git diff --check

Summary

Fixes an issue where an asynchronous image generation task could overwrite the settings of another node selected while the task was still running.

Problem

When one generation node was running, selecting another existing or newly created node could cause the completed generation task to refresh the selected node with the previous task's settings, including:

  • API provider
  • Model
  • Seed
  • Resolution
  • Generation parameters

This happened because the async completion path relied on the globally selected node and mutable global settings.

Changes

  • Capture a snapshot of the generation settings when a task starts.
  • Pass the snapshot through API, video, RunningHub, ModelScope, and ComfyUI generation paths.
  • Restore settings based on the original generation node after completion.
  • Prevent background generation tasks from overwriting the currently selected node.
  • Preserve the correct active-node context when restoring settings after success or failure.

Validation

  • node --check static/js/smart-canvas.js
  • git diff --check

This PR only contains the node-refresh bug fix and does not include the Draw Things gRPCServerCLI changes.

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.

1 participant