Line data Source code
1 : import type {
2 : ExecutionContext,
3 : WorkflowExecutionContext
4 : } from '@comfyorg/telemetry/types'
5 : import type { AppMode } from '@comfyorg/graph-model/appMode'
6 :
7 : interface WorkflowExecutionContextOptions {
8 : executableNodeCount: number
9 : executionScope: WorkflowExecutionContext['execution_scope']
10 : viewMode: AppMode
11 : }
12 :
13 0 : export function toWorkflowExecutionContext(
14 : executionContext: ExecutionContext,
15 : {
16 : executableNodeCount,
17 : executionScope,
18 : viewMode
19 : }: WorkflowExecutionContextOptions
20 : ): WorkflowExecutionContext {
21 0 : return {
22 : workflow_type: executionContext.is_template ? 'template' : 'custom',
23 : view_mode: viewMode,
24 : execution_scope: executionScope,
25 : total_node_count: executionContext.total_node_count,
26 : executable_node_count: executableNodeCount,
27 : custom_node_count: executionContext.custom_node_count,
28 : api_node_count: executionContext.api_node_count,
29 : subgraph_count: executionContext.subgraph_count
30 : }
31 : }
|