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
8537a077
Commit
8537a077
authored
Dec 18, 2025
by
Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:分割线展示
parent
be60ab98
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
14 deletions
+17
-14
src/pages/ChatTactics/TacticsChat.tsx
+17
-14
No files found.
src/pages/ChatTactics/TacticsChat.tsx
View file @
8537a077
...
@@ -393,21 +393,24 @@ export const TacticsChat: React.FC = () => {
...
@@ -393,21 +393,24 @@ export const TacticsChat: React.FC = () => {
const
shouldIncludeQuestion
=
extra
?.
includeQuestion
!==
false
&&
!!
question
const
shouldIncludeQuestion
=
extra
?.
includeQuestion
!==
false
&&
!!
question
const
isReanalyze
=
extra
?.
isReanalyze
===
true
const
isReanalyze
=
extra
?.
isReanalyze
===
true
// 重新分析时,在添加新记录之前计算分割线位置
// 重新分析时,在添加新记录之前计算分割线位置
// 分割线应该显示在
历史
记录之后、新记录之前
// 分割线应该显示在
已有对话
记录之后、新记录之前
// 渲染时使用 divider.index === index + 1 来匹配,所以分割线的 index 应该是新记录的位置
// 渲染时使用 divider.index === index + 1 来匹配,所以分割线的 index 应该是新记录的位置
// 只有当存在历史记录时,才显示分割线
// 判断 allItems 中是否存在除了 system 之外的记录(user 或 ai)
if
(
isReanalyze
&&
hasHistory
===
true
)
{
if
(
isReanalyze
)
{
// 基于当前 allItems 长度计算分割线位置
const
hasExistingRecords
=
allItems
.
some
(
item
=>
item
.
role
!==
'system'
)
// 分割线会在新添加的第一个记录之前显示(即 prevItems.length + 1)
if
(
hasExistingRecords
)
{
const
nextDividerIndex
=
allItems
.
length
+
1
// 基于当前 allItems 长度计算分割线位置
const
currentTime
=
formatCurrentTime
()
// 分割线会在新添加的第一个记录之前显示(即 prevItems.length + 1)
setHistoryDividers
((
prev
)
=>
{
const
nextDividerIndex
=
allItems
.
length
+
1
// 避免重复添加相同位置的分割线
const
currentTime
=
formatCurrentTime
()
if
(
prev
.
some
(
divider
=>
divider
.
index
===
nextDividerIndex
))
{
setHistoryDividers
((
prev
)
=>
{
return
prev
// 避免重复添加相同位置的分割线
}
if
(
prev
.
some
(
divider
=>
divider
.
index
===
nextDividerIndex
))
{
return
[...
prev
,
{
index
:
nextDividerIndex
,
time
:
currentTime
}]
return
prev
})
}
return
[...
prev
,
{
index
:
nextDividerIndex
,
time
:
currentTime
}]
})
}
}
}
setAllItems
(
prevItems
=>
[
setAllItems
(
prevItems
=>
[
...
prevItems
,
...
prevItems
,
...
...
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