From 68108acc0d1adcc9dba9b875912454d1f7248a8b Mon Sep 17 00:00:00 2001 From: waleedlatif Date: Mon, 28 Jul 2025 10:51:27 -0700 Subject: [PATCH 1/2] fix(evaluator): fix tag dropdown for evaluator block --- apps/sim/components/ui/tag-dropdown.tsx | 36 +++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/apps/sim/components/ui/tag-dropdown.tsx b/apps/sim/components/ui/tag-dropdown.tsx index df2f613df84..396e71c6735 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) { From adca82632ce47a1c1a82c96d49573d4cd42541e3 Mon Sep 17 00:00:00 2001 From: waleedlatif Date: Mon, 28 Jul 2025 11:02:43 -0700 Subject: [PATCH 2/2] lint --- apps/sim/components/ui/tag-dropdown.tsx | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/apps/sim/components/ui/tag-dropdown.tsx b/apps/sim/components/ui/tag-dropdown.tsx index 396e71c6735..77d371f2b1b 100644 --- a/apps/sim/components/ui/tag-dropdown.tsx +++ b/apps/sim/components/ui/tag-dropdown.tsx @@ -174,14 +174,14 @@ export const TagDropdown: React.FC = ({ // Special handling for evaluator blocks if (sourceBlock.type === 'evaluator') { // Get the evaluation metrics for the evaluator block - const metricsValue = useSubBlockStore - .getState() - .getValue(activeSourceBlockId, 'metrics') - + 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()}`) + 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) @@ -449,14 +449,14 @@ export const TagDropdown: React.FC = ({ // Special handling for evaluator blocks if (accessibleBlock.type === 'evaluator') { // Get the evaluation metrics for the evaluator block - const metricsValue = useSubBlockStore - .getState() - .getValue(accessibleBlockId, 'metrics') - + 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()}`) + 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)