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
79258d30
Commit
79258d30
authored
Dec 01, 2025
by
Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:图标改为base64
parent
d920f8aa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
1 deletions
+14
-1
src/components/ChatEditor/index.tsx
+14
-1
No files found.
src/components/ChatEditor/index.tsx
View file @
79258d30
...
@@ -414,6 +414,19 @@ const ChatEditorBase: React.FC<ChatEditorProps & WithAuthProps> = ({ checkAuth,
...
@@ -414,6 +414,19 @@ const ChatEditorBase: React.FC<ChatEditorProps & WithAuthProps> = ({ checkAuth,
await
handleToolClick
(
tool
)
await
handleToolClick
(
tool
)
}
}
// 处理后端返回的 base64 图标
const
getToolIconSrc
=
()
=>
{
if
(
!
tool
.
toolIcon
)
return
''
// 已经是完整的 dataURL,直接返回
if
(
typeof
tool
.
toolIcon
===
'string'
&&
tool
.
toolIcon
.
startsWith
(
'data:image'
))
return
tool
.
toolIcon
// 否则默认按 png 的纯 base64 拼接,如有需要可根据后端类型字段动态调整
return
`data:image/png;base64,${tool.toolIcon}`
}
return
(
return
(
<
Button
<
Button
key=
{
tool
.
toolId
||
`tool-${index}`
}
key=
{
tool
.
toolId
||
`tool-${index}`
}
...
@@ -425,7 +438,7 @@ const ChatEditorBase: React.FC<ChatEditorProps & WithAuthProps> = ({ checkAuth,
...
@@ -425,7 +438,7 @@ const ChatEditorBase: React.FC<ChatEditorProps & WithAuthProps> = ({ checkAuth,
>
>
{
tool
.
toolIcon
&&
(
{
tool
.
toolIcon
&&
(
<
img
<
img
src=
{
tool
.
toolIcon
}
src=
{
getToolIconSrc
()
}
className=
"w-4 h-4 flex-shrink-0"
className=
"w-4 h-4 flex-shrink-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