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
256746af
Commit
256746af
authored
Jan 30, 2026
by
Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:工单每次进入页面调用提问接口逻辑
parent
62be373f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
0 deletions
+52
-0
src/pages/ChatTactics/TacticsChat.tsx
+52
-0
No files found.
src/pages/ChatTactics/TacticsChat.tsx
View file @
256746af
...
...
@@ -906,11 +906,14 @@ export const TacticsChat: React.FC = () => {
const
hasAutoSubmittedRef
=
useRef
(
false
)
// 记录上次调用时的 searchParams,用于 orderMeta 场景检测参数变化
const
lastSearchParamsRef
=
useRef
<
string
>
(
''
)
// 记录 orderMeta 场景下第二次调用是否已执行
const
hasOrderMetaSecondCallRef
=
useRef
(
false
)
useEffect
(()
=>
{
if
(
id
)
{
// 当 id 变化时,重置自动提交标志
hasAutoSubmittedRef
.
current
=
false
lastSearchParamsRef
.
current
=
''
hasOrderMetaSecondCallRef
.
current
=
false
}
},
[
id
])
useEffect
(()
=>
{
...
...
@@ -923,6 +926,7 @@ export const TacticsChat: React.FC = () => {
if
(
isOrderMetaScenario
&&
lastSearchParamsRef
.
current
!==
currentSearchParams
)
{
hasAutoSubmittedRef
.
current
=
false
lastSearchParamsRef
.
current
=
currentSearchParams
hasOrderMetaSecondCallRef
.
current
=
false
}
const
shouldTriggerForOrderMeta
=
isOrderMetaScenario
&&
hasHistoryLoaded
&&
!
isLoading
const
shouldTriggerForNormal
=
!
isOrderMetaScenario
&&
hasHistory
===
false
&&
!
isLoading
...
...
@@ -1012,7 +1016,51 @@ export const TacticsChat: React.FC = () => {
currentId
:
currentIdRef
.
current
,
isLoading
,
lastSentQuestion
:
lastSentQuestionRef
.
current
,
orderMeta
:
!!
orderMeta
,
hasOrderMetaSecondCall
:
hasOrderMetaSecondCallRef
.
current
,
})
// orderMeta 场景下,即使没有 shouldSendQuestion,也触发第二次调用(用于第三方嵌入场景)
// 复用 shouldSendQuestion 存在时的调用逻辑,保证参数传递完全一致
if
(
orderMeta
&&
currentIdRef
.
current
&&
!
isLoading
&&
!
hasOrderMetaSecondCallRef
.
current
&&
!
shouldSendQuestion
)
{
hasOrderMetaSecondCallRef
.
current
=
true
// 从 URL 参数中构建 paramMap(如果存在 workflow 表单字段)
// 排除已知的业务参数,其他参数作为 paramMap 传递
const
paramMap
:
Record
<
string
,
string
>
|
undefined
=
(()
=>
{
const
knownParams
=
[
'from'
,
'place'
,
'workOrderIds'
,
'taskId'
,
'version'
,
'pinBeginTime'
,
'pinEndTime'
,
'partOrAll'
,
'channel'
,
'channelName'
,
'cstId'
,
'userId'
,
'numberType'
]
const
paramMapEntries
:
[
string
,
string
][]
=
[]
searchParams
.
forEach
((
value
,
key
)
=>
{
if
(
!
knownParams
.
includes
(
key
)
&&
value
)
{
paramMapEntries
.
push
([
key
,
value
])
}
})
return
paramMapEntries
.
length
>
0
?
Object
.
fromEntries
(
paramMapEntries
)
:
undefined
})()
setTimeout
(()
=>
{
// 完全复用 shouldSendQuestion 存在时的调用逻辑(第 1063-1074 行),只是 question 为 undefined
// 这样保证参数传递完全一致,包括 paramMap 等参数的处理逻辑
handleSubmitQuestion
(
undefined
,
undefined
,
undefined
,
{
includeQuestion
:
true
,
// 与 shouldSendQuestion 存在时保持一致
includeTacticsMeta
:
false
,
includeOrderMeta
:
true
,
recordType
:
'A11'
,
...(
paramMap
?
{
paramMap
}
:
{}),
},
)
},
100
)
return
}
if
(
shouldSendQuestion
&&
currentIdRef
.
current
...
...
@@ -1021,6 +1069,10 @@ export const TacticsChat: React.FC = () => {
)
{
lastSentQuestionRef
.
current
=
shouldSendQuestion
dispatch
(
clearTacticsShouldSendQuestion
())
// orderMeta 场景下,标记第二次调用已执行
if
(
orderMeta
)
{
hasOrderMetaSecondCallRef
.
current
=
true
}
setTimeout
(()
=>
{
if
(
orderMeta
)
{
handleSubmitQuestion
(
...
...
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