import type { FC } from 'react' import { memo, useCallback, } from 'react' import { useTranslation } from 'react-i18next' import VarReferencePicker from '../_base/components/variable/var-reference-picker' import useConfig from './use-config' import RetrievalConfig from './components/retrieval-config' import AddKnowledge from './components/add-dataset' import DatasetList from './components/dataset-list' import type { KnowledgeRetrievalNodeType } from './types' import Field from '@/app/components/workflow/nodes/_base/components/field' import Split from '@/app/components/workflow/nodes/_base/components/split' import OutputVars, { VarItem } from '@/app/components/workflow/nodes/_base/components/output-vars' import { InputVarType, type NodePanelProps } from '@/app/components/workflow/types' import BeforeRunForm from '@/app/components/workflow/nodes/_base/components/before-run-form' import ResultPanel from '@/app/components/workflow/run/result-panel' const i18nPrefix = 'workflow.nodes.knowledgeRetrieval' const Panel: FC> = ({ id, data, }) => { const { t } = useTranslation() const { readOnly, inputs, handleQueryVarChange, filterVar, handleModelChanged, handleCompletionParamsChange, handleRetrievalModeChange, handleMultipleRetrievalConfigChange, selectedDatasets, handleOnDatasetsChange, isShowSingleRun, hideSingleRun, runningStatus, handleRun, handleStop, query, setQuery, runResult, rerankModelOpen, setRerankModelOpen, } = useConfig(id, data) const handleOpenFromPropsChange = useCallback((openFromProps: boolean) => { setRerankModelOpen(openFromProps) }, [setRerankModelOpen]) return (
{/* {JSON.stringify(inputs, null, 2)} */} {!readOnly && (
)} {!readOnly && ( )}
} >
<> {isShowSingleRun && ( setQuery((keyValue as any).query), }, ]} runningStatus={runningStatus} onRun={handleRun} onStop={handleStop} result={} /> )}
) } export default memo(Panel)