Implementation:Infiniflow Ragflow RerankFormFields Component
| Knowledge Sources | |
|---|---|
| Domains | Frontend, UI_Components, Search |
| Last Updated | 2026-02-12 06:00 GMT |
Overview
Concrete form fields for reranking model selection with top-K parameter and Zod validation schemas provided by the RAGFlow frontend.
Description
Exports RerankFormFields (combined rerank model selector with top-K slider), rerankFormSchema (Zod validation schema), topKSchema, and initialTopKValue. The rerank model field conditionally shows the top-K parameter only when a rerank model is selected.
Usage
Import these components when building retrieval configuration forms that include reranking model selection, such as chat and search application settings.
Code Reference
Source Location
- Repository: Infiniflow_Ragflow
- File: web/src/components/rerank.tsx
- Lines: 1-78
Signature
export const topKSchema: ZodSchema;
export const initialTopKValue: { top_k: number };
export const rerankFormSchema: ZodObject;
export function RerankFormFields(): JSX.Element;
Import
import { RerankFormFields, rerankFormSchema, topKSchema } from '@/components/rerank';
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| Form context | react-hook-form | Yes | Must be within a FormProvider |
Outputs
| Name | Type | Description |
|---|---|---|
| rerankFormSchema | ZodSchema | Validation schema for rerank fields |
| Form values | object | rerank_id and top_k values |
Usage Examples
import { RerankFormFields, rerankFormSchema } from '@/components/rerank';
const schema = z.object({
...rerankFormSchema.shape,
// other fields
});
<FormProvider {...methods}>
<RerankFormFields />
</FormProvider>