Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Infiniflow Ragflow DatasetSettingHooks

From Leeroopedia
Knowledge Sources
Domains Frontend, Knowledge_Base
Last Updated 2026-02-12 06:00 GMT

Overview

Business logic hooks for dataset configuration including chunk method filtering, embedding model selection, form initialization, tag renaming, and embedding validation.

Description

This module exports six hooks. useSelectChunkMethodList filters parser list to exclude hidden types (email, picture, audio). useSelectEmbeddingModelOptions returns embedding model options from LLM type selections. useHasParsedDocument checks if a knowledge base has parsed chunks. useFetchKnowledgeConfigurationOnMount initializes the form with knowledge base details including merged parser_config with raptor/graphrag defaults, using form.reset. useSelectKnowledgeDetailsLoading checks loading state via useIsFetching. useRenameKnowledgeTag manages tag rename modal state. useHandleKbEmbedding provides an async handler to validate embedding model changes via kbService.checkEmbedding.

Usage

Consumed by the dataset settings page and its sub-components to manage configuration state, validate changes, and populate form defaults.

Code Reference

Source Location

Signature

export function useSelectChunkMethodList(): ParserOption[];
export function useSelectEmbeddingModelOptions(): LlmOption[];
export function useHasParsedDocument(isEdit?: boolean): boolean;
export const useFetchKnowledgeConfigurationOnMount = (form: UseFormReturn) => { knowledgeDetails, loading };
export const useSelectKnowledgeDetailsLoading = () => boolean;
export const useRenameKnowledgeTag = () => { initialName, tagRenameVisible, hideTagRenameModal, showTagRenameModal };
export const useHandleKbEmbedding = () => { handleChange };

Import

import { useSelectChunkMethodList, useFetchKnowledgeConfigurationOnMount, useHandleKbEmbedding } from './hooks';

I/O Contract

Inputs

Name Type Required Description
form UseFormReturn Yes (for useFetchKnowledgeConfigurationOnMount) react-hook-form instance to reset with fetched values
isEdit boolean No Whether the form is in edit mode (for useHasParsedDocument)

Outputs

Name Type Description
knowledgeDetails object Fetched knowledge base configuration data
handleChange function Async embedding validation handler

Usage Examples

const chunkMethods = useSelectChunkMethodList();
const { knowledgeDetails } = useFetchKnowledgeConfigurationOnMount(form);
const { handleChange } = useHandleKbEmbedding();

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment