diff --git a/app/w/[id]/components/workflow-block/components/sub-block/components/eval-input.tsx b/app/w/[id]/components/workflow-block/components/sub-block/components/eval-input.tsx index 2646dacd1e..92978c862a 100644 --- a/app/w/[id]/components/workflow-block/components/sub-block/components/eval-input.tsx +++ b/app/w/[id]/components/workflow-block/components/sub-block/components/eval-input.tsx @@ -75,8 +75,25 @@ export function EvalInput({ blockId, subBlockId }: EvalInputProps) { } const updateRange = (id: string, field: 'min' | 'max', value: string) => { - const numValue = parseFloat(value) - if (isNaN(numValue)) return + setValue( + metrics.map((metric) => + metric.id === id + ? { + ...metric, + range: { + ...metric.range, + [field]: value, + }, + } + : metric + ) + ) + } + + const handleRangeBlur = (id: string, field: 'min' | 'max', value: string) => { + // Allow any number including negatives, just remove non-numeric characters except - and . + const sanitizedValue = value.replace(/[^\d.-]/g, '') + const numValue = parseFloat(sanitizedValue) setValue( metrics.map((metric) => @@ -85,7 +102,7 @@ export function EvalInput({ blockId, subBlockId }: EvalInputProps) { ...metric, range: { ...metric.range, - [field]: numValue, + [field]: !isNaN(numValue) ? numValue : 0, }, } : metric @@ -206,20 +223,20 @@ export function EvalInput({ blockId, subBlockId }: EvalInputProps) {