diff --git a/apps/sim/components/ui/tag-dropdown.tsx b/apps/sim/components/ui/tag-dropdown.tsx index df2f613df84..77d371f2b1b 100644 --- a/apps/sim/components/ui/tag-dropdown.tsx +++ b/apps/sim/components/ui/tag-dropdown.tsx @@ -171,7 +171,23 @@ export const TagDropdown: React.FC = ({ let blockTags: string[] - if (responseFormat) { + // Special handling for evaluator blocks + if (sourceBlock.type === 'evaluator') { + // Get the evaluation metrics for the evaluator block + const metricsValue = useSubBlockStore.getState().getValue(activeSourceBlockId, 'metrics') + + if (metricsValue && Array.isArray(metricsValue) && metricsValue.length > 0) { + // Use the metric names as the available outputs + const validMetrics = metricsValue.filter((metric: any) => metric?.name) + blockTags = validMetrics.map( + (metric: any) => `${normalizedBlockName}.${metric.name.toLowerCase()}` + ) + } else { + // Fallback to default evaluator outputs if no metrics are defined + const outputPaths = generateOutputPaths(blockConfig.outputs) + blockTags = outputPaths.map((path) => `${normalizedBlockName}.${path}`) + } + } else if (responseFormat) { // Use custom schema properties if response format is specified const schemaFields = extractFieldsFromSchema(responseFormat) if (schemaFields.length > 0) { @@ -430,7 +446,23 @@ export const TagDropdown: React.FC = ({ let blockTags: string[] - if (responseFormat) { + // Special handling for evaluator blocks + if (accessibleBlock.type === 'evaluator') { + // Get the evaluation metrics for the evaluator block + const metricsValue = useSubBlockStore.getState().getValue(accessibleBlockId, 'metrics') + + if (metricsValue && Array.isArray(metricsValue) && metricsValue.length > 0) { + // Use the metric names as the available outputs + const validMetrics = metricsValue.filter((metric: any) => metric?.name) + blockTags = validMetrics.map( + (metric: any) => `${normalizedBlockName}.${metric.name.toLowerCase()}` + ) + } else { + // Fallback to default evaluator outputs if no metrics are defined + const outputPaths = generateOutputPaths(blockConfig.outputs) + blockTags = outputPaths.map((path) => `${normalizedBlockName}.${path}`) + } + } else if (responseFormat) { // Use custom schema properties if response format is specified const schemaFields = extractFieldsFromSchema(responseFormat) if (schemaFields.length > 0) {