mirror of https://github.com/langgenius/dify.git
fix: fix markdown escape issue (#30299)
This commit is contained in:
parent
c1af6a7127
commit
bf76f10653
|
|
@ -18,12 +18,19 @@ const BasicContent: FC<BasicContentProps> = ({
|
|||
if (annotation?.logAnnotation)
|
||||
return <Markdown content={annotation?.logAnnotation.content || ''} />
|
||||
|
||||
// Preserve Windows UNC paths and similar backslash-heavy strings by
|
||||
// wrapping them in inline code so Markdown renders backslashes verbatim.
|
||||
let displayContent = content
|
||||
if (typeof content === 'string' && /^\\\\\S.*/.test(content) && !/^`.*`$/.test(content)) {
|
||||
displayContent = `\`${content}\``
|
||||
}
|
||||
|
||||
return (
|
||||
<Markdown
|
||||
className={cn(
|
||||
item.isError && '!text-[#F04438]',
|
||||
)}
|
||||
content={content}
|
||||
content={displayContent}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ const Answer: FC<AnswerProps> = ({
|
|||
}
|
||||
}, [switchSibling, item.prevSibling, item.nextSibling])
|
||||
|
||||
const contentIsEmpty = content.trim() === ''
|
||||
const contentIsEmpty = typeof content === 'string' && content.trim() === ''
|
||||
|
||||
return (
|
||||
<div className="mb-2 flex last:mb-0">
|
||||
|
|
|
|||
Loading…
Reference in New Issue