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
f0b87df8
Commit
f0b87df8
authored
Feb 02, 2026
by
Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:提质增效返回时参数逻辑
parent
e28c4017
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
17 deletions
+66
-17
src/pages/Chat/Chat.tsx
+66
-17
No files found.
src/pages/Chat/Chat.tsx
View file @
f0b87df8
...
...
@@ -556,23 +556,6 @@ export const Chat: React.FC = () => {
}
}
// 如果从收藏页返回,触发事件通知 HomeNew 刷新问题列表
if
(
fromCollect
)
{
const
eventToolId
=
toolId
||
currentToolId
||
safeSessionStorageGetItem
(
'currentToolId'
)
||
''
console
.
log
(
'[Chat] 检测到从收藏页返回 (fromCollect=true) - 准备触发 refreshQuestionsFromCollect 事件'
)
console
.
log
(
'[Chat] refreshQuestionsFromCollect - 传递的 toolId:'
,
eventToolId
)
// 清除 sessionStorage 中的标记,避免影响后续路由
sessionStorage
.
removeItem
(
'fromCollect'
)
// 延迟触发事件,确保 Home 组件的监听器已注册
setTimeout
(()
=>
{
window
.
dispatchEvent
(
new
CustomEvent
(
'refreshQuestionsFromCollect'
,
{
detail
:
{
toolId
:
eventToolId
,
},
}))
console
.
log
(
'[Chat] refreshQuestionsFromCollect 事件已触发'
)
},
100
)
}
await
waitForToken
()
const
res
=
await
fetchUserQaRecordPage
(
finalConversationId
,
toolId
||
safeSessionStorageGetItem
(
'currentToolId'
)
||
''
)
console
.
log
(
'qaRes chatEditor2222222'
,
res
)
...
...
@@ -617,6 +600,23 @@ export const Chat: React.FC = () => {
}
// 无条件同步到 sessionStorage,确保 ChatEditor 和 handleSubmitQuestion 能获取到正确的 toolId
sessionStorage
.
setItem
(
'currentToolId'
,
toolIdFromState
)
// 如果从收藏页返回,在确定 toolId 后触发事件通知 HomeNew 刷新问题列表
if
(
fromCollect
)
{
const
eventToolId
=
toolIdFromState
||
toolId
||
currentToolId
||
safeSessionStorageGetItem
(
'currentToolId'
)
||
''
console
.
log
(
'[Chat] 检测到从收藏页返回 (fromCollect=true) - 准备触发 refreshQuestionsFromCollect 事件'
)
console
.
log
(
'[Chat] refreshQuestionsFromCollect - 传递的 toolId:'
,
eventToolId
)
// 清除 sessionStorage 中的标记,避免影响后续路由
sessionStorage
.
removeItem
(
'fromCollect'
)
// 延迟触发事件,确保 Home 组件的监听器已注册,并且 toolId 已经同步到 sessionStorage
setTimeout
(()
=>
{
window
.
dispatchEvent
(
new
CustomEvent
(
'refreshQuestionsFromCollect'
,
{
detail
:
{
toolId
:
eventToolId
,
},
}))
console
.
log
(
'[Chat] refreshQuestionsFromCollect 事件已触发'
)
},
100
)
}
}
else
{
// 如果从 location.state 传递的是 null,清除 toolId
...
...
@@ -625,6 +625,21 @@ export const Chat: React.FC = () => {
}
// 清除 sessionStorage,确保制度活化模式正确
sessionStorage
.
removeItem
(
'currentToolId'
)
// 如果从收藏页返回,在确定 toolId 后触发事件通知 HomeNew 刷新问题列表(制度活化模式)
if
(
fromCollect
)
{
console
.
log
(
'[Chat] 检测到从收藏页返回 (fromCollect=true) - 制度活化模式 - 准备触发 refreshQuestionsFromCollect 事件'
)
// 清除 sessionStorage 中的标记,避免影响后续路由
sessionStorage
.
removeItem
(
'fromCollect'
)
// 延迟触发事件,确保 Home 组件的监听器已注册
setTimeout
(()
=>
{
window
.
dispatchEvent
(
new
CustomEvent
(
'refreshQuestionsFromCollect'
,
{
detail
:
{
toolId
:
''
,
// 制度活化模式,toolId 为空
},
}))
console
.
log
(
'[Chat] refreshQuestionsFromCollect 事件已触发 - 制度活化模式'
)
},
100
)
}
}
// 清除 ref,避免下次路由变化时误用
toolIdFromStateRef
.
current
=
undefined
...
...
@@ -649,6 +664,23 @@ export const Chat: React.FC = () => {
sessionStorage
.
setItem
(
'currentToolId'
,
finalToolId
)
}
}
// 如果从收藏页返回,在确定 toolId 后触发事件通知 HomeNew 刷新问题列表
if
(
fromCollect
)
{
const
eventToolId
=
finalToolId
||
toolId
||
currentToolId
||
safeSessionStorageGetItem
(
'currentToolId'
)
||
''
console
.
log
(
'[Chat] 检测到从收藏页返回 (fromCollect=true) - 准备触发 refreshQuestionsFromCollect 事件'
)
console
.
log
(
'[Chat] refreshQuestionsFromCollect - 传递的 toolId:'
,
eventToolId
)
// 清除 sessionStorage 中的标记,避免影响后续路由
sessionStorage
.
removeItem
(
'fromCollect'
)
// 延迟触发事件,确保 Home 组件的监听器已注册,并且 toolId 已经同步到 sessionStorage
setTimeout
(()
=>
{
window
.
dispatchEvent
(
new
CustomEvent
(
'refreshQuestionsFromCollect'
,
{
detail
:
{
toolId
:
eventToolId
,
},
}))
console
.
log
(
'[Chat] refreshQuestionsFromCollect 事件已触发'
)
},
100
)
}
}
else
{
// 如果 qaRecords 和 conversation 中都没有 toolId
...
...
@@ -663,6 +695,23 @@ export const Chat: React.FC = () => {
sessionStorage
.
setItem
(
'currentToolId'
,
currentToolId
)
}
}
// 如果从收藏页返回,在确定 toolId 后触发事件通知 HomeNew 刷新问题列表(制度活化模式或没有 toolId 的情况)
if
(
fromCollect
)
{
const
eventToolId
=
currentToolId
||
safeSessionStorageGetItem
(
'currentToolId'
)
||
''
console
.
log
(
'[Chat] 检测到从收藏页返回 (fromCollect=true) - 准备触发 refreshQuestionsFromCollect 事件'
)
console
.
log
(
'[Chat] refreshQuestionsFromCollect - 传递的 toolId:'
,
eventToolId
)
// 清除 sessionStorage 中的标记,避免影响后续路由
sessionStorage
.
removeItem
(
'fromCollect'
)
// 延迟触发事件,确保 Home 组件的监听器已注册,并且 toolId 已经同步到 sessionStorage
setTimeout
(()
=>
{
window
.
dispatchEvent
(
new
CustomEvent
(
'refreshQuestionsFromCollect'
,
{
detail
:
{
toolId
:
eventToolId
,
},
}))
console
.
log
(
'[Chat] refreshQuestionsFromCollect 事件已触发'
)
},
100
)
}
}
}
}
...
...
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