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 SetMetaDialog Component

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

Overview

Dialog with Monaco editor for viewing and editing document metadata as JSON with Zod validation.

Description

SetMetaDialog renders a modal with a Monaco code editor (@monaco-editor/react) configured for JSON with dark theme. The form uses react-hook-form with a Zod schema that validates the meta field is a non-empty, valid JSON string via a custom refine that wraps JSON.parse in a try-catch. The initial value is set from initialMetaData via JSON.stringify with 4-space indentation. The tooltip for the form label is sanitized with DOMPurify. On submit, the raw JSON string is passed to onOk, and the modal closes on success.

Usage

Opened from the dataset document table to allow users to manually edit the JSON metadata fields of a specific document.

Code Reference

Source Location

Signature

export function SetMetaDialog({
  hideModal, onOk, loading, initialMetaData,
}: IModalProps<any> & { initialMetaData?: IDocumentInfo['meta_fields'] }): JSX.Element;

Import

import { SetMetaDialog } from './set-meta-dialog';

I/O Contract

Inputs

Name Type Required Description
hideModal function No Close dialog callback
onOk function No Submit callback receiving JSON string
loading boolean No Loading state for submit button
initialMetaData object No Initial metadata object to populate editor

Outputs

Name Type Description
JSX.Element React element Dialog with Monaco JSON editor and save button

Usage Examples

<SetMetaDialog
  hideModal={closeDialog}
  onOk={saveMeta}
  loading={saving}
  initialMetaData={document.meta_fields}
/>

Related Pages

Page Connections

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