fix(evaluator): fix tag dropdown for evaluator block (#807)

* fix(evaluator): fix tag dropdown for evaluator block

* lint

---------

Co-authored-by: waleedlatif <waleedlatif@waleedlatifs-MacBook-Pro.local>
This commit is contained in:
Waleed Latif
2025-07-28 11:03:39 -07:00
committed by GitHub
co-authored by waleedlatif
parent 27ef45f717
commit 6f390c0d1d
+34 -2
View File
@@ -171,7 +171,23 @@ export const TagDropdown: React.FC<TagDropdownProps> = ({
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<TagDropdownProps> = ({
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) {