fix: add dataset reset functionality and improve warning message consistency

This commit is contained in:
twwu
2025-07-25 17:30:19 +08:00
parent f887bbedab
commit e1861f5f9c
3 changed files with 5 additions and 2 deletions

View File

@ -11,6 +11,7 @@ import Button from '@/app/components/base/button'
import { ToastContext } from '@/app/components/base/toast'
import { createEmptyDataset } from '@/service/datasets'
import { useResetDatasetList } from '@/service/knowledge/use-dataset'
type IProps = {
show: boolean
@ -25,6 +26,7 @@ const EmptyDatasetCreationModal = ({
const { t } = useTranslation()
const { notify } = useContext(ToastContext)
const router = useRouter()
const resetDatasetList = useResetDatasetList()
const submit = async () => {
if (!inputValue) {
@ -37,6 +39,7 @@ const EmptyDatasetCreationModal = ({
}
try {
const dataset = await createEmptyDataset({ name: inputValue })
resetDatasetList()
onHide()
router.push(`/datasets/${dataset.id}/documents`)
}