Skip to content

Commit 619cc14

Browse files
committed
fix(copilot): simplify condition evaluation to single matchesOperation call
1 parent 33cb3ed commit 619cc14

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

apps/sim/lib/copilot/tools/server/blocks/get-block-config.ts

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -175,20 +175,9 @@ function extractInputsFromSubBlocks(
175175
// 2. Have a condition matching the operation
176176
if (operation) {
177177
const condition =
178-
typeof sb.condition === 'function'
179-
? sb.condition(operation ? { operation } : undefined)
180-
: sb.condition
181-
if (condition) {
182-
if (condition.field === 'operation' && !condition.not) {
183-
// This is an operation-specific field
184-
const values = Array.isArray(condition.value) ? condition.value : [condition.value]
185-
if (!values.includes(operation)) {
186-
continue // Skip if doesn't match our operation
187-
}
188-
} else if (!matchesOperation(condition, operation)) {
189-
// Other condition that doesn't match
190-
continue
191-
}
178+
typeof sb.condition === 'function' ? sb.condition({ operation }) : sb.condition
179+
if (condition && !matchesOperation(condition, operation)) {
180+
continue
192181
}
193182
}
194183

0 commit comments

Comments
 (0)