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
c0b9e9f7
Commit
c0b9e9f7
authored
Feb 02, 2026
by
Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:常见问题提问时逻辑
parent
9379fb86
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
6 deletions
+16
-6
src/pages/Chat/Chat.tsx
+3
-2
src/pages/ChatTactics/TacticsChat.tsx
+13
-4
No files found.
src/pages/Chat/Chat.tsx
View file @
c0b9e9f7
...
@@ -759,8 +759,9 @@ export const Chat: React.FC = () => {
...
@@ -759,8 +759,9 @@ export const Chat: React.FC = () => {
const
skipHistoryLoad
=
Boolean
((
location
.
state
as
{
skipHistoryLoad
?:
boolean
}
|
null
)?.
skipHistoryLoad
)
const
skipHistoryLoad
=
Boolean
((
location
.
state
as
{
skipHistoryLoad
?:
boolean
}
|
null
)?.
skipHistoryLoad
)
if
(
skipHistoryLoad
)
{
if
(
skipHistoryLoad
)
{
console
.
log
(
'[Chat] 检测到 skipHistoryLoad 标记,跳过历史记录加载,直接发送问题'
)
console
.
log
(
'[Chat] 检测到 skipHistoryLoad 标记,跳过历史记录加载,直接发送问题'
)
// 清空历史记录,只保留 system 记录(欢迎语)
// 不清空已有对话:常见问题点击应在当前对话基础上继续追加
setAllItems
([{
role
:
'system'
}
as
ChatRecord
])
// 仅当当前为空时,确保存在 system 记录(欢迎语占位)
setAllItems
(
prev
=>
(
prev
.
length
>
0
?
prev
:
([{
role
:
'system'
}
as
ChatRecord
])))
currentIdRef
.
current
=
id
currentIdRef
.
current
=
id
// 更新 toolId 相关状态(如果有)
// 更新 toolId 相关状态(如果有)
if
(
initialToolId
!==
undefined
)
{
if
(
initialToolId
!==
undefined
)
{
...
...
src/pages/ChatTactics/TacticsChat.tsx
View file @
c0b9e9f7
...
@@ -502,7 +502,14 @@ export const TacticsChat: React.FC = () => {
...
@@ -502,7 +502,14 @@ export const TacticsChat: React.FC = () => {
}
}
// 如果是 workflow 提交,添加 paramMap、recordId 和 workFlowSessionId
// 如果是 workflow 提交,添加 paramMap、recordId 和 workFlowSessionId
if
(
extra
?.
paramMap
)
{
if
(
extra
?.
paramMap
)
{
requestBody
.
paramMap
=
extra
.
paramMap
// 需求:from=tactics&place=order 场景下,paramMap 仅取路由内的 workOrderIds
// 为避免旧逻辑/其他链路把 loginCode 等字段塞进 paramMap,这里在 orderMeta 生效时强制覆盖。
if
(
orderMeta
&&
shouldIncludeOrderMeta
&&
typeof
orderMeta
.
workOrderIds
===
'string'
)
{
requestBody
.
paramMap
=
{
workOrderIds
:
orderMeta
.
workOrderIds
}
}
else
{
requestBody
.
paramMap
=
extra
.
paramMap
}
}
}
if
(
extra
?.
recordId
)
{
if
(
extra
?.
recordId
)
{
requestBody
.
recordId
=
extra
.
recordId
requestBody
.
recordId
=
extra
.
recordId
...
@@ -754,9 +761,9 @@ export const TacticsChat: React.FC = () => {
...
@@ -754,9 +761,9 @@ export const TacticsChat: React.FC = () => {
// 2. 提取所有 recordId
// 2. 提取所有 recordId
const
recordIdList
:
string
[]
=
[]
const
recordIdList
:
string
[]
=
[]
qaRecords
.
forEach
((
record
)
=>
{
qaRecords
.
forEach
((
record
:
any
)
=>
{
if
(
record
.
answerList
&&
record
.
answerList
.
length
>
0
)
{
if
(
record
.
answerList
&&
record
.
answerList
.
length
>
0
)
{
record
.
answerList
.
forEach
((
answer
)
=>
{
record
.
answerList
.
forEach
((
answer
:
any
)
=>
{
if
(
answer
.
recordId
)
{
if
(
answer
.
recordId
)
{
recordIdList
.
push
(
answer
.
recordId
)
recordIdList
.
push
(
answer
.
recordId
)
}
}
...
@@ -1279,7 +1286,9 @@ export const TacticsChat: React.FC = () => {
...
@@ -1279,7 +1286,9 @@ export const TacticsChat: React.FC = () => {
{
record
.
role
===
'user'
&&
<
ChatItemUser
record=
{
record
}
/>
}
{
record
.
role
===
'user'
&&
<
ChatItemUser
record=
{
record
}
/>
}
{
record
.
role
===
'ai'
&&
(
{
record
.
role
===
'ai'
&&
(
<
ChatAnswerBox
<
ChatAnswerBox
onSubmitQuestion=
{
handleAnswerBoxSubmit
}
onSubmitQuestion=
{
(
question
,
productCode
,
_toolId
,
_extraParams
,
workFlowSessionId
,
recordId
)
=>
{
void
handleAnswerBoxSubmit
(
question
,
productCode
,
workFlowSessionId
,
recordId
)
}
}
isLastAnswer=
{
index
===
allItems
.
length
-
1
}
isLastAnswer=
{
index
===
allItems
.
length
-
1
}
showIndex=
{
0
}
showIndex=
{
0
}
record=
{
record
}
record=
{
record
}
...
...
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