mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-31 01:37:58 -05:00
remove comments
This commit is contained in:
@@ -20,11 +20,6 @@ const CONDITION_TIMEOUT_MS = 5000
|
||||
* Evaluates a single condition expression.
|
||||
* Variable resolution is handled consistently with the function block via the function_execute tool.
|
||||
* Returns true if condition is met, false otherwise.
|
||||
*
|
||||
* @param ctx - Execution context
|
||||
* @param conditionExpression - The condition expression to evaluate
|
||||
* @param providedEvalContext - Optional evaluation context with variables
|
||||
* @param currentNodeId - Optional current node ID for parallel branch context resolution
|
||||
*/
|
||||
export async function evaluateConditionExpression(
|
||||
ctx: ExecutionContext,
|
||||
@@ -95,15 +90,12 @@ export class ConditionBlockHandler implements BlockHandler {
|
||||
): Promise<BlockOutput> {
|
||||
const conditions = this.parseConditions(inputs.conditions)
|
||||
|
||||
// In parallel branches, block.id is virtual (e.g., "condition₍0₎") but connections
|
||||
// use original IDs (e.g., "condition"). Extract the base ID for connection lookups.
|
||||
const baseBlockId = extractBaseBlockId(block.id)
|
||||
const branchIndex = isBranchNodeId(block.id) ? extractBranchIndex(block.id) : null
|
||||
|
||||
const sourceConnection = ctx.workflow?.connections.find((conn) => conn.target === baseBlockId)
|
||||
let sourceBlockId = sourceConnection?.source
|
||||
|
||||
// If we're in a parallel branch, look up the virtual source block ID for the same branch
|
||||
if (sourceBlockId && branchIndex !== null) {
|
||||
const virtualSourceId = buildBranchNodeId(sourceBlockId, branchIndex)
|
||||
if (ctx.blockStates.has(virtualSourceId)) {
|
||||
|
||||
@@ -99,7 +99,6 @@ export function collectBlockData(
|
||||
const blockNameMapping: Record<string, string> = {}
|
||||
const blockOutputSchemas: Record<string, OutputSchema> = {}
|
||||
|
||||
// Determine if we're in a parallel branch context
|
||||
const branchIndex =
|
||||
currentNodeId && isBranchNodeId(currentNodeId) ? extractBranchIndex(currentNodeId) : null
|
||||
|
||||
@@ -107,14 +106,10 @@ export function collectBlockData(
|
||||
if (state.output !== undefined) {
|
||||
blockData[id] = state.output
|
||||
|
||||
// If we're in a parallel branch and this state is from the same branch,
|
||||
// also map it under the base block ID so references like <BlockName.field>
|
||||
// resolve correctly within the same branch context
|
||||
if (branchIndex !== null && isBranchNodeId(id)) {
|
||||
const stateBranchIndex = extractBranchIndex(id)
|
||||
if (stateBranchIndex === branchIndex) {
|
||||
const baseId = extractBaseBlockId(id)
|
||||
// Only set if not already set (prefer branch-specific data)
|
||||
if (blockData[baseId] === undefined) {
|
||||
blockData[baseId] = state.output
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user