mirror of
https://github.com/simstudioai/sim.git
synced 2026-02-17 09:52:38 -05:00
improvement(docs): simplify docs and add examples/pictures of v5 (#1887)
* improvement(docs): added new platform ss * rename approval to human in the loop * cleanup * remove yml * removed other languages large sections * fix icons
This commit is contained in:
@@ -15,7 +15,7 @@ export enum BlockType {
|
||||
VARIABLES = 'variables',
|
||||
|
||||
RESPONSE = 'response',
|
||||
APPROVAL = 'approval',
|
||||
HUMAN_IN_THE_LOOP = 'human_in_the_loop',
|
||||
WORKFLOW = 'workflow',
|
||||
WORKFLOW_INPUT = 'workflow_input',
|
||||
|
||||
|
||||
@@ -30,13 +30,13 @@ function createBlock(id: string, metadataId: string): SerializedBlock {
|
||||
}
|
||||
}
|
||||
|
||||
describe('DAGBuilder pause-resume transformation', () => {
|
||||
describe('DAGBuilder human-in-the-loop transformation', () => {
|
||||
it('creates trigger nodes and rewires edges for pause blocks', () => {
|
||||
const workflow: SerializedWorkflow = {
|
||||
version: '1',
|
||||
blocks: [
|
||||
createBlock('start', BlockType.STARTER),
|
||||
createBlock('pause', BlockType.APPROVAL),
|
||||
createBlock('pause', BlockType.HUMAN_IN_THE_LOOP),
|
||||
createBlock('finish', BlockType.FUNCTION),
|
||||
],
|
||||
connections: [
|
||||
|
||||
@@ -147,7 +147,7 @@ export class NodeConstructor {
|
||||
branchIndex,
|
||||
branchTotal: expansion.branchCount,
|
||||
distributionItem: expansion.distributionItems[branchIndex],
|
||||
isPauseResponse: baseBlock.metadata?.id === BlockType.APPROVAL,
|
||||
isPauseResponse: baseBlock.metadata?.id === BlockType.HUMAN_IN_THE_LOOP,
|
||||
originalBlockId: baseBlock.id,
|
||||
},
|
||||
}
|
||||
@@ -160,7 +160,7 @@ export class NodeConstructor {
|
||||
): void {
|
||||
const isLoopNode = blocksInLoops.has(block.id)
|
||||
const loopId = isLoopNode ? this.findLoopIdForBlock(block.id, dag) : undefined
|
||||
const isPauseBlock = block.metadata?.id === BlockType.APPROVAL
|
||||
const isPauseBlock = block.metadata?.id === BlockType.HUMAN_IN_THE_LOOP
|
||||
|
||||
dag.nodes.set(block.id, {
|
||||
id: block.id,
|
||||
|
||||
@@ -13,7 +13,7 @@ import type { BlockStateWriter, ContextExtensions } from '@/executor/execution/t
|
||||
import {
|
||||
generatePauseContextId,
|
||||
mapNodeMetadataToPauseScopes,
|
||||
} from '@/executor/pause-resume/utils.ts'
|
||||
} from '@/executor/human-in-the-loop/utils.ts'
|
||||
import type {
|
||||
BlockHandler,
|
||||
BlockLog,
|
||||
@@ -65,7 +65,7 @@ export class BlockExecutor {
|
||||
const nodeMetadata = this.buildNodeMetadata(node)
|
||||
let cleanupSelfReference: (() => void) | undefined
|
||||
|
||||
if (block.metadata?.id === BlockType.APPROVAL) {
|
||||
if (block.metadata?.id === BlockType.HUMAN_IN_THE_LOOP) {
|
||||
cleanupSelfReference = this.preparePauseResumeSelfReference(ctx, node, block, nodeMetadata)
|
||||
}
|
||||
|
||||
@@ -296,7 +296,7 @@ export class BlockExecutor {
|
||||
block: SerializedBlock,
|
||||
output: NormalizedBlockOutput
|
||||
): NormalizedBlockOutput {
|
||||
if (block.metadata?.id === BlockType.APPROVAL) {
|
||||
if (block.metadata?.id === BlockType.HUMAN_IN_THE_LOOP) {
|
||||
const filtered: NormalizedBlockOutput = {}
|
||||
for (const [key, value] of Object.entries(output)) {
|
||||
if (key.startsWith('_')) continue
|
||||
|
||||
@@ -12,14 +12,14 @@ import {
|
||||
import {
|
||||
generatePauseContextId,
|
||||
mapNodeMetadataToPauseScopes,
|
||||
} from '@/executor/pause-resume/utils.ts'
|
||||
} from '@/executor/human-in-the-loop/utils'
|
||||
import type { BlockHandler, ExecutionContext, PauseMetadata } from '@/executor/types'
|
||||
import { collectBlockData } from '@/executor/utils/block-data'
|
||||
import type { SerializedBlock } from '@/serializer/types'
|
||||
import { normalizeBlockName } from '@/stores/workflows/utils'
|
||||
import { executeTool } from '@/tools'
|
||||
|
||||
const logger = createLogger('PauseResumeBlockHandler')
|
||||
const logger = createLogger('HumanInTheLoopBlockHandler')
|
||||
|
||||
interface JSONProperty {
|
||||
id: string
|
||||
@@ -55,9 +55,9 @@ interface NotificationToolResult {
|
||||
durationMs?: number
|
||||
}
|
||||
|
||||
export class PauseResumeBlockHandler implements BlockHandler {
|
||||
export class HumanInTheLoopBlockHandler implements BlockHandler {
|
||||
canHandle(block: SerializedBlock): boolean {
|
||||
return block.metadata?.id === BlockType.APPROVAL
|
||||
return block.metadata?.id === BlockType.HUMAN_IN_THE_LOOP
|
||||
}
|
||||
|
||||
async execute(
|
||||
@@ -4,7 +4,7 @@ import { ConditionBlockHandler } from '@/executor/handlers/condition/condition-h
|
||||
import { EvaluatorBlockHandler } from '@/executor/handlers/evaluator/evaluator-handler'
|
||||
import { FunctionBlockHandler } from '@/executor/handlers/function/function-handler'
|
||||
import { GenericBlockHandler } from '@/executor/handlers/generic/generic-handler'
|
||||
import { PauseResumeBlockHandler } from '@/executor/handlers/pause-resume/pause-resume-handler'
|
||||
import { HumanInTheLoopBlockHandler } from '@/executor/handlers/human-in-the-loop/human-in-the-loop-handler'
|
||||
import { ResponseBlockHandler } from '@/executor/handlers/response/response-handler'
|
||||
import { RouterBlockHandler } from '@/executor/handlers/router/router-handler'
|
||||
import { TriggerBlockHandler } from '@/executor/handlers/trigger/trigger-handler'
|
||||
@@ -20,7 +20,7 @@ export {
|
||||
FunctionBlockHandler,
|
||||
GenericBlockHandler,
|
||||
ResponseBlockHandler,
|
||||
PauseResumeBlockHandler,
|
||||
HumanInTheLoopBlockHandler,
|
||||
RouterBlockHandler,
|
||||
TriggerBlockHandler,
|
||||
VariablesBlockHandler,
|
||||
|
||||
@@ -11,7 +11,7 @@ import { ConditionBlockHandler } from '@/executor/handlers/condition/condition-h
|
||||
import { EvaluatorBlockHandler } from '@/executor/handlers/evaluator/evaluator-handler'
|
||||
import { FunctionBlockHandler } from '@/executor/handlers/function/function-handler'
|
||||
import { GenericBlockHandler } from '@/executor/handlers/generic/generic-handler'
|
||||
import { PauseResumeBlockHandler } from '@/executor/handlers/pause-resume/pause-resume-handler'
|
||||
import { HumanInTheLoopBlockHandler } from '@/executor/handlers/human-in-the-loop/human-in-the-loop-handler'
|
||||
import { ResponseBlockHandler } from '@/executor/handlers/response/response-handler'
|
||||
import { RouterBlockHandler } from '@/executor/handlers/router/router-handler'
|
||||
import { TriggerBlockHandler } from '@/executor/handlers/trigger/trigger-handler'
|
||||
@@ -34,13 +34,12 @@ export function createBlockHandlers(): BlockHandler[] {
|
||||
new ConditionBlockHandler(),
|
||||
new RouterBlockHandler(),
|
||||
new ResponseBlockHandler(),
|
||||
new PauseResumeBlockHandler(),
|
||||
new HumanInTheLoopBlockHandler(),
|
||||
new AgentBlockHandler(),
|
||||
new VariablesBlockHandler(),
|
||||
new WorkflowBlockHandler(),
|
||||
new WaitBlockHandler(),
|
||||
new EvaluatorBlockHandler(),
|
||||
|
||||
new GenericBlockHandler(),
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user