File tree Expand file tree Collapse file tree 4 files changed +14
-10
lines changed
apps/sim/lib/copilot/tools Expand file tree Collapse file tree 4 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import {
1010 GetBlockConfigInput ,
1111 GetBlockConfigResult ,
1212} from '@/lib/copilot/tools/shared/schemas'
13- import { getBlock } from '@/blocks/registry'
13+ import { getLatestBlock } from '@/blocks/registry'
1414
1515interface GetBlockConfigArgs {
1616 blockType : string
@@ -40,8 +40,7 @@ export class GetBlockConfigClientTool extends BaseClientTool {
4040 } ,
4141 getDynamicText : ( params , state ) => {
4242 if ( params ?. blockType && typeof params . blockType === 'string' ) {
43- // Look up the block config to get the human-readable name
44- const blockConfig = getBlock ( params . blockType )
43+ const blockConfig = getLatestBlock ( params . blockType )
4544 const blockName = ( blockConfig ?. name ?? params . blockType . replace ( / _ / g, ' ' ) ) . toLowerCase ( )
4645 const opSuffix = params . operation ? ` (${ params . operation } )` : ''
4746
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import {
1010 GetBlockOptionsInput ,
1111 GetBlockOptionsResult ,
1212} from '@/lib/copilot/tools/shared/schemas'
13- import { getBlock } from '@/blocks/registry'
13+ import { getLatestBlock } from '@/blocks/registry'
1414
1515interface GetBlockOptionsArgs {
1616 blockId : string
@@ -43,8 +43,7 @@ export class GetBlockOptionsClientTool extends BaseClientTool {
4343 ( params as any ) ?. block_id ||
4444 ( params as any ) ?. block_type
4545 if ( typeof blockId === 'string' ) {
46- // Look up the block config to get the human-readable name
47- const blockConfig = getBlock ( blockId )
46+ const blockConfig = getLatestBlock ( blockId )
4847 const blockName = ( blockConfig ?. name ?? blockId . replace ( / _ / g, ' ' ) ) . toLowerCase ( )
4948
5049 switch ( state ) {
Original file line number Diff line number Diff line change 55 GetBlockConfigResult ,
66 type GetBlockConfigResultType ,
77} from '@/lib/copilot/tools/shared/schemas'
8- import { registry as blockRegistry } from '@/blocks/registry'
8+ import { registry as blockRegistry , getLatestBlock } from '@/blocks/registry'
99import type { SubBlockConfig } from '@/blocks/types'
1010import { getUserPermissionConfig } from '@/executor/utils/permission-check'
1111import { PROVIDER_DEFINITIONS } from '@/providers/models'
@@ -452,9 +452,12 @@ export const getBlockConfigServerTool: BaseServerTool<
452452 const inputs = extractInputsFromSubBlocks ( subBlocks , operation , trigger )
453453 const outputs = extractOutputs ( blockConfig , operation , trigger )
454454
455+ const latestBlock = getLatestBlock ( blockType )
456+ const displayName = latestBlock ?. name ?? blockConfig . name
457+
455458 const result = {
456459 blockType,
457- blockName : blockConfig . name ,
460+ blockName : displayName ,
458461 operation,
459462 trigger,
460463 inputs,
Original file line number Diff line number Diff line change 55 GetBlockOptionsResult ,
66 type GetBlockOptionsResultType ,
77} from '@/lib/copilot/tools/shared/schemas'
8- import { registry as blockRegistry } from '@/blocks/registry'
8+ import { registry as blockRegistry , getLatestBlock } from '@/blocks/registry'
99import { getUserPermissionConfig } from '@/executor/utils/permission-check'
1010import { tools as toolsRegistry } from '@/tools/registry'
1111
@@ -113,9 +113,12 @@ export const getBlockOptionsServerTool: BaseServerTool<
113113 }
114114 }
115115
116+ const latestBlock = getLatestBlock ( blockId )
117+ const displayName = latestBlock ?. name ?? blockConfig . name
118+
116119 const result = {
117120 blockId,
118- blockName : blockConfig . name ,
121+ blockName : displayName ,
119122 operations,
120123 }
121124
You can’t perform that action at this time.
0 commit comments