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
9f3fb994
Commit
9f3fb994
authored
Feb 02, 2026
by
Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:提质增效下新建会话情况历史记录
parent
14c4bc50
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
5 deletions
+26
-5
src/layouts/Navbar/Navbar.tsx
+26
-5
No files found.
src/layouts/Navbar/Navbar.tsx
View file @
9f3fb994
...
@@ -12,7 +12,8 @@ import { withAuth } from '@/auth/withAuth'
...
@@ -12,7 +12,8 @@ import { withAuth } from '@/auth/withAuth'
import
{
NAV_BAR_ITEMS
}
from
'@/config/nav'
import
{
NAV_BAR_ITEMS
}
from
'@/config/nav'
import
{
useAppDispatch
,
useAppSelector
}
from
'@/store/hook'
import
{
useAppDispatch
,
useAppSelector
}
from
'@/store/hook'
import
{
isMobile
}
from
'@/utils'
import
{
isMobile
}
from
'@/utils'
import
{
safeLocalStorageSetItem
}
from
'@/lib/utils'
import
{
safeLocalStorageSetItem
,
waitForToken
}
from
'@/lib/utils'
import
{
fetchUserQaRecordPage
}
from
'@/api/conversation'
// import { User } from './components/User'
// import { User } from './components/User'
interface
NavbarProps
{
interface
NavbarProps
{
...
@@ -137,10 +138,30 @@ const NavbarBase: React.FC<NavbarProps & WithAuthProps> = ({ isHistoryVisible, c
...
@@ -137,10 +138,30 @@ const NavbarBase: React.FC<NavbarProps & WithAuthProps> = ({ isHistoryVisible, c
})
})
dispatch
(
clearNavigationFlag
())
dispatch
(
clearNavigationFlag
())
// 提质增效模式下,创建会话后自动调用提问接口(与 fetchSessionConversationId 后的逻辑保持一致)
// 提质增效模式下,创建会话后:
// 使用 requestAnimationFrame 确保在下一个渲染周期执行,此时 Chat 组件已经挂载并且 currentIdRef.current 已经更新
// 1. 使用新会话ID + toolId 主动拉取一次历史记录(与数据助手保持一致)
if
(
isQualityImprovement
)
{
// 2. 再自动触发一次空问题提问(欢迎语)
// 使用双重 requestAnimationFrame 确保在 DOM 更新后执行
if
(
isQualityImprovement
&&
currentToolId
)
{
// 1) 拉取历史记录并通过自定义事件交给 Chat 渲染
;(
async
()
=>
{
try
{
await
waitForToken
()
const
qaRes
=
await
fetchUserQaRecordPage
(
currentConversationId
,
currentToolId
)
window
.
dispatchEvent
(
new
CustomEvent
(
'toolHistoryLoaded'
,
{
detail
:
{
conversationId
:
currentConversationId
,
toolId
:
currentToolId
,
// 这里不传 toolName,由 Chat 自己根据 currentToolId 解析名称
qaRecords
:
qaRes
?.
data
||
[],
},
}))
}
catch
(
error
)
{
console
.
error
(
'[Navbar] 提质增效模式 - 创建会话后拉取历史记录失败:'
,
error
)
}
})()
// 2) 使用 requestAnimationFrame 确保在下一个渲染周期执行自动提问
requestAnimationFrame
(()
=>
{
requestAnimationFrame
(()
=>
{
requestAnimationFrame
(()
=>
{
requestAnimationFrame
(()
=>
{
window
.
dispatchEvent
(
new
CustomEvent
(
'autoSubmitQuestion'
,
{
window
.
dispatchEvent
(
new
CustomEvent
(
'autoSubmitQuestion'
,
{
...
...
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