Send the current progress state to the client
(self, prompt_id: str, nodes: Dict[str, NodeProgressState])
| 158 | self.registry = registry |
| 159 | |
| 160 | def _send_progress_state(self, prompt_id: str, nodes: Dict[str, NodeProgressState]): |
| 161 | """Send the current progress state to the client""" |
| 162 | if self.server_instance is None: |
| 163 | return |
| 164 | |
| 165 | # Only send info for non-pending nodes |
| 166 | active_nodes = { |
| 167 | node_id: { |
| 168 | "value": state["value"], |
| 169 | "max": state["max"], |
| 170 | "state": state["state"].value, |
| 171 | "node_id": node_id, |
| 172 | "prompt_id": prompt_id, |
| 173 | "display_node_id": self.registry.dynprompt.get_display_node_id(node_id), |
| 174 | "parent_node_id": self.registry.dynprompt.get_parent_node_id(node_id), |
| 175 | "real_node_id": self.registry.dynprompt.get_real_node_id(node_id), |
| 176 | } |
| 177 | for node_id, state in nodes.items() |
| 178 | if state["state"] != NodeState.Pending |
| 179 | } |
| 180 | |
| 181 | # Send a combined progress_state message with all node states |
| 182 | # Include client_id to ensure message is only sent to the initiating client |
| 183 | self.server_instance.send_sync( |
| 184 | "progress_state", {"prompt_id": prompt_id, "nodes": active_nodes}, self.server_instance.client_id |
| 185 | ) |
| 186 | |
| 187 | @override |
| 188 | def start_handler(self, node_id: str, state: NodeProgressState, prompt_id: str): |
no test coverage detected