fix(canvas): 视频重新生成 - 继承上游连线保持并行节点关系而非子节点 (#75)

Co-authored-by: sikongyue <3155157671@qq.com>
This commit is contained in:
爱笑的毛毛虫
2026-08-02 14:39:58 +08:00
committed by GitHub
parent 24bbb73c06
commit a4d2e90852
3 changed files with 10 additions and 1 deletions

View File

@@ -22,6 +22,7 @@ export type CanvasGenerationExecution = CanvasGenerationExecutorDependencies & {
nodeId: string;
sourceNode: CanvasNodeData | undefined;
canvasNodes: CanvasNodeData[];
canvasConnections: CanvasConnection[];
prompt: string;
effectivePrompt: string;
generationConfig: AiConfig;

View File

@@ -22,6 +22,7 @@ export async function executeVideoGeneration({
generationContext,
controller,
projectId,
canvasConnections,
setNodes,
setConnections,
startGenerationRequest,
@@ -73,7 +74,13 @@ export async function executeVideoGeneration({
{ ...videoNode, metadata: { ...videoNode.metadata, versionOfNodeId: rootId, versionLabel: nextLabel, versionPrimary: true } },
];
});
if (!isEmptyVideoNode) setConnections((current) => [...current, { id: nanoid(), fromNodeId: nodeId, toNodeId: videoId }]);
// 重新生成已有视频时,新节点继承源视频的上游连接,与源视频保持并行关系,而不是作为其下游子节点。
if (!isEmptyVideoNode) {
setConnections((current) => {
if (!isExistingVideoNode) return [...current, { id: nanoid(), fromNodeId: nodeId, toNodeId: videoId }];
return [...current, ...canvasConnections.filter((connection) => connection.toNodeId === nodeId).map((connection) => ({ ...connection, id: nanoid(), toNodeId: videoId }))];
});
}
startGenerationRequest(videoId, nodeId, nodeId, controller);
try {

View File

@@ -183,6 +183,7 @@ export function useCanvasGenerationExecutor({
nodeId,
sourceNode,
canvasNodes: nodesRef.current,
canvasConnections: connectionsRef.current,
prompt,
effectivePrompt,
generationConfig,