dataset-dataflow-creating-dialog.tsx


Overview

dataset-dataflow-creating-dialog.tsx is a React component file that provides a user interface for creating a new dataset or knowledge base entry via a modal dialog. It leverages form validation, localization, and conditional rendering to capture user input in a structured way. The primary components are:

This file is part of a larger system managing datasets, knowledge extraction, and embedding models, integrating with reusable UI components and data configuration items.


Detailed Components and Functions

Constants

FormId: string


InputForm Component

function InputForm({ onOk }: IModalProps<any>): JSX.Element

Purpose

Renders a form to input the dataset or knowledge base name and select parsing options. It validates user input using zod schema and conditionally renders additional configuration items based on the selected parse type.

Props

Internal Logic

Rendered Form Fields

Usage Example

<InputForm onOk={(datasetName) => console.log('Dataset created:', datasetName)} />

DatasetCreatingDialog Component

function DatasetCreatingDialog({
  hideModal,
  onOk,
  loading,
}: IModalProps<any>): JSX.Element

Purpose

Encapsulates the InputForm within a modal dialog. It controls the dialog's open state, submission loading state, and triggers callbacks when the dialog is closed or the form is submitted.

Props

Structure and Behavior

Usage Example

<DatasetCreatingDialog
  hideModal={() => setShowDialog(false)}
  onOk={(name) => saveDataset(name)}
  loading={isSaving}
/>

Important Implementation Details


Interaction with Other Parts of the System


Mermaid Component Diagram

componentDiagram
    component DatasetCreatingDialog {
        +hideModal()
        +onOk(data)
        +loading: boolean
        --
        uses InputForm
        uses Dialog
        uses ButtonLoading
    }
    component InputForm {
        +onOk(data)
        --
        uses useForm (react-hook-form)
        uses Form
        uses Input
        uses EmbeddingModelItem
        uses ParseTypeItem
        uses DataFlowItem (conditional)
        uses DataExtractKnowledgeItem (conditional)
        uses TeamItem (conditional)
    }

Summary

dataset-dataflow-creating-dialog.tsx provides a modal dialog containing a validated, localized form for creating datasets or knowledge bases with conditional configuration options. It is designed for extensibility, localization, and integration with domain-specific components, supporting a clean UX flow for dataset creation within a larger application context.