- {resource.judgmentConfig.conditions.map((condition) => {
- const metric = metricOptions.find(option => isSelectorEqual(option.variableSelector, condition.variableSelector))
- const allowedOperators = getAllowedOperators(resource.metrics, condition.variableSelector)
- const showValue = !!metric && requiresConditionValue(condition.comparisonOperator)
+
+ {resource.judgmentConfig.conditions.map((condition) => {
+ const metric = metricOptions.find(option => isSelectorEqual(option.variableSelector, condition.variableSelector))
+ const allowedOperators = getAllowedOperators(resource.metrics, condition.variableSelector)
+ const showValue = !!metric && requiresConditionValue(condition.comparisonOperator)
- return (
-
-
-
-
-
updateConditionMetric(resourceType, resourceId, condition.id, value)}
+ return (
+
+
+
+
+ updateConditionMetric(resourceType, resourceId, condition.id, value)}
+ />
+
+
+
updateConditionOperator(resourceType, resourceId, condition.id, value)}
/>
-
-
updateConditionOperator(resourceType, resourceId, condition.id, value)}
- />
+ {showValue && (
+
+ updateConditionValue(resourceType, resourceId, condition.id, value)}
+ />
+
+ )}
+
+
+
removeCondition(resourceType, resourceId, condition.id)}
+ >
+
+
- {showValue && (
-
- updateConditionValue(resourceType, resourceId, condition.id, value)}
- />
-
- )}
-
-
-
-
- )
- })}
+ )
+ })}
+
)
diff --git a/web/app/components/evaluation/components/metric-selector/index.tsx b/web/app/components/evaluation/components/metric-selector/index.tsx
index 68ad67d343..10ccc5b76a 100644
--- a/web/app/components/evaluation/components/metric-selector/index.tsx
+++ b/web/app/components/evaluation/components/metric-selector/index.tsx
@@ -3,7 +3,6 @@
import type { ChangeEvent } from 'react'
import type { MetricSelectorProps } from './types'
import { Button } from '@langgenius/dify-ui/button'
-import { cn } from '@langgenius/dify-ui/cn'
import {
Popover,
PopoverContent,
@@ -22,7 +21,6 @@ const MetricSelector = ({
resourceType,
resourceId,
triggerClassName,
- triggerStyle = 'button',
}: MetricSelectorProps) => {
const { t } = useTranslation('evaluation')
const resource = useEvaluationResource(resourceType, resourceId)
@@ -63,19 +61,10 @@ const MetricSelector = ({
-
- {t('metrics.add')}
-
- )
- : (
-
- )
+
)}
/>
diff --git a/web/app/components/evaluation/components/metric-selector/types.ts b/web/app/components/evaluation/components/metric-selector/types.ts
index 11f7518257..1acaa3cee0 100644
--- a/web/app/components/evaluation/components/metric-selector/types.ts
+++ b/web/app/components/evaluation/components/metric-selector/types.ts
@@ -3,7 +3,6 @@ import type { NodeInfo } from '@/types/evaluation'
export type MetricSelectorProps = NonPipelineEvaluationResourceProps & {
triggerClassName?: string
- triggerStyle?: 'button' | 'text'
}
export type MetricVisualTone = 'indigo' | 'green'
diff --git a/web/app/components/evaluation/types.ts b/web/app/components/evaluation/types.ts
index c57d696b79..455869b0ba 100644
--- a/web/app/components/evaluation/types.ts
+++ b/web/app/components/evaluation/types.ts
@@ -89,10 +89,12 @@ export type JudgmentConfig = {
export type ConditionMetricOption = {
id: string
+ kind: MetricKind
groupLabel: string
itemLabel: string
valueType: ConditionMetricValueType
variableSelector: [string, string]
+ nodeInfo?: NodeInfo
}
export type ConditionMetricOptionGroup = {
diff --git a/web/app/components/evaluation/utils.ts b/web/app/components/evaluation/utils.ts
index 3fba8158d6..c67937cb13 100644
--- a/web/app/components/evaluation/utils.ts
+++ b/web/app/components/evaluation/utils.ts
@@ -70,10 +70,12 @@ export const buildConditionMetricOptions = (metrics: EvaluationMetric[]): Condit
return (metric.nodeInfoList ?? []).map((nodeInfo) => {
return {
id: `${nodeInfo.node_id}:${metric.optionId}`,
+ kind: metric.kind,
groupLabel: metric.label,
itemLabel: nodeInfo.title || nodeInfo.node_id,
valueType: metric.valueType,
variableSelector: [nodeInfo.node_id, metric.optionId] as [string, string],
+ nodeInfo,
}
})
}
@@ -86,6 +88,7 @@ export const buildConditionMetricOptions = (metrics: EvaluationMetric[]): Condit
return customConfig.outputs.map((output) => {
return {
id: `${customConfig.workflowId}:${output.id}`,
+ kind: metric.kind,
groupLabel: customConfig.workflowName ?? metric.label,
itemLabel: output.id,
valueType: getMetricValueType(output.valueType),