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
cb22ff51
Commit
cb22ff51
authored
Aug 14, 2024
by
HoMeTown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: img
parent
04947448
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
12 deletions
+4
-12
src/components/MarkdownDetail/index.tsx
+1
-2
src/pages/Chat/components/ChatItem/ChatAnswerParser.tsx
+3
-10
No files found.
src/components/MarkdownDetail/index.tsx
View file @
cb22ff51
...
...
@@ -3,7 +3,6 @@ import ReactMarkdown from 'react-markdown'
import
rehypeRaw
from
'rehype-raw'
import
rehypeSanitize
from
'rehype-sanitize'
import
remarkGfm
from
'remark-gfm'
import
{
Image
}
from
'@nextui-org/image'
import
{
PhotoProvider
,
PhotoView
}
from
'react-photo-view'
interface
MarkdownDetailProps
{
...
...
@@ -20,7 +19,7 @@ export const MarkdownDetail: React.FC<MarkdownDetailProps> = ({ children }) => {
img
:
({
...
data
}):
JSX
.
Element
=>
(
<
PhotoProvider
maskOpacity=
{
0.1
}
bannerVisible=
{
false
}
>
<
PhotoView
{
...
(
data
as
any
)}
>
<
Image
alt=
"图⽚"
width=
"80%"
{
...
(
data
as
any
)
}
/>
<
img
className=
"w-2/3 cursor-pointer"
{
...
data
}
/>
</
PhotoView
>
</
PhotoProvider
>
),
...
...
src/pages/Chat/components/ChatItem/ChatAnswerParser.tsx
View file @
cb22ff51
import
React
,
{
useEffect
,
useState
}
from
'react'
import
ReactMarkdown
from
'react-markdown'
import
rehypeRaw
from
'rehype-raw'
import
rehypeSanitize
from
'rehype-sanitize'
import
remarkGfm
from
'remark-gfm'
import
{
ChatAnswerAttachment
}
from
'./ChatAnswerAttchment'
import
{
ChatAnswerOperate
}
from
'./ChatAnswerOperate'
import
{
formatMarkdown
}
from
'./markdownFormatter'
import
type
{
Answer
}
from
'@/types/chat'
import
{
MarkdownDetail
}
from
'@/components/MarkdownDetail'
interface
ChatAnswerParserProps
{
answer
:
Answer
...
...
@@ -37,13 +34,9 @@ export const ChatAnswerParser: React.FC<ChatAnswerParserProps> = ({ onComplate,
return
(
<
div
className=
"answerParser"
>
<
ReactMarkdown
rehypePlugins=
{
[
rehypeRaw
,
rehypeSanitize
]
}
remarkPlugins=
{
[
remarkGfm
]
}
className=
"markdown-content"
>
<
MarkdownDetail
>
{
displayedText
}
</
ReactMarkdown
>
</
MarkdownDetail
>
{
!
isTyping
&&
answer
.
attachmentList
&&
answer
.
attachmentList
?.
length
!==
0
...
...
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