| } | } | ||||
| } | } | ||||
| export function Markdown(props: { content: string; className?: string }) { | |||||
| export function Markdown(props: { content: string; className?: string; customDisallowedElements?: string[] }) { | |||||
| const latexContent = flow([ | const latexContent = flow([ | ||||
| preprocessThinkTag, | preprocessThinkTag, | ||||
| preprocessLaTeX, | preprocessLaTeX, | ||||
| } | } | ||||
| }, | }, | ||||
| ]} | ]} | ||||
| disallowedElements={['iframe', 'head', 'html', 'meta', 'link', 'style', 'body', 'input']} | |||||
| disallowedElements={['iframe', 'head', 'html', 'meta', 'link', 'style', 'body', ...(props.customDisallowedElements || [])]} | |||||
| components={{ | components={{ | ||||
| code: CodeBlock, | code: CodeBlock, | ||||
| img: Img, | img: Img, |
| <Markdown | <Markdown | ||||
| className='h-full w-full !text-text-secondary' | className='h-full w-full !text-text-secondary' | ||||
| content={question} | content={question} | ||||
| customDisallowedElements={['input']} | |||||
| /> | /> | ||||
| ) | ) | ||||
| } | } |
| className, | className, | ||||
| )} | )} | ||||
| content={sign_content || content || ''} | content={sign_content || content || ''} | ||||
| customDisallowedElements={['input']} | |||||
| /> | /> | ||||
| } | } | ||||
| <Markdown | <Markdown | ||||
| className={cn('!mt-2 !text-text-secondary', heighClassName)} | className={cn('!mt-2 !text-text-secondary', heighClassName)} | ||||
| content={sign_content || content} | content={sign_content || content} | ||||
| customDisallowedElements={['input']} | |||||
| /> | /> | ||||
| {!isParentChildRetrieval && keywords && keywords.length > 0 && ( | {!isParentChildRetrieval && keywords && keywords.length > 0 && ( | ||||
| <div className='mt-6'> | <div className='mt-6'> |
| {/* Main */} | {/* Main */} | ||||
| <div className='mt-1 px-3'> | <div className='mt-1 px-3'> | ||||
| <Markdown className='line-clamp-2' content={sign_content || content} /> | |||||
| <Markdown | |||||
| className='line-clamp-2' | |||||
| content={sign_content || content} | |||||
| customDisallowedElements={['input']} | |||||
| /> | |||||
| {isParentChildRetrieval && ( | {isParentChildRetrieval && ( | ||||
| <div className='mt-1'> | <div className='mt-1'> | ||||
| <div | <div |