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
c398ed18
Commit
c398ed18
authored
Nov 24, 2025
by
Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:收藏返回时回到当前选中工具
parent
6a029a0e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
1 deletions
+20
-1
src/components/ChatEditor/index.tsx
+13
-1
src/layouts/Navbar/Navbar.tsx
+7
-0
No files found.
src/components/ChatEditor/index.tsx
View file @
c398ed18
...
...
@@ -32,6 +32,7 @@ const ChatEditorBase: React.FC<ChatEditorProps & WithAuthProps> = ({ checkAuth,
const
[
toolList
,
setToolList
]
=
useState
<
any
[]
>
([])
const
[
selectedToolId
,
setSelectedToolId
]
=
useState
<
string
|
null
>
(
null
)
const
[
isToolBtnActive
,
setIsToolBtnActive
]
=
useState
<
boolean
>
(
true
)
const
currentToolId
=
useAppSelector
((
state
:
RootState
)
=>
state
.
conversation
.
currentToolId
)
// 获取工具列表
const
getToolList
=
async
()
=>
{
...
...
@@ -50,6 +51,18 @@ const ChatEditorBase: React.FC<ChatEditorProps & WithAuthProps> = ({ checkAuth,
}
}
// 保持当前工具状态与 Redux 中的同步,确保跨页面返回时仍保持原模式
useEffect
(()
=>
{
if
(
currentToolId
)
{
setSelectedToolId
(
currentToolId
)
setIsToolBtnActive
(
false
)
}
else
{
setSelectedToolId
(
null
)
setIsToolBtnActive
(
true
)
}
},
[
currentToolId
])
const
startAnimation
=
()
=>
{
intervalRef
.
current
=
setInterval
(()
=>
{
setCurrentPlaceholder
(
prev
=>
(
prev
+
1
)
%
placeholders
.
length
)
...
...
@@ -289,7 +302,6 @@ const ChatEditorBase: React.FC<ChatEditorProps & WithAuthProps> = ({ checkAuth,
{
tool
.
toolIcon
&&
(
<
img
src=
{
tool
.
toolIcon
}
alt=
{
tool
.
toolName
}
className=
"w-4 h-4 flex-shrink-0"
/>
)
}
...
...
src/layouts/Navbar/Navbar.tsx
View file @
c398ed18
...
...
@@ -108,6 +108,13 @@ const NavbarBase: React.FC<NavbarProps & WithAuthProps> = ({ isHistoryVisible, c
}
},
[
shouldNavigateToNewConversation
,
currentConversationId
,
navigate
,
dispatch
])
// keep latest conversation id in sessionStorage for cross-page returns (e.g., from collect)
useEffect
(()
=>
{
if
(
currentConversationId
)
{
sessionStorage
.
setItem
(
'currentConversationId'
,
currentConversationId
)
}
},
[
currentConversationId
])
const
navRef
=
useRef
<
HTMLButtonElement
>
(
null
)
useClickAway
(()
=>
{
setIsH5NavVisible
(
true
)
...
...
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