fix(knowledge-base): regenerate child chunks not working completely (#27934)

This commit is contained in:
breath57
2025-11-13 15:36:27 +08:00
committed by GitHub
parent 667b1c37a3
commit 45e816a9f6
3 changed files with 17 additions and 4 deletions

View File

@@ -27,6 +27,7 @@ type ISegmentDetailProps = {
onCancel: () => void
isEditMode?: boolean
docForm: ChunkingMode
onModalStateChange?: (isOpen: boolean) => void
}
/**
@@ -38,6 +39,7 @@ const SegmentDetail: FC<ISegmentDetailProps> = ({
onCancel,
isEditMode,
docForm,
onModalStateChange,
}) => {
const { t } = useTranslation()
const [question, setQuestion] = useState(isEditMode ? segInfo?.content || '' : segInfo?.sign_content || '')
@@ -68,11 +70,19 @@ const SegmentDetail: FC<ISegmentDetailProps> = ({
const handleRegeneration = useCallback(() => {
setShowRegenerationModal(true)
}, [])
onModalStateChange?.(true)
}, [onModalStateChange])
const onCancelRegeneration = useCallback(() => {
setShowRegenerationModal(false)
}, [])
onModalStateChange?.(false)
}, [onModalStateChange])
const onCloseAfterRegeneration = useCallback(() => {
setShowRegenerationModal(false)
onModalStateChange?.(false)
onCancel() // Close the edit drawer
}, [onCancel, onModalStateChange])
const onConfirmRegeneration = useCallback(() => {
onUpdate(segInfo?.id || '', question, answer, keywords, true)
@@ -161,7 +171,7 @@ const SegmentDetail: FC<ISegmentDetailProps> = ({
isShow={showRegenerationModal}
onConfirm={onConfirmRegeneration}
onCancel={onCancelRegeneration}
onClose={onCancelRegeneration}
onClose={onCloseAfterRegeneration}
/>
)
}