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: TypeScript errors in shared components (#21458)
balibabu306e68ff716a
diff --git a/web/src/components/bool-segmented.tsx b/web/src/components/bool-segmented.tsxindex 3ca2900693..371e154127 100644--- a/web/src/components/bool-segmented.tsx+++ b/web/src/components/bool-segmented.tsx@@ -14,21 +14,42 @@* limitations under the License.*/-import { omit } from 'lodash';-import { Segmented, SegmentedProps } from './ui/segmented';+import {+ Segmented,+ SegmentedLabeledOption,+ SegmentedProps,+ SegmentedValue,+} from './ui/segmented';-export function BoolSegmented({ ...props }: Omit<SegmentedProps, 'options'>) {+const BoolOptions: SegmentedLabeledOption[] = [+ { value: true as unknown as SegmentedValue, label: 'True' },+ { value: false as unknown as SegmentedValue, label: 'False' },+];++interface BoolSegmentedProps extends Omit<+ SegmentedProps,+ 'options' | 'value' | 'defaultValue' | 'onChange'+> {+ value?: boolean;+ defaultValue?: boolean;+ onChange?: (value: boolean) => void;+}++export function BoolSegmented({+ value,+ defaultValue,+ onChange,+ ...props+}: BoolSegmentedProps) {return (<Segmented- options={- [- { value: true, label: 'True' },- { value: false, label: 'False' },- ] as any- }+ options={BoolOptions}sizeType="sm"itemClassName="justify-center flex-1"- {...omit(props, 'options')}+ value={value as unknown as SegmentedValue}+ defaultValue={defaultValue as unknown as SegmentedValue}+ onChange={onChange as SegmentedProps['onChange']}+ {...props}></Segmented>);}diff --git a/web/src/components/document-preview/pdf-preview.tsx b/web/src/components/document-preview/pdf-preview.tsxindex a2d7eb1867..92bfe4af54 100644--- a/web/src/components/document-preview/pdf-preview.tsx+++ b/web/src/components/document-preview/pdf-preview.tsx@@ -128,8 +128,8 @@ const PdfPreview = ({index,setTip,hideTip,- viewportToScaled,- screenshot,+ _viewportToScaled,+ _screenshot,isScrolledTo,) => {const isTextHighlight = !(diff --git a/web/src/components/edit-tag/index.tsx b/web/src/components/edit-tag/index.tsxindex 1779859a64..d503d8c109 100644--- a/web/src/components/edit-tag/index.tsx+++ b/web/src/components/edit-tag/index.tsx@@ -89,10 +89,8 @@ const EditTag = React.forwardRef<HTMLDivElement, EditTagsProps>(<Buttonvariant="delete"size="icon-xs"- onClick={(e) => {- e.preventDefault();- handleClose(tag);- }}+ type="button"+ onClick={() => handleClose(tag)}><Trash2 className="size-[1em]" /></Button>@@ -135,6 +133,7 @@ const EditTag = React.forwardRef<HTMLDivElement, EditTagsProps>(<Buttonvariant="outline"size="icon"+ type="button"onClick={showInput}disabled={disabled}data-testid={addButtonTestId}diff --git a/web/src/components/file-upload.tsx b/web/src/components/file-upload.tsxindex f31d7b7763..b32a8f8f5c 100644--- a/web/src/components/file-upload.tsx+++ b/web/src/components/file-upload.tsx@@ -33,7 +33,7 @@ function useLazyRef<T>(fn: () => T) {ref.current = fn();}- return ref as React.RefObject<T>;+ return ref as React.MutableRefObject<T>;}type Direction = 'ltr' | 'rtl';diff --git a/web/src/components/jsonjoy-builder/components/features/json-validator.tsx b/web/src/components/jsonjoy-builder/components/features/json-validator.tsxindex 01f319ee0f..10fc24dfda 100644--- a/web/src/components/jsonjoy-builder/components/features/json-validator.tsx+++ b/web/src/components/jsonjoy-builder/components/features/json-validator.tsx@@ -35,7 +35,7 @@ export function JsonValidator({const [validationResult, setValidationResult] =useState<ValidationResult | null>(null);const editorRef = useRef<Parameters<OnMount>[0] | null>(null);- const debounceTimerRef = useRef<number | null>(null);+ const debounceTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);const monacoRef = useRef<typeof Monaco | null>(null);const schemaMonacoRef = useRef<typeof Monaco | null>(null);const {diff --git a/web/src/components/jsonjoy-builder/components/schema-editor/json-schema-editor.tsx b/web/src/components/jsonjoy-builder/components/schema-editor/json-schema-editor.tsxindex 4085dd0714..6113f796f8 100644--- a/web/src/components/jsonjoy-builder/components/schema-editor/json-schema-editor.tsx+++ b/web/src/components/jsonjoy-builder/components/schema-editor/json-schema-editor.tsx@@ -27,7 +27,7 @@ const JsonSchemaEditor: FC<JsonSchemaEditorProps> = ({}) => {// Handle schema changes and propagate to parent if neededconst handleSchemaChange = (newSchema: JSONSchema) => {- setSchema(newSchema);+ setSchema?.(newSchema);};const t = useTranslation();diff --git a/web/src/components/jsonjoy-builder/components/schema-editor/schema-property-editor.tsx b/web/src/components/jsonjoy-builder/components/schema-editor/schema-property-editor.tsxindex 347d69d263..c8eed0ac67 100644--- a/web/src/components/jsonjoy-builder/components/schema-editor/schema-property-editor.tsx+++ b/web/src/components/jsonjoy-builder/components/schema-editor/schema-property-editor.tsx@@ -202,7 +202,7 @@ export const SchemaPropertyEditor: React.FC<SchemaPropertyEditorProps> = ({</div>{/* Error badge */}- {validationNode?.cumulativeChildrenErrors > 0 && (+ {validationNode && validationNode.cumulativeChildrenErrors > 0 && (<BadgeclassName="h-5 min-w-5 rounded-full px-1 font-mono tabular-nums justify-center"variant="destructive"diff --git a/web/src/components/jsonjoy-builder/components/schema-editor/types/array-editor.tsx b/web/src/components/jsonjoy-builder/components/schema-editor/types/array-editor.tsxindex c5ed75dec3..b50a2add3e 100644--- a/web/src/components/jsonjoy-builder/components/schema-editor/types/array-editor.tsx+++ b/web/src/components/jsonjoy-builder/components/schema-editor/types/array-editor.tsx@@ -109,7 +109,9 @@ const ArrayEditor: React.FC<TypeEditorProps> = ({<div className="space-y-2"><LabelhtmlFor={minItemsId}- className={(!!minMaxError || !!minItemsError) && 'text-destructive'}+ className={+ !!minMaxError || !!minItemsError ? 'text-destructive' : undefined+ }>{t.arrayMinimumLabel}</Label>@@ -132,7 +134,9 @@ const ArrayEditor: React.FC<TypeEditorProps> = ({<div className="space-y-2"><LabelhtmlFor={maxItemsId}- className={(!!minMaxError || !!maxItemsError) && 'text-destructive'}+ className={+ !!minMaxError || !!maxItemsError ? 'text-destructive' : undefined+ }>{t.arrayMaximumLabel}</Label>diff --git a/web/src/components/jsonjoy-builder/components/schema-editor/types/number-editor.tsx b/web/src/components/jsonjoy-builder/components/schema-editor/types/number-editor.tsxindex e48a9bae01..a1446cdbb3 100644--- a/web/src/components/jsonjoy-builder/components/schema-editor/types/number-editor.tsx+++ b/web/src/components/jsonjoy-builder/components/schema-editor/types/number-editor.tsx@@ -232,9 +232,9 @@ const NumberEditor: React.FC<NumberEditorProps> = ({<LabelhtmlFor={minimumId}className={- minimum !== undefined &&- (!!minMaxError || !!redundantMinError) &&- 'text-destructive'+ minimum !== undefined && (!!minMaxError || !!redundantMinError)+ ? 'text-destructive'+ : undefined}>{t.numberMinimumLabel}@@ -262,9 +262,9 @@ const NumberEditor: React.FC<NumberEditorProps> = ({<LabelhtmlFor={maximumId}className={- maximum !== undefined &&- (!!minMaxError || !!redundantMaxError) &&- 'text-destructive'+ maximum !== undefined && (!!minMaxError || !!redundantMaxError)+ ? 'text-destructive'+ : undefined}>{t.numberMaximumLabel}@@ -295,8 +295,9 @@ const NumberEditor: React.FC<NumberEditorProps> = ({htmlFor={exclusiveMinimumId}className={exclusiveMinimum !== undefined &&- (!!minMaxError || !!redundantMinError) &&- 'text-destructive'+ (!!minMaxError || !!redundantMinError)+ ? 'text-destructive'+ : undefined}>{t.numberExclusiveMinimumLabel}@@ -325,8 +326,9 @@ const NumberEditor: React.FC<NumberEditorProps> = ({htmlFor={exclusiveMaximumId}className={exclusiveMaximum !== undefined &&- (!!minMaxError || !!redundantMaxError) &&- 'text-destructive'+ (!!minMaxError || !!redundantMaxError)+ ? 'text-destructive'+ : undefined}>{t.numberExclusiveMaximumLabel}@@ -354,7 +356,7 @@ const NumberEditor: React.FC<NumberEditorProps> = ({<div className="space-y-2"><LabelhtmlFor={multipleOfId}- className={!!multipleOfError && 'text-destructive'}+ className={multipleOfError ? 'text-destructive' : undefined}>{t.numberMultipleOfLabel}</Label>@@ -379,7 +381,7 @@ const NumberEditor: React.FC<NumberEditorProps> = ({</div><div className="space-y-2 pt-2 border-t border-border/40">- <Label className={!!enumError && 'text-destructive'}>+ <Label className={enumError ? 'text-destructive' : undefined}>{t.numberAllowedValuesEnumLabel}</Label>diff --git a/web/src/components/jsonjoy-builder/components/schema-editor/types/string-editor.tsx b/web/src/components/jsonjoy-builder/components/schema-editor/types/string-editor.tsxindex de06fdcedf..14e12d168c 100644--- a/web/src/components/jsonjoy-builder/components/schema-editor/types/string-editor.tsx+++ b/web/src/components/jsonjoy-builder/components/schema-editor/types/string-editor.tsx@@ -141,7 +141,7 @@ const StringEditor: React.FC<TypeEditorProps> = ({<LabelhtmlFor={minLengthId}className={- (!!minMaxError || !!minLengthError) && 'text-destructive'+ !!minMaxError || !!minLengthError ? 'text-destructive' : undefined}>{t.stringMinimumLengthLabel}@@ -167,7 +167,7 @@ const StringEditor: React.FC<TypeEditorProps> = ({<LabelhtmlFor={maxLengthId}className={- (!!minMaxError || !!maxLengthError) && 'text-destructive'+ !!minMaxError || !!maxLengthError ? 'text-destructive' : undefined}>{t.stringMaximumLengthLabel}@@ -200,7 +200,7 @@ const StringEditor: React.FC<TypeEditorProps> = ({<div className="space-y-2"><LabelhtmlFor={patternId}- className={!!patternError && 'text-destructive'}+ className={patternError ? 'text-destructive' : undefined}>{t.stringPatternLabel}</Label>@@ -220,7 +220,7 @@ const StringEditor: React.FC<TypeEditorProps> = ({<div className="space-y-2"><LabelhtmlFor={formatId}- className={!!formatError && 'text-destructive'}+ className={formatError ? 'text-destructive' : undefined}>{t.stringFormatLabel}</Label>diff --git a/web/src/components/jsonjoy-builder/hooks/use-monaco-theme.ts b/web/src/components/jsonjoy-builder/hooks/use-monaco-theme.tsindex cb06093ec1..ec57abaacf 100644--- a/web/src/components/jsonjoy-builder/hooks/use-monaco-theme.ts+++ b/web/src/components/jsonjoy-builder/hooks/use-monaco-theme.ts@@ -165,7 +165,7 @@ export function useMonacoTheme() {schema?: JSONSchema,) => {// Create a new diagnostics options object- const diagnosticsOptions: Monaco.languages.json.DiagnosticsOptions = {+ const diagnosticsOptions: Monaco.json.DiagnosticsOptions = {validate: true,allowComments: false,schemaValidation: 'error',@@ -194,9 +194,7 @@ export function useMonacoTheme() {],};- monaco.languages.json.jsonDefaults.setDiagnosticsOptions(- diagnosticsOptions,- );+ monaco.json.jsonDefaults.setDiagnosticsOptions(diagnosticsOptions);};return {diff --git a/web/src/components/jsonjoy-builder/lib/schema-editor.ts b/web/src/components/jsonjoy-builder/lib/schema-editor.tsindex b2fd5d6e22..36531a460a 100644--- a/web/src/components/jsonjoy-builder/lib/schema-editor.ts+++ b/web/src/components/jsonjoy-builder/lib/schema-editor.ts@@ -45,7 +45,7 @@ export function removeObjectProperty(if (!isObjectSchema(schema) || !schema.properties) return schema;const newSchema = copySchema(schema);- const { [propertyName]: _, ...remainingProps } = newSchema.properties;+ const { [propertyName]: _, ...remainingProps } = newSchema.properties ?? {};newSchema.properties = remainingProps;// Also remove from required array if present@@ -109,6 +109,9 @@ export function updateArrayItems(*/export function createFieldSchema(field: NewField): JSONSchema {const { type, description, validation } = field;+ if (validation === undefined) {+ return { type, description };+ }if (isObjectSchema(validation)) {return {type,diff --git a/web/src/components/jsonjoy-builder/lib/schema-inference.ts b/web/src/components/jsonjoy-builder/lib/schema-inference.tsindex cde22907e4..a1ff7cadf0 100644--- a/web/src/components/jsonjoy-builder/lib/schema-inference.ts+++ b/web/src/components/jsonjoy-builder/lib/schema-inference.ts@@ -126,7 +126,9 @@ function detectSemanticFormatsInArrayItems(/coordinates?|coords?|latLon|lonLat|point/i.test(key) &¤tSchema.type === 'array') {- const itemsSchema = asObjectSchema(currentSchema.items);+ const itemsSchema = currentSchema.items+ ? asObjectSchema(currentSchema.items)+ : undefined;if (itemsSchema?.type === 'number' || itemsSchema?.type === 'integer') {let isValidCoordArray = true;let coordLength: number | null = null;diff --git a/web/src/components/jsonjoy-builder/types/validation.ts b/web/src/components/jsonjoy-builder/types/validation.tsindex 3aec8bc081..2d43f9b6c1 100644--- a/web/src/components/jsonjoy-builder/types/validation.ts+++ b/web/src/components/jsonjoy-builder/types/validation.ts@@ -8,6 +8,7 @@ function refineRangeConsistency(max: number | undefined,isMaxExclusive: boolean,): boolean {+ if (min === undefined || max === undefined) return true;if (min !== undefined && max !== undefined && min > max) {return false;}@@ -187,7 +188,7 @@ const getJsonObjectType = (t: Translation) =>},);-export function getTypeValidation(type: string, t: Translation) {+export function getTypeValidation(type: string | undefined, t: Translation) {const jsonTypesValidation: Record<string, z.ZodTypeAny> = {string: getJsonStringType(t),number: getJsonNumberType(t),@@ -195,17 +196,17 @@ export function getTypeValidation(type: string, t: Translation) {object: getJsonObjectType(t),};- return jsonTypesValidation[type] || z.any();+ return (type && jsonTypesValidation[type]) || z.any();}export interface TypeValidationResult {success: boolean;- errors?: z.core.$ZodIssue[];+ errors?: z.ZodIssue[];}export function validateSchemaByType(schema: unknown,- type: string,+ type: string | undefined,t: Translation,): TypeValidationResult {const zodSchema = getTypeValidation(type, t);@@ -218,7 +219,7 @@ export function validateSchemaByType(}export interface ValidationTreeNode {- name: string;+ name: string | undefined;validation: TypeValidationResult;children: Record<string, ValidationTreeNode>;cumulativeChildrenErrors: number; // Total errors in this node and all its descendants@@ -255,7 +256,7 @@ export function buildValidationTree(code: 'custom',message: t.validatorErrorSchemaValidation,path: [],- } as unknown as z.core.$ZodIssue,+ } as unknown as z.ZodIssue,],};diff --git a/web/src/components/jsonjoy-builder/utils/json-validator.ts b/web/src/components/jsonjoy-builder/utils/json-validator.tsindex 9ddba0da1c..a2ed25b63e 100644--- a/web/src/components/jsonjoy-builder/utils/json-validator.ts+++ b/web/src/components/jsonjoy-builder/utils/json-validator.ts@@ -20,7 +20,7 @@ export interface ValidationError {export interface ValidationResult {valid: boolean;- errors?: ValidationError[];+ errors: ValidationError[];}/**diff --git a/web/src/components/markdown-content/__tests__/index.test.tsx b/web/src/components/markdown-content/__tests__/index.test.tsxindex 2e79db70e9..a2ba057e56 100644--- a/web/src/components/markdown-content/__tests__/index.test.tsx+++ b/web/src/components/markdown-content/__tests__/index.test.tsx@@ -1,5 +1,4 @@import { render } from '@testing-library/react';-import React from 'react';import MarkdownContent from '..';diff --git a/web/src/components/next-message-item/group-button.tsx b/web/src/components/next-message-item/group-button.tsxindex 5ff15829c5..c39020beb3 100644--- a/web/src/components/next-message-item/group-button.tsx+++ b/web/src/components/next-message-item/group-button.tsx@@ -68,7 +68,6 @@ export const AssistantGroupButton = ({showLoudspeaker = true,showLog = true,attachment,- isShare,}: IProps) => {const { visible, hideModal, showModal, onFeedbackOk, loading } =useSendFeedback(messageId);diff --git a/web/src/components/originui/password-input.tsx b/web/src/components/originui/password-input.tsxindex 3fb60635cc..98a3c8b4fc 100644--- a/web/src/components/originui/password-input.tsx+++ b/web/src/components/originui/password-input.tsx@@ -8,9 +8,7 @@ import { Input, InputProps } from '../ui/input';export default React.forwardRef<HTMLInputElement, InputProps>(function PasswordInput({ ...props }, ref) {const id = useId();- const [isVisible, setIsVisible] = useState<boolean>(false);-- const toggleVisibility = () => setIsVisible((prevState) => !prevState);+ const [isVisible] = useState<boolean>(false);return (<div className="*:not-first:mt-2">diff --git a/web/src/components/originui/timeline.tsx b/web/src/components/originui/timeline.tsxindex dae3e670cc..72b91e9414 100644--- a/web/src/components/originui/timeline.tsx+++ b/web/src/components/originui/timeline.tsx@@ -2,7 +2,6 @@import { cn } from '@/lib/utils';import { TimelineNodeType } from '@/pages/dataflow-result/constant';-import { parseColorToRGB } from '@/utils/common-util';import { Slot } from '@radix-ui/react-slot';import * as React from 'react';@@ -269,7 +268,6 @@ const CustomTimeline = ({}onStepChange?.(step, id);};- const [r, g, b] = parseColorToRGB(indicatorColor);return (<Timelinevalue={currentActiveStep}diff --git a/web/src/components/ui/audio-button.tsx b/web/src/components/ui/audio-button.tsxindex 4d484650ee..56c6ff894d 100644--- a/web/src/components/ui/audio-button.tsx+++ b/web/src/components/ui/audio-button.tsx@@ -6,10 +6,8 @@ import { cn } from '@/lib/utils';import api from '@/utils/api';import { getAuthorization } from '@/utils/authorization-util';import { chain, sum } from 'lodash';-import { Loader2, Mic, Square } from 'lucide-react';+import { Loader2, Mic } from 'lucide-react';import { useCallback, useEffect, useRef, useState } from 'react';-import { Input } from './input';-import { Popover, PopoverContent, PopoverTrigger } from './popover';import message from './message';const VoiceVisualizer = ({ isRecording }: { isRecording: boolean }) => {@@ -167,53 +165,6 @@ const VoiceVisualizer = ({ isRecording }: { isRecording: boolean }) => {return <canvas ref={canvasRef} className="block size-full" />;};-const VoiceInputBox = ({- isRecording,- onStop,- recordingTime,- value,-}: {- value: string;- isRecording: boolean;- onStop: () => void;- recordingTime: number;-}) => {- // Format recording time- const formatTime = (seconds: number) => {- const mins = Math.floor(seconds / 60);- const secs = seconds % 60;- return `${mins.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`;- };-- return (- <div className="w-full">- <div className=" absolute w-full h-6 translate-y-full">- <VoiceVisualizer isRecording={isRecording} />- </div>- <Input- rootClassName="w-full"- className="flex-1 "- readOnly- value={value}- suffix={- <div className="flex justify-end px-1 items-center gap-1 w-20">- <Button- variant={'ghost'}- size="sm"- className="text-text-primary p-1 border-none hover:bg-transparent"- onClick={onStop}- >- <Square className="text-text-primary" size={12} />- </Button>- <span className="text-xs text-text-secondary">- {formatTime(recordingTime)}- </span>- </div>- }- />- </div>- );-};export const AudioButton = ({onOk,testId,@@ -224,9 +175,9 @@ export const AudioButton = ({// const [showInputBox, setShowInputBox] = useState(false);const [isRecording, setIsRecording] = useState(false);const [isProcessing, setIsProcessing] = useState(false);- const [recordingTime, setRecordingTime] = useState(0);- const [transcript, setTranscript] = useState('');- const [popoverOpen, setPopoverOpen] = useState(false);+ const [, setRecordingTime] = useState(0);+ const [, setTranscript] = useState('');+ const [, setPopoverOpen] = useState(false);const recorderControls = useAudioRecorder();const intervalRef = useRef<NodeJS.Timeout | null>(null);// Handle logic after recording is completediff --git a/web/src/components/ui/sidebar.tsx b/web/src/components/ui/sidebar.tsxindex eee8165190..f1bcafaf93 100644--- a/web/src/components/ui/sidebar.tsx+++ b/web/src/components/ui/sidebar.tsx@@ -6,7 +6,7 @@ import { PanelLeft } from 'lucide-react';import * as React from 'react';import { useIsMobile } from '@/components/hooks/use-mobile';-import { Button } from '@/components/ui/button';+import { Button, type ButtonProps } from '@/components/ui/button';import { Input } from '@/components/ui/input';import { Separator } from '@/components/ui/separator';import { Sheet, SheetContent } from '@/components/ui/sheet';@@ -267,30 +267,31 @@ const Sidebar = React.forwardRef<);Sidebar.displayName = 'Sidebar';-const SidebarTrigger = React.forwardRef<- React.ElementRef<typeof Button>,- React.ComponentProps<typeof Button>->(({ className, onClick, ...props }, ref) => {- const { toggleSidebar } = useSidebar();+const SidebarTrigger = React.forwardRef<HTMLButtonElement, ButtonProps>(+ ({ className, onClick, ...props }, ref) => {+ const { toggleSidebar } = useSidebar();- return (- <Button- ref={ref}- data-sidebar="trigger"- variant="ghost"- size="icon"- className={cn('h-7 w-7', className)}- onClick={(event) => {- onClick?.(event);- toggleSidebar();- }}- {...props}- >- <PanelLeft />- <span className="sr-only">Toggle Sidebar</span>- </Button>- );-});+ const handleClick: React.MouseEventHandler<HTMLButtonElement> = (event) => {+ onClick?.(event);+ toggleSidebar();+ };++ return (+ <Button+ ref={ref}+ data-sidebar="trigger"+ variant="ghost"+ size="icon"+ className={cn('h-7 w-7', className)}+ onClick={handleClick}+ {...props}+ >+ <PanelLeft />+ <span className="sr-only">Toggle Sidebar</span>+ </Button>+ );+ },+);SidebarTrigger.displayName = 'SidebarTrigger';const SidebarRail = React.forwardRef<diff --git a/web/src/hooks/__tests__/logic-hooks-use-scroll-to-bottom.test.tsx b/web/src/hooks/__tests__/logic-hooks-use-scroll-to-bottom.test.tsxindex bd3413959e..c5777f798f 100644--- a/web/src/hooks/__tests__/logic-hooks-use-scroll-to-bottom.test.tsx+++ b/web/src/hooks/__tests__/logic-hooks-use-scroll-to-bottom.test.tsx@@ -7,12 +7,14 @@ function createMockContainer({ atBottom = true } = {}) {const scrollTop = atBottom ? 100 : 0;const clientHeight = 100;const scrollHeight = 200;- const listeners = {};+ const listeners: Record<string, (...args: unknown[]) => void> = {};return {current: {scrollTop,clientHeight,scrollHeight,+ style: {},+ scrollTo: jest.fn(),addEventListener: jest.fn((event, cb) => {listeners[event] = cb;}),@@ -54,39 +56,24 @@ describe('useScrollToBottom', () => {it('should scroll to bottom when isAtBottom is true and messages change', async () => {const containerRef = createMockContainer({ atBottom: true });- const mockScroll = jest.fn();-- function useTestScrollToBottom(messages: any, containerRef: any) {- const hook = useScrollToBottom(messages, containerRef);- hook.scrollRef.current = { scrollIntoView: mockScroll } as any;- return hook;- }const { rerender } = renderHook(- ({ messages }) => useTestScrollToBottom(messages, containerRef),- { initialProps: { messages: [] } },+ ({ messages }) => useScrollToBottom(messages, containerRef),+ { initialProps: { messages: [] as string[] } },);rerender({ messages: ['msg1'] });await flushAll();- expect(mockScroll).toHaveBeenCalled();+ expect(containerRef.current.scrollTo).toHaveBeenCalled();});it('should NOT scroll to bottom when isAtBottom is false and messages change', async () => {const containerRef = createMockContainer({ atBottom: false });- const mockScroll = jest.fn();-- function useTestScrollToBottom(messages: any, containerRef: any) {- const hook = useScrollToBottom(messages, containerRef);- hook.scrollRef.current = { scrollIntoView: mockScroll } as any;- console.log('HOOK: isAtBottom:', hook.isAtBottom);- return hook;- }const { result, rerender } = renderHook(- ({ messages }) => useTestScrollToBottom(messages, containerRef),- { initialProps: { messages: [] } },+ ({ messages }) => useScrollToBottom(messages, containerRef),+ { initialProps: { messages: [] as string[] } },);// Simulate user scrolls up before messages change@@ -104,7 +91,7 @@ describe('useScrollToBottom', () => {console.log('AFTER RERENDER: isAtBottom:', result.current.isAtBottom);- expect(mockScroll).not.toHaveBeenCalled();+ expect(containerRef.current.scrollTo).not.toHaveBeenCalled();// Optionally, flush again after the assertion to see if it gets called lateawait flushAll();diff --git a/web/src/hooks/__tests__/parser-config-utils.test.ts b/web/src/hooks/__tests__/parser-config-utils.test.tsdeleted file mode 100644index c2a3afe7b7..0000000000--- a/web/src/hooks/__tests__/parser-config-utils.test.ts+++ /dev/null@@ -1,80 +0,0 @@-/*- * Copyright 2026 The InfiniFlow Authors. All Rights Reserved.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import { normalizeParserConfig } from '@/hooks/parser-config-utils';--const baseConfig = {- chunk_token_num: 128,- layout_recognize: 'DeepDOC',- delimiter: '\n',- metadata: { enabled: true, metadata: [], built_in_metadata: [] },- enable_children: true,- children_delimiter: '!?;',- use_parent_child: true,- graphrag: { use_graphrag: false },- raptor: { use_raptor: false },-};--describe('normalizeParserConfig backend awareness', () => {- beforeEach(() => {- mockIsGoBackend = true;- });-- it('scopes metadata and parent_child onto component nodes and drops every flat key for the Go backend', () => {- const out = normalizeParserConfig({- ...baseConfig,- }) as Record<string, any>;-- expect(out['Extractor:AutoExtractDefault']).toEqual({- metadata: { enabled: true, metadata: [], built_in_metadata: [] },- });- expect(out['GeneralChunker:SixApplesFall']).toEqual({- chunk_token_size: 128,- parent_child: { children_delimiter: '!?;', use_parent_child: true },- });- // No flat transport keys survive for the Go backend.- expect(out).not.toHaveProperty('metadata');- expect(out).not.toHaveProperty('parent_child');- // The Go backend reads chunk_token_size off the chunker node, never a flat- // chunk_token_num, so the flat key must be gone and the value re-homed.- expect(out).not.toHaveProperty('chunk_token_num');- expect(out).not.toHaveProperty('delimiter');- expect(out).not.toHaveProperty('layout_recognize');- expect(out).not.toHaveProperty('auto_keywords');- // graphrag/raptor are always stripped.- expect(out).not.toHaveProperty('graphrag');- expect(out).not.toHaveProperty('raptor');- });-- it('does not scope anything when metadata/parent_child are absent but still re-homes chunk_token_num', () => {- const out = normalizeParserConfig({- chunk_token_num: 128,- layout_recognize: 'DeepDOC',- delimiter: '\n',- }) as Record<string, any>;-- expect(out).not.toHaveProperty('Extractor:AutoExtractDefault');- expect(out).not.toHaveProperty('parent_child');- expect(out).not.toHaveProperty('metadata');- // No flat parser-level key survives for the Go backend.- expect(out).not.toHaveProperty('chunk_token_num');- expect(out).not.toHaveProperty('delimiter');- // The chunk size is still re-homed onto the chunker node.- expect(out['GeneralChunker:SixApplesFall']).toEqual({- chunk_token_size: 128,- });- });-});diff --git a/web/src/hooks/logic-hooks.ts b/web/src/hooks/logic-hooks.tsindex 9d0f610f71..31431506ac 100644--- a/web/src/hooks/logic-hooks.ts+++ b/web/src/hooks/logic-hooks.ts@@ -217,8 +217,11 @@ export const useGetPagination = (options?: { pageSize?: number }) => {const { t } = useTranslate('common');const onPageChange: Pagination['onChange'] = useCallback(- (pageNumber: number, pageSize: number) => {- setPagination({ page: pageNumber, pageSize });+ (pageNumber: number, pageSize?: number) => {+ setPagination((pre) => ({+ page: pageNumber,+ pageSize: pageSize ?? pre.pageSize,+ }));},[],);diff --git a/web/src/hooks/logic-hooks/use-row-selection.ts b/web/src/hooks/logic-hooks/use-row-selection.tsindex 1682916e98..7382d1bc67 100644--- a/web/src/hooks/logic-hooks/use-row-selection.ts+++ b/web/src/hooks/logic-hooks/use-row-selection.ts@@ -54,7 +54,7 @@ export function useSelectedIds<T extends Array<{ id: string }>>(if (isIndexBased) {// Legacy index-based selectionreturn list- .filter((x, idx) => selectionKeys.some((y) => Number(y) === idx))+ .filter((_, idx) => selectionKeys.some((y) => Number(y) === idx)).map((x) => x.id);} else {// ID-based selection (when getRowId is used)diff --git a/web/src/interfaces/common.ts b/web/src/interfaces/common.tsindex 771ff5aa68..52373eaa10 100644--- a/web/src/interfaces/common.ts+++ b/web/src/interfaces/common.ts@@ -2,7 +2,7 @@ export interface Pagination {current: number;pageSize: number;total: number;- onChange?: (page: number, pageSize: number) => void;+ onChange?: (page: number, pageSize?: number) => void;}export interface BaseState {diff --git a/web/src/pages/agent/gobal-variable-sheet/component/add-variable-modal.tsx b/web/src/pages/agent/gobal-variable-sheet/component/add-variable-modal.tsxindex 8ba82f5269..d2e1e41948 100644--- a/web/src/pages/agent/gobal-variable-sheet/component/add-variable-modal.tsx+++ b/web/src/pages/agent/gobal-variable-sheet/component/add-variable-modal.tsx@@ -109,7 +109,6 @@ export const AddVariableModal = (props: {console.log(data);}}defaultValues={defaultValues}- onFieldUpdate={handleFieldUpdate}><div className="flex items-center justify-end w-full gap-2"><DynamicForm.CancelButtondiff --git a/web/src/pages/agent/gobal-variable-sheet/hooks/use-object-fields.tsx b/web/src/pages/agent/gobal-variable-sheet/hooks/use-object-fields.tsxindex 07cc48764d..79187c4c86 100644--- a/web/src/pages/agent/gobal-variable-sheet/hooks/use-object-fields.tsx+++ b/web/src/pages/agent/gobal-variable-sheet/hooks/use-object-fields.tsx@@ -16,22 +16,15 @@ export const useObjectFields = () => {const fieldValue = field.value ? true : false;return (<BoolSegmented- options={- [- { value: true, label: 'True' },- { value: false, label: 'False' },- ] as any- }- sizeType="sm"value={fieldValue}onChange={field.onChange}className={className}- itemClassName="justify-center flex-1"></BoolSegmented>);},[],);+const validateKeys = (obj: any,path: (string | number)[] = [],@@ -184,7 +177,7 @@ export const useObjectFields = () => {{booleanRender({value: item,- onChange: (value) => {+ onChange: (value: boolean) => {values[index] = !!value;field.onChange(values);},diff --git a/web/src/pages/agent/gobal-variable-sheet/index.tsx b/web/src/pages/agent/gobal-variable-sheet/index.tsxindex adc9aebf74..1c86357af7 100644--- a/web/src/pages/agent/gobal-variable-sheet/index.tsx+++ b/web/src/pages/agent/gobal-variable-sheet/index.tsx@@ -11,9 +11,8 @@ import { useSetModalState } from '@/hooks/common-hooks';import { useFetchAgent } from '@/hooks/use-agent-request';import { GlobalVariableType } from '@/interfaces/database/agent';import { cn } from '@/lib/utils';-import { t } from 'i18next';import { Trash2 } from 'lucide-react';-import { useState } from 'react';+import { MouseEventHandler, useState } from 'react';import { FieldValues } from 'react-hook-form';import { useSaveGraph } from '../hooks/use-save-graph';import { AddVariableModal } from './component/add-variable-modal';@@ -26,6 +25,10 @@ import {import { useObjectFields } from './hooks/use-object-fields';import { useTranslation } from 'react-i18next';+const stopPropagation: MouseEventHandler<HTMLButtonElement> = (e) => {+ e.stopPropagation();+};+export type IGlobalParamModalProps = {data: any;hideModal: (open: boolean) => void;@@ -142,9 +145,7 @@ export const GlobalParamSheet = (props: IGlobalParamModalProps) => {<Buttonvariant={'secondary'}className="bg-transparent hidden text-text-secondary border-none group-hover:bg-bg-card group-hover:text-text-primary group-hover:border group-hover:block"- onClick={(e) => {- e.stopPropagation();- }}+ onClick={stopPropagation}><Trash2 className="w-4 h-4" /></Button>diff --git a/web/src/pages/agent/hooks/use-build-options.tsx b/web/src/pages/agent/hooks/use-build-options.tsxindex d745ef1753..0684d6b6cb 100644--- a/web/src/pages/agent/hooks/use-build-options.tsx+++ b/web/src/pages/agent/hooks/use-build-options.tsx@@ -1,7 +1,5 @@import { buildUpstreamNodeOutputOptions } from '@/utils/canvas-util';import { useMemo } from 'react';-import { Operator } from '../constant';-import OperatorIcon from '@/components/operator-icon';import useGraphStore from '../store';export function useBuildNodeOutputOptions(nodeId?: string) {@@ -13,7 +11,6 @@ export function useBuildNodeOutputOptions(nodeId?: string) {nodes,edges,nodeId,- Icon: ({ name }) => <OperatorIcon name={name as Operator}></OperatorIcon>,});}, [edges, nodeId, nodes]);}diff --git a/web/src/pages/next-chats/chat/chat-box/single-chat-box.test.tsx b/web/src/pages/next-chats/chat/chat-box/single-chat-box.test.tsxindex 2995481d21..ef1de85bcb 100644--- a/web/src/pages/next-chats/chat/chat-box/single-chat-box.test.tsx+++ b/web/src/pages/next-chats/chat/chat-box/single-chat-box.test.tsx@@ -1,5 +1,4 @@import { render, waitFor } from '@testing-library/react';-import React from 'react';import { MessageType } from '@/constants/chat';import { SingleChatBox } from './single-chat-box';diff --git a/web/src/pages/next-chats/hooks/use-send-chat-message.ts b/web/src/pages/next-chats/hooks/use-send-chat-message.tsindex e6b62d4caf..895307fb05 100644--- a/web/src/pages/next-chats/hooks/use-send-chat-message.ts+++ b/web/src/pages/next-chats/hooks/use-send-chat-message.ts@@ -198,12 +198,9 @@ export const useSendMessage = () => {const id = uuid();- // useUploadFile tracks files as loosely typed records; narrow once here.- const attachedFiles = files as IMessage['files'];-const questionMessage: IMessage = {content: value,- files: attachedFiles,+ files,id,role: MessageType.User,conversationId: targetConversationId,@@ -233,7 +230,7 @@ export const useSendMessage = () => {id,content: value.trim(),role: MessageType.User,- files: attachedFiles,+ files,conversationId: targetConversationId,},enableInternet,diff --git a/web/src/pages/next-chats/hooks/use-upload-file.ts b/web/src/pages/next-chats/hooks/use-upload-file.tsindex b2bf871044..69aa5aae84 100644--- a/web/src/pages/next-chats/hooks/use-upload-file.ts+++ b/web/src/pages/next-chats/hooks/use-upload-file.ts@@ -3,14 +3,17 @@ import {useGetChatSearchParams,useUploadAndParseFile,} from '@/hooks/use-chat-request';+import { UploadResponseDataType } from '@/interfaces/database/chat';import { useCallback, useState } from 'react';import { useChatUrlParams } from './use-chat-url';import { useSetConversation } from './use-set-conversation';export function useUploadFile() {const { uploadAndParseFile, loading, cancel } = useUploadAndParseFile();- const [currentFiles, setCurrentFiles] = useState<Record<string, any>[]>([]);- const [fileMap, setFileMap] = useState<Map<File, Record<string, any>>>(+ const [currentFiles, setCurrentFiles] = useState<UploadResponseDataType[]>(+ [],+ );+ const [fileMap, setFileMap] = useState<Map<File, UploadResponseDataType>>(new Map(),);const { setConversation } = useSetConversation();diff --git a/web/src/pages/next-chats/index.tsx b/web/src/pages/next-chats/index.tsxindex 8197e5b37d..76d43cc3e8 100644--- a/web/src/pages/next-chats/index.tsx+++ b/web/src/pages/next-chats/index.tsx@@ -114,14 +114,14 @@ export default function ChatList() {return (<>- {loading && !data.chats?.length ? (+ {loading && !data?.chats?.length ? (<articleclassName="size-full flex items-center justify-center"data-testid="chats-list"><Spin size="large" /></article>- ) : data.chats?.length || searchString ? (+ ) : data?.chats?.length || searchString ? (<articleclassName="size-full min-w-0 flex flex-col"data-testid="chats-list"@@ -143,10 +143,10 @@ export default function ChatList() {</ListFilterBar></header>- {data.chats?.length ? (+ {data?.chats?.length ? (<><CardContainer className="flex-1 overflow-auto px-5">- {data.chats.map((x) => (+ {data?.chats.map((x) => (<ChatCardkey={x.id}data={x}diff --git a/web/src/utils/__tests__/pipeline-operator.test.ts b/web/src/utils/__tests__/pipeline-operator.test.tsindex e6f14e948b..ea957e0662 100644--- a/web/src/utils/__tests__/pipeline-operator.test.ts+++ b/web/src/utils/__tests__/pipeline-operator.test.ts@@ -119,10 +119,6 @@ describe('TokenChunker delimiter seeding on load', () => {});describe('Parser nested setups compatibility', () => {- beforeEach(() => {- mockIsGoBackend = true;- });-it('lifts a legacy nested "setups" object into file families', () => {const form = transformApiConfigToForm('Parser', {setups: {