import React from 'react' import { RiAddLine, RiBookOpenLine, RiCloseLine, } from '@remixicon/react' import { useTranslation } from 'react-i18next' import ExternalKnowledgeAPICard from '../external-knowledge-api-card' import cn from '@/utils/classnames' import { useExternalKnowledgeApi } from '@/context/external-knowledge-api-context' import ActionButton from '@/app/components/base/action-button' import Button from '@/app/components/base/button' import Loading from '@/app/components/base/loading' import { useModalContext } from '@/context/modal-context' type ExternalAPIPanelProps = { onClose: () => void } const ExternalAPIPanel: React.FC = ({ onClose }) => { const { t } = useTranslation() const { setShowExternalKnowledgeAPIModal } = useModalContext() const { externalKnowledgeApiList, mutateExternalKnowledgeApis, isLoading } = useExternalKnowledgeApi() const handleOpenExternalAPIModal = () => { setShowExternalKnowledgeAPIModal({ payload: { name: '', settings: { endpoint: '', api_key: '' } }, datasetBindings: [], onSaveCallback: () => { mutateExternalKnowledgeApis() }, onCancelCallback: () => { mutateExternalKnowledgeApis() }, isEditMode: false, }) } return (
{t('dataset.externalAPIPanelTitle')}
{t('dataset.externalAPIPanelDescription')}
{t('dataset.externalAPIPanelDocumentation')}
onClose()}>
{isLoading ? ( ) : ( externalKnowledgeApiList.map(api => ( )) )}
) } export default ExternalAPIPanel