mirror of https://github.com/langgenius/dify.git
fix: Integrate dataset list reset functionality in dropdown and step two components
This commit is contained in:
parent
59c3305dcc
commit
4a8061d14c
|
|
@ -15,6 +15,7 @@ import { useTranslation } from 'react-i18next'
|
|||
import RenameDatasetModal from '../../datasets/rename-modal'
|
||||
import { checkIsUsedInApp, deleteDataset } from '@/service/datasets'
|
||||
import Confirm from '../../base/confirm'
|
||||
import { useRouter } from 'next/navigation'
|
||||
|
||||
type DropDownProps = {
|
||||
expand: boolean
|
||||
|
|
@ -24,6 +25,7 @@ const DropDown = ({
|
|||
expand,
|
||||
}: DropDownProps) => {
|
||||
const { t } = useTranslation()
|
||||
const { replace } = useRouter()
|
||||
const [open, setOpen] = useState(false)
|
||||
const [showRenameModal, setShowRenameModal] = useState(false)
|
||||
const [confirmMessage, setConfirmMessage] = useState<string>('')
|
||||
|
|
@ -91,12 +93,13 @@ const DropDown = ({
|
|||
try {
|
||||
await deleteDataset(dataset.id)
|
||||
Toast.notify({ type: 'success', message: t('dataset.datasetDeleted') })
|
||||
refreshDataset()
|
||||
resetDatasetList()
|
||||
replace('/datasets')
|
||||
}
|
||||
finally {
|
||||
setShowConfirmDelete(false)
|
||||
}
|
||||
}, [dataset.id, refreshDataset, t])
|
||||
}, [dataset.id, replace, resetDatasetList, t])
|
||||
|
||||
return (
|
||||
<PortalToFollowElem
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ import { PortalToFollowElem, PortalToFollowElemContent, PortalToFollowElemTrigge
|
|||
import { AlertTriangle } from '@/app/components/base/icons/src/vender/solid/alertsAndFeedback'
|
||||
import { noop } from 'lodash-es'
|
||||
import { useDocLink } from '@/context/i18n'
|
||||
import { useResetDatasetList } from '@/service/knowledge/use-dataset'
|
||||
|
||||
const TextLabel: FC<PropsWithChildren> = (props) => {
|
||||
return <label className='system-sm-semibold text-text-secondary'>{props.children}</label>
|
||||
|
|
@ -509,7 +510,7 @@ const StepTwo = ({
|
|||
const max = rules.segmentation.max_tokens
|
||||
const overlap = rules.segmentation.chunk_overlap
|
||||
const isHierarchicalDocument = documentDetail.doc_form === ChunkingMode.parentChild
|
||||
|| (rules.parent_mode && rules.subchunk_segmentation)
|
||||
|| (rules.parent_mode && rules.subchunk_segmentation)
|
||||
setSegmentIdentifier(separator)
|
||||
setMaxChunkLength(max)
|
||||
setOverlap(overlap!)
|
||||
|
|
@ -555,6 +556,7 @@ const StepTwo = ({
|
|||
})
|
||||
|
||||
const isCreating = createFirstDocumentMutation.isPending || createDocumentMutation.isPending
|
||||
const resetDatasetList = useResetDatasetList()
|
||||
|
||||
const createHandle = async () => {
|
||||
const params = getCreationParams()
|
||||
|
|
@ -584,6 +586,7 @@ const StepTwo = ({
|
|||
}
|
||||
if (mutateDatasetRes)
|
||||
mutateDatasetRes()
|
||||
resetDatasetList()
|
||||
onStepChange && onStepChange(+1)
|
||||
isSetting && onSave && onSave()
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue