Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions apps/sim/lib/copilot/tools/client/blocks/get-block-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
GetBlockConfigInput,
GetBlockConfigResult,
} from '@/lib/copilot/tools/shared/schemas'
import { getBlock } from '@/blocks/registry'
import { getLatestBlock } from '@/blocks/registry'

interface GetBlockConfigArgs {
blockType: string
Expand Down Expand Up @@ -40,8 +40,7 @@ export class GetBlockConfigClientTool extends BaseClientTool {
},
getDynamicText: (params, state) => {
if (params?.blockType && typeof params.blockType === 'string') {
// Look up the block config to get the human-readable name
const blockConfig = getBlock(params.blockType)
const blockConfig = getLatestBlock(params.blockType)
const blockName = (blockConfig?.name ?? params.blockType.replace(/_/g, ' ')).toLowerCase()
const opSuffix = params.operation ? ` (${params.operation})` : ''

Expand Down
5 changes: 2 additions & 3 deletions apps/sim/lib/copilot/tools/client/blocks/get-block-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
GetBlockOptionsInput,
GetBlockOptionsResult,
} from '@/lib/copilot/tools/shared/schemas'
import { getBlock } from '@/blocks/registry'
import { getLatestBlock } from '@/blocks/registry'

interface GetBlockOptionsArgs {
blockId: string
Expand Down Expand Up @@ -43,8 +43,7 @@ export class GetBlockOptionsClientTool extends BaseClientTool {
(params as any)?.block_id ||
(params as any)?.block_type
if (typeof blockId === 'string') {
// Look up the block config to get the human-readable name
const blockConfig = getBlock(blockId)
const blockConfig = getLatestBlock(blockId)
const blockName = (blockConfig?.name ?? blockId.replace(/_/g, ' ')).toLowerCase()

switch (state) {
Expand Down
7 changes: 5 additions & 2 deletions apps/sim/lib/copilot/tools/server/blocks/get-block-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
GetBlockConfigResult,
type GetBlockConfigResultType,
} from '@/lib/copilot/tools/shared/schemas'
import { registry as blockRegistry } from '@/blocks/registry'
import { registry as blockRegistry, getLatestBlock } from '@/blocks/registry'
import type { SubBlockConfig } from '@/blocks/types'
import { getUserPermissionConfig } from '@/executor/utils/permission-check'
import { PROVIDER_DEFINITIONS } from '@/providers/models'
Expand Down Expand Up @@ -452,9 +452,12 @@ export const getBlockConfigServerTool: BaseServerTool<
const inputs = extractInputsFromSubBlocks(subBlocks, operation, trigger)
const outputs = extractOutputs(blockConfig, operation, trigger)

const latestBlock = getLatestBlock(blockType)
const displayName = latestBlock?.name ?? blockConfig.name

const result = {
blockType,
blockName: blockConfig.name,
blockName: displayName,
operation,
trigger,
inputs,
Expand Down
7 changes: 5 additions & 2 deletions apps/sim/lib/copilot/tools/server/blocks/get-block-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
GetBlockOptionsResult,
type GetBlockOptionsResultType,
} from '@/lib/copilot/tools/shared/schemas'
import { registry as blockRegistry } from '@/blocks/registry'
import { registry as blockRegistry, getLatestBlock } from '@/blocks/registry'
import { getUserPermissionConfig } from '@/executor/utils/permission-check'
import { tools as toolsRegistry } from '@/tools/registry'

Expand Down Expand Up @@ -113,9 +113,12 @@ export const getBlockOptionsServerTool: BaseServerTool<
}
}

const latestBlock = getLatestBlock(blockId)
const displayName = latestBlock?.name ?? blockConfig.name

const result = {
blockId,
blockName: blockConfig.name,
blockName: displayName,
operations,
}

Expand Down