RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
Fix: Negative values can be entered for the maximum number of reflection rounds. (#19819)
balibabu7c44afe0241d
diff --git a/web/src/components/originui/number-input.tsx b/web/src/components/originui/number-input.tsxindex 7f2d621a32..5e212c8e6e 100644--- a/web/src/components/originui/number-input.tsx+++ b/web/src/components/originui/number-input.tsx@@ -1,5 +1,5 @@import { cn } from '@/lib/utils';-import { isNumber, omit, trim } from 'lodash';+import { isNumber, omit, round, trim } from 'lodash';import { MinusIcon, PlusIcon } from 'lucide-react';import React, {FocusEventHandler,@@ -20,6 +20,7 @@ interface NumberInputProps {height?: number | string;min?: number;max?: number;+ step?: number;hideIcons?: boolean;integer?: boolean;inputClassName?: string;@@ -44,6 +45,13 @@ function limitDecimals(value: number, decimals: number) {// integer mode; blocked on keydown so a decimal point can never be typed.const BlockedIntegerKeys = ['.', 'e', 'E', '+'];+// Round a stepped value to the step's own decimal places, so float artifacts+// (0.3 - 0.1 = 0.19999999999999998) never surface in the input.+function roundToStepPrecision(value: number, step: number) {+ const [, fractionPart = ''] = String(step).split('.');+ return round(value, fractionPart.length);+}+const NumberInput = forwardRef<HTMLInputElement,Omit<InputProps, 'onChange' | 'value'> & NumberInputProps@@ -56,6 +64,7 @@ const NumberInput = forwardRef<height,min = 0,max = Infinity,+ step = 1,hideIcons = false,integer = false,inputClassName,@@ -78,8 +87,9 @@ const NumberInput = forwardRef<const handleDecrement = () => {if (isNumber(value) && value > min) {- setValue(value - 1);- onChange?.(value - 1);+ const nextValue = Math.max(roundToStepPrecision(value - step, step), min);+ setValue(nextValue);+ onChange?.(nextValue);}};@@ -87,11 +97,12 @@ const NumberInput = forwardRef<if (!isNumber(value)) {return;}- if (value > max - 1) {+ const nextValue = roundToStepPrecision(value + step, step);+ if (nextValue > max) {return;}- setValue(value + 1);- onChange?.(value + 1);+ setValue(nextValue);+ onChange?.(nextValue);};const handleKeyDown: KeyboardEventHandler<HTMLInputElement> = (e) => {@@ -226,6 +237,7 @@ const NumberInput = forwardRef<)}style={style}min={min}+ step={step}ref={ref}{...omit(props, ['prefix', 'suffix'])}/>diff --git a/web/src/pages/agent/form/agent-form/index.tsx b/web/src/pages/agent/form/agent-form/index.tsxindex cab992cbeb..88e76e34c9 100644--- a/web/src/pages/agent/form/agent-form/index.tsx+++ b/web/src/pages/agent/form/agent-form/index.tsx@@ -16,7 +16,7 @@ import {FormItem,FormLabel,} from '@/components/ui/form';-import { Input, NumberInput } from '@/components/ui/input';+import { Input } from '@/components/ui/input';import { Label } from '@/components/ui/label';import { Separator } from '@/components/ui/separator';import { Switch } from '@/components/ui/switch';@@ -54,6 +54,7 @@ import {import { useGetAgentMCPIds } from './use-get-tools';import { useValues } from './use-values';import { useWatchFormChange } from './use-watch-change';+import NumberInput from '@/components/originui/number-input';const FormSchema = z.object({sys_prompt: z.string(),@@ -180,7 +181,11 @@ function AgentForm({ node }: INextOperatorForm) {<FormItem className="flex-1"><FormLabel>{t('flow.maxRounds')}</FormLabel><FormControl>- <NumberInput {...field} min={0}></NumberInput>+ <NumberInput+ {...field}+ min={0}+ className="w-full"+ ></NumberInput></FormControl></FormItem>)}@@ -259,7 +264,12 @@ function AgentForm({ node }: INextOperatorForm) {<FormItem className="flex-1"><FormLabel>{t('flow.maxRetries')}</FormLabel><FormControl>- <NumberInput {...field} max={8} min={0}></NumberInput>+ <NumberInput+ {...field}+ max={8}+ min={0}+ className="w-full"+ ></NumberInput></FormControl></FormItem>)}@@ -271,7 +281,12 @@ function AgentForm({ node }: INextOperatorForm) {<FormItem className="flex-1"><FormLabel>{t('flow.delayAfterError')}</FormLabel><FormControl>- <NumberInput {...field} max={5} step={0.1}></NumberInput>+ <NumberInput+ {...field}+ max={5}+ step={0.1}+ className="w-full"+ ></NumberInput></FormControl></FormItem>)}