fix(canvas): 视频重新生成 - 继承上游连线保持并行节点关系而非子节点 (#75)
Co-authored-by: sikongyue <3155157671@qq.com>
This commit is contained in:
1 parent
24bbb73c06
commit
a4d2e90852
3 files changed
+10
-1
No files matched your search
@@ -22,6 +22,7 @@ export type CanvasGenerationExecution = CanvasGenerationExecutorDependencies & {
|
|||||||
nodeId: string;
|
nodeId: string;
|
||||||
sourceNode: CanvasNodeData | undefined;
|
sourceNode: CanvasNodeData | undefined;
|
||||||
canvasNodes: CanvasNodeData[];
|
canvasNodes: CanvasNodeData[];
|
||||||
|
canvasConnections: CanvasConnection[];
|
||||||
prompt: string;
|
prompt: string;
|
||||||
effectivePrompt: string;
|
effectivePrompt: string;
|
||||||
generationConfig: AiConfig;
|
generationConfig: AiConfig;
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ export async function executeVideoGeneration({
|
|||||||
generationContext,
|
generationContext,
|
||||||
controller,
|
controller,
|
||||||
projectId,
|
projectId,
|
||||||
|
canvasConnections,
|
||||||
setNodes,
|
setNodes,
|
||||||
setConnections,
|
setConnections,
|
||||||
startGenerationRequest,
|
startGenerationRequest,
|
||||||
@@ -73,7 +74,13 @@ export async function executeVideoGeneration({
|
|||||||
{ ...videoNode, metadata: { ...videoNode.metadata, versionOfNodeId: rootId, versionLabel: nextLabel, versionPrimary: true } },
|
{ ...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);
|
startGenerationRequest(videoId, nodeId, nodeId, controller);
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -183,6 +183,7 @@ export function useCanvasGenerationExecutor({
|
|||||||
nodeId,
|
nodeId,
|
||||||
sourceNode,
|
sourceNode,
|
||||||
canvasNodes: nodesRef.current,
|
canvasNodes: nodesRef.current,
|
||||||
|
canvasConnections: connectionsRef.current,
|
||||||
prompt,
|
prompt,
|
||||||
effectivePrompt,
|
effectivePrompt,
|
||||||
generationConfig,
|
generationConfig,
|
||||||
|
|||||||
Reference in new issue
Block a user