File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
apps/sim/lib/copilot/tools/server/blocks Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -135,12 +135,13 @@ interface OutputFieldSchema {
135135function matchesOperation ( condition : any , operation : string ) : boolean {
136136 if ( ! condition ) return false
137137
138- const cond = typeof condition === 'function' ? condition ( ) : condition
138+ const cond = typeof condition === 'function' ? condition ( { operation } ) : condition
139139 if ( ! cond ) return false
140140
141- if ( cond . field === 'operation' && ! cond . not ) {
141+ if ( cond . field === 'operation' ) {
142142 const values = Array . isArray ( cond . value ) ? cond . value : [ cond . value ]
143- return values . includes ( operation )
143+ const included = values . includes ( operation )
144+ return cond . not ? ! included : included
144145 }
145146
146147 return false
@@ -173,7 +174,10 @@ function extractInputsFromSubBlocks(
173174 // 1. Have no condition (common parameters)
174175 // 2. Have a condition matching the operation
175176 if ( operation ) {
176- const condition = typeof sb . condition === 'function' ? sb . condition ( ) : sb . condition
177+ const condition =
178+ typeof sb . condition === 'function'
179+ ? sb . condition ( operation ? { operation } : undefined )
180+ : sb . condition
177181 if ( condition ) {
178182 if ( condition . field === 'operation' && ! condition . not ) {
179183 // This is an operation-specific field
You can’t perform that action at this time.
0 commit comments