mirror of
https://github.com/simstudioai/sim.git
synced 2026-02-06 20:55:23 -05:00
improvement(preview): nested workflow snapshots/preview when not executed
This commit is contained in:
@@ -31,6 +31,7 @@ interface BlockExecutionData {
|
||||
/** Child trace spans for nested workflow blocks */
|
||||
children?: TraceSpan[]
|
||||
childWorkflowSnapshotId?: string
|
||||
childWorkflowName?: string
|
||||
}
|
||||
|
||||
/** Represents a level in the workflow navigation stack */
|
||||
@@ -87,6 +88,7 @@ export function buildBlockExecutions(spans: TraceSpan[]): Record<string, BlockEx
|
||||
|
||||
for (const span of allBlockSpans) {
|
||||
if (span.blockId && !blockExecutionMap[span.blockId]) {
|
||||
const output = span.output as Record<string, unknown> | undefined
|
||||
blockExecutionMap[span.blockId] = {
|
||||
input: redactApiKeys(span.input || {}),
|
||||
output: redactApiKeys(span.output || {}),
|
||||
@@ -94,6 +96,8 @@ export function buildBlockExecutions(spans: TraceSpan[]): Record<string, BlockEx
|
||||
durationMs: span.duration || 0,
|
||||
children: span.children,
|
||||
childWorkflowSnapshotId: span.childWorkflowSnapshotId,
|
||||
childWorkflowName:
|
||||
typeof output?.childWorkflowName === 'string' ? output.childWorkflowName : undefined,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -192,7 +196,7 @@ export function Preview({
|
||||
const childTraceSpans = extractChildTraceSpans(blockExecution)
|
||||
const childBlockExecutions = buildBlockExecutions(childTraceSpans)
|
||||
|
||||
const workflowName = childWorkflowState.metadata?.name || 'Nested Workflow'
|
||||
const workflowName = blockExecution?.childWorkflowName || 'Nested Workflow'
|
||||
|
||||
setWorkflowStack((prev) => [
|
||||
...prev,
|
||||
|
||||
Reference in New Issue
Block a user