mirror of
				https://github.com/langgenius/dify.git
				synced 2025-11-04 04:43:09 +00:00 
			
		
		
		
	fix: fix chunk and segment detail components (#14002)
This commit is contained in:
		
							parent
							
								
									bbfe83c86b
								
							
						
					
					
						commit
						9c42626772
					
				@ -265,7 +265,7 @@ export function Markdown(props: { content: string; className?: string }) {
 | 
			
		||||
            }
 | 
			
		||||
          },
 | 
			
		||||
        ]}
 | 
			
		||||
        disallowedElements={['iframe', 'head', 'html', 'meta', 'link', 'style', 'body']}
 | 
			
		||||
        disallowedElements={['iframe', 'head', 'html', 'meta', 'link', 'style', 'body', 'input']}
 | 
			
		||||
        components={{
 | 
			
		||||
          code: CodeBlock,
 | 
			
		||||
          img: Img,
 | 
			
		||||
 | 
			
		||||
@ -50,7 +50,6 @@ const ChildSegmentDetail: FC<IChildSegmentDetailProps> = ({
 | 
			
		||||
 | 
			
		||||
  const handleCancel = () => {
 | 
			
		||||
    onCancel()
 | 
			
		||||
    setContent(childChunkInfo?.content || '')
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  const handleSave = () => {
 | 
			
		||||
 | 
			
		||||
@ -80,7 +80,7 @@ export const useSegmentListContext = (selector: (value: SegmentListContextValue)
 | 
			
		||||
  return useContextSelector(SegmentListContext, selector)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
interface ICompletedProps {
 | 
			
		||||
type ICompletedProps = {
 | 
			
		||||
  embeddingAvailable: boolean
 | 
			
		||||
  showNewSegmentModal: boolean
 | 
			
		||||
  onNewSegmentModalChange: (state: boolean) => void
 | 
			
		||||
@ -357,6 +357,7 @@ const Completed: FC<ICompletedProps> = ({
 | 
			
		||||
          if (seg.id === segmentId) {
 | 
			
		||||
            seg.answer = res.data.answer
 | 
			
		||||
            seg.content = res.data.content
 | 
			
		||||
            seg.sign_content = res.data.sign_content
 | 
			
		||||
            seg.keywords = res.data.keywords
 | 
			
		||||
            seg.word_count = res.data.word_count
 | 
			
		||||
            seg.hit_count = res.data.hit_count
 | 
			
		||||
 | 
			
		||||
@ -68,7 +68,6 @@ const NewChildSegmentModal: FC<NewChildSegmentModalProps> = ({
 | 
			
		||||
  const handleCancel = (actionType: 'esc' | 'add' = 'esc') => {
 | 
			
		||||
    if (actionType === 'esc' || !addAnother)
 | 
			
		||||
      onCancel()
 | 
			
		||||
    setContent('')
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  const { mutateAsync: addChildSegment } = useAddChildSegment()
 | 
			
		||||
 | 
			
		||||
@ -49,7 +49,7 @@ const ChunkContent: FC<ChunkContentProps> = ({
 | 
			
		||||
      isFullDocMode ? 'line-clamp-3' : isCollapsed ? 'line-clamp-2' : 'line-clamp-20',
 | 
			
		||||
      className,
 | 
			
		||||
    )}
 | 
			
		||||
    content={sign_content || content}
 | 
			
		||||
    content={sign_content || content || ''}
 | 
			
		||||
  />
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -57,9 +57,6 @@ const SegmentDetail: FC<ISegmentDetailProps> = ({
 | 
			
		||||
 | 
			
		||||
  const handleCancel = () => {
 | 
			
		||||
    onCancel()
 | 
			
		||||
    setQuestion(segInfo?.content || '')
 | 
			
		||||
    setAnswer(segInfo?.answer || '')
 | 
			
		||||
    setKeywords(segInfo?.keywords || [])
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  const handleSave = () => {
 | 
			
		||||
 | 
			
		||||
@ -70,9 +70,6 @@ const NewSegmentModal: FC<NewSegmentModalProps> = ({
 | 
			
		||||
  const handleCancel = (actionType: 'esc' | 'add' = 'esc') => {
 | 
			
		||||
    if (actionType === 'esc' || !addAnother)
 | 
			
		||||
      onCancel()
 | 
			
		||||
    setQuestion('')
 | 
			
		||||
    setAnswer('')
 | 
			
		||||
    setKeywords([])
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  const { mutateAsync: addSegment } = useAddSegment()
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user