@@ -411,6 +411,19 @@ def format_value(x):
411411 else :
412412 return str (x )
413413
414+ def _is_intermediate_output (dynprompt , node_id ):
415+ class_type = dynprompt .get_node (node_id )["class_type" ]
416+ class_def = nodes .NODE_CLASS_MAPPINGS [class_type ]
417+ return getattr (class_def , 'HAS_INTERMEDIATE_OUTPUT' , False )
418+
419+ def _send_cached_ui (server , node_id , display_node_id , cached , prompt_id , ui_outputs ):
420+ if server .client_id is None :
421+ return
422+ cached_ui = cached .ui or {}
423+ server .send_sync ("executed" , { "node" : node_id , "display_node" : display_node_id , "output" : cached_ui .get ("output" , None ), "prompt_id" : prompt_id }, server .client_id )
424+ if cached .ui is not None :
425+ ui_outputs [node_id ] = cached .ui
426+
414427async def execute (server , dynprompt , caches , current_item , extra_data , executed , prompt_id , execution_list , pending_subgraph_results , pending_async_nodes , ui_outputs ):
415428 unique_id = current_item
416429 real_node_id = dynprompt .get_real_node_id (unique_id )
@@ -421,11 +434,7 @@ async def execute(server, dynprompt, caches, current_item, extra_data, executed,
421434 class_def = nodes .NODE_CLASS_MAPPINGS [class_type ]
422435 cached = await caches .outputs .get (unique_id )
423436 if cached is not None :
424- if server .client_id is not None :
425- cached_ui = cached .ui or {}
426- server .send_sync ("executed" , { "node" : unique_id , "display_node" : display_node_id , "output" : cached_ui .get ("output" ,None ), "prompt_id" : prompt_id }, server .client_id )
427- if cached .ui is not None :
428- ui_outputs [unique_id ] = cached .ui
437+ _send_cached_ui (server , unique_id , display_node_id , cached , prompt_id , ui_outputs )
429438 get_progress_state ().finish_progress (unique_id )
430439 execution_list .cache_update (unique_id , cached )
431440 return (ExecutionResult .SUCCESS , None , None )
@@ -767,6 +776,16 @@ async def execute_async(self, prompt, prompt_id, extra_data={}, execute_outputs=
767776 self .caches .outputs .poll (ram_headroom = self .cache_args ["ram" ])
768777 else :
769778 # Only execute when the while-loop ends without break
779+ # Send cached UI for intermediate output nodes that weren't executed
780+ for node_id in dynamic_prompt .all_node_ids ():
781+ if node_id in executed :
782+ continue
783+ if not _is_intermediate_output (dynamic_prompt , node_id ):
784+ continue
785+ cached = await self .caches .outputs .get (node_id )
786+ if cached is not None :
787+ display_node_id = dynamic_prompt .get_display_node_id (node_id )
788+ _send_cached_ui (self .server , node_id , display_node_id , cached , prompt_id , ui_node_outputs )
770789 self .add_message ("execution_success" , { "prompt_id" : prompt_id }, broadcast = False )
771790
772791 ui_outputs = {}
0 commit comments