Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sdream-ai-fe
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
侯明涛
sdream-ai-fe
Commits
9b3c8a69
Commit
9b3c8a69
authored
Mar 23, 2026
by
Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:工单等提交问题
parent
06679be6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
13 deletions
+13
-13
src/components/MarkdownDetail/index.tsx
+10
-2
src/pages/Chat/components/ChatItem/ChatAnswerParser.tsx
+3
-11
No files found.
src/components/MarkdownDetail/index.tsx
View file @
9b3c8a69
...
...
@@ -10,6 +10,8 @@ interface MarkdownDetailProps {
children
:
ReactNode
/** Disable mermaid/pie rendering (fallback to normal code block). */
disableMermaid
?:
boolean
/** Disable only pie rendering (fallback to normal code block). */
disablePie
?:
boolean
}
const
sanitizeSchema
=
{
...
...
@@ -140,7 +142,7 @@ function MermaidBlock({ chart }: { chart: string }) {
)
}
export
const
MarkdownDetail
:
React
.
FC
<
MarkdownDetailProps
>
=
memo
(({
children
,
disableMermaid
})
=>
{
export
const
MarkdownDetail
:
React
.
FC
<
MarkdownDetailProps
>
=
memo
(({
children
,
disableMermaid
,
disablePie
})
=>
{
return
(
<
ReactMarkdown
rehypePlugins=
{
[
rehypeRaw
,
[
rehypeSanitize
,
sanitizeSchema
as
any
]]
}
...
...
@@ -168,7 +170,13 @@ export const MarkdownDetail: React.FC<MarkdownDetailProps> = memo(({ children, d
if
(
isValidElement
(
first
))
{
const
className
=
String
((
first
.
props
as
any
)?.
className
||
''
)
const
lang
=
className
.
match
(
/language-
(\S
+
)
/
)?.[
1
]?.
toLowerCase
()
if
(
!
disableMermaid
&&
(
lang
?.
startsWith
(
'mermaid'
)
||
lang
===
'pie'
))
{
const
isMermaid
=
!!
lang
?.
startsWith
(
'mermaid'
)
const
isPie
=
lang
===
'pie'
// Keep behavior explicit: only mermaid is guarded by disableMermaid, only pie is guarded by disablePie.
if
(
(
isMermaid
&&
!
disableMermaid
)
||
(
isPie
&&
!
disablePie
)
)
{
const
chart
=
toText
((
first
.
props
as
any
)?.
children
)
return
<
MermaidBlock
chart=
{
chart
}
/>
}
...
...
src/pages/Chat/components/ChatItem/ChatAnswerParser.tsx
View file @
9b3c8a69
...
...
@@ -186,17 +186,9 @@ export const ChatAnswerParser: React.FC<ChatAnswerParserProps> = ({ isLastAnswer
{
!!
displayedText
.
length
&&
(
<
div
style=
{
{
background
:
'#F7FAFD'
}
}
className=
{
answer
.
cardList
?.
length
?
'mb-[20px]'
:
''
}
>
{
answer
.
endAnswerFlag
?
(
<
MarkdownDetail
>
{
displayedText
}
</
MarkdownDetail
>
)
:
(
<
pre
className=
"whitespace-pre-wrap break-words"
>
{
displayedText
}
</
pre
>
)
}
<
MarkdownDetail
disablePie=
{
!
answer
.
endAnswerFlag
}
>
{
displayedText
}
</
MarkdownDetail
>
</
div
>
)
}
{
!
isTyping
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment