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 UseChangeDocumentParser Hook

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

Overview

Hook for managing document parser change operations with modal state and API integration.

Description

useChangeDocumentParser combines useSetDocumentParser for the API call with useSetModalState for modal visibility. It maintains the target document record in local state. showChangeParserModal sets the record and opens the modal. onChangeParserOk calls setDocumentParser with the new parser ID, pipeline ID, and parser config, then closes the modal on success (return code 0). The hook also exports a UseChangeDocumentParserShowType utility type that extracts just the showChangeParserModal function for type-safe prop passing.

Usage

Used by DatasetTable to manage the chunk method change dialog lifecycle for individual documents.

Code Reference

Source Location

Signature

export const useChangeDocumentParser = () => {
  changeParserLoading, onChangeParserOk, changeParserVisible,
  hideChangeParserModal, showChangeParserModal, changeParserRecord,
};

export type UseChangeDocumentParserShowType = Pick<
  ReturnType<typeof useChangeDocumentParser>, 'showChangeParserModal'
>;

Import

import { useChangeDocumentParser, UseChangeDocumentParserShowType } from './use-change-document-parser';

I/O Contract

Inputs

Name Type Required Description
(none) - - Hook manages state internally

Outputs

Name Type Description
showChangeParserModal function Open modal with a document record
onChangeParserOk function Submit parser change with IChangeParserRequestBody
changeParserRecord IDocumentInfo Currently targeted document

Usage Examples

const { showChangeParserModal, onChangeParserOk, changeParserVisible } = useChangeDocumentParser();

Related Pages

Page Connections

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