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
62be373f
Commit
62be373f
authored
Jan 29, 2026
by
Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复推荐问题点击时参数传递错误,添加提质增效模式自动提问功能
parent
eace2005
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
13 deletions
+33
-13
src/layouts/Navbar/Navbar.tsx
+13
-0
src/pages/Chat/Chat.tsx
+4
-1
src/pages/Chat/components/ChatItem/ChatAnswerBox.tsx
+16
-12
No files found.
src/layouts/Navbar/Navbar.tsx
View file @
62be373f
...
...
@@ -135,6 +135,19 @@ const NavbarBase: React.FC<NavbarProps & WithAuthProps> = ({ isHistoryVisible, c
},
})
dispatch
(
clearNavigationFlag
())
// 提质增效模式下,创建会话后自动调用提问接口(与 fetchSessionConversationId 后的逻辑保持一致)
if
(
currentToolId
===
'6712395743241'
)
{
window
.
dispatchEvent
(
new
CustomEvent
(
'autoSubmitQuestion'
,
{
detail
:
{
conversationId
:
currentConversationId
,
question
:
''
,
toolId
:
currentToolId
,
recordType
:
'B03'
,
busiType
:
'01'
,
},
}))
}
}
},
[
shouldNavigateToNewConversation
,
currentConversationId
,
currentToolId
,
shouldSendQuestion
,
navigate
,
dispatch
])
...
...
src/pages/Chat/Chat.tsx
View file @
62be373f
...
...
@@ -999,12 +999,15 @@ export const Chat: React.FC = () => {
// 如果历史记录中 firstQaFlag 为 true,隐藏 UI 但保留组件渲染(确保自动提交逻辑能执行)
const
shouldHideHistoryItem
=
record
.
role
===
'ai'
&&
record
.
answerList
?.[
0
]?.
firstQaFlag
===
true
// 如果是自动调用提问接口(空问题且是流式返回的新记录),不显示问题和回答
// 判断条件:question === undefined(空问题)且 isShow === false(流式返回的新记录,不是历史记录)
const
shouldHideEmptyQuestionAnswer
=
record
.
role
===
'ai'
&&
record
.
question
===
undefined
&&
record
.
answerList
?.[
0
]?.
isShow
===
false
return
(
<
div
className=
"w-full chatItem mx-auto"
key=
{
uniqueKey
}
style=
{
shouldHideHistoryItem
?
{
visibility
:
'hidden'
,
height
:
0
,
overflow
:
'hidden'
,
margin
:
0
,
padding
:
0
}
:
undefined
}
style=
{
(
shouldHideHistoryItem
||
shouldHideEmptyQuestionAnswer
)
?
{
visibility
:
'hidden'
,
height
:
0
,
overflow
:
'hidden'
,
margin
:
0
,
padding
:
0
}
:
undefined
}
>
{
record
.
role
===
'system'
&&
<
ChatWelcome
toolName=
{
currentToolName
}
/>
}
{
record
.
role
===
'user'
&&
<
ChatItemUser
record=
{
record
}
/>
}
...
...
src/pages/Chat/components/ChatItem/ChatAnswerBox.tsx
View file @
62be373f
...
...
@@ -17,14 +17,17 @@ interface ChatAnswerBoxProps {
showIndex
:
number
isLastAnswer
:
boolean
index
:
number
onSubmitQuestion
:
(
question
:
string
,
productCode
?:
string
,
workFlowSessionId
?:
string
,
recordId
?:
string
)
=>
void
onSubmitQuestion
:
(
question
:
string
,
productCode
?:
string
,
toolId
?:
string
,
extraParams
?:
{
paramMap
?:
Record
<
string
,
string
>
,
recordId
?:
string
,
recordType
?:
string
,
workFlowSessionId
?:
string
,
isReask
?:
boolean
,
busiType
?:
string
},
workFlowSessionId
?:
string
,
recordId
?:
string
)
=>
void
onRecommendLoadingChange
?:
(
loading
:
boolean
)
=>
void
onWorkflowSubmit
?:
(
paramMap
:
Record
<
string
,
string
>
,
recordId
?:
string
)
=>
void
isWorkflowSubmitting
?:
boolean
allItems
?:
ChatRecord
[]
// 传入整个会话历史,用于查找最后一个 workFlowSessionId
}
export
const
ChatAnswerBox
:
React
.
FC
<
ChatAnswerBoxProps
>
=
({
record
,
showIndex
,
isLastAnswer
,
onSubmitQuestion
,
onRecommendLoadingChange
,
onWorkflowSubmit
,
isWorkflowSubmitting
,
allItems
=
[]
})
=>
{
const
EMPTY_ARRAY
:
ChatRecord
[]
=
[]
export
const
ChatAnswerBox
:
React
.
FC
<
ChatAnswerBoxProps
>
=
({
record
,
showIndex
,
isLastAnswer
,
onSubmitQuestion
,
onRecommendLoadingChange
,
onWorkflowSubmit
,
isWorkflowSubmitting
,
allItems
})
=>
{
const
items
=
allItems
||
EMPTY_ARRAY
const
[
isShowRecommend
,
setIsShowRecommend
]
=
useState
(
false
)
const
[
recommendUseAnswer
,
setRecommendUseAnswer
]
=
useState
<
Answer
>
()
const
[
innerRecord
,
setInnerRecord
]
=
useState
<
ChatRecord
>
(
record
)
...
...
@@ -59,32 +62,33 @@ export const ChatAnswerBox: React.FC<ChatAnswerBoxProps> = ({ record, showIndex,
{
innerRecord
.
answerList
.
map
((
item
,
index
)
=>
{
// 当前默认始终展示点赞 / 点踩 / 复制等操作区(是否展示由下层基于卡片类型自行决定)
const
shouldHideOperate
=
false
// 不再隐藏流式返回的 chatItem,只隐藏历史记录(在 Chat.tsx 和 TacticsChat.tsx 中处理)
// 创建包装函数,从会话历史中找到最后一个有 workFlowSessionId 的答案,并在追问时传递
const
handleSubmitQuestionWithWorkflow
=
(
question
:
string
,
productCode
?:
string
)
=>
{
// 从会话历史中找到最后一个有 workFlowSessionId 的答案(从后往前查找)
let
lastWorkFlowSessionId
:
string
|
undefined
let
lastRecordId
:
string
|
undefined
for
(
let
i
=
allI
tems
.
length
-
1
;
i
>=
0
;
i
--
)
{
const
historyItem
=
allI
tems
[
i
]
for
(
let
i
=
i
tems
.
length
-
1
;
i
>=
0
;
i
--
)
{
const
historyItem
=
i
tems
[
i
]
if
(
historyItem
.
role
===
'ai'
&&
historyItem
.
answerList
?.[
0
]?.
workFlowSessionId
)
{
lastWorkFlowSessionId
=
historyItem
.
answerList
[
0
].
workFlowSessionId
lastRecordId
=
historyItem
.
answerList
[
0
].
recordId
break
}
}
// 调用父组件传递的 onSubmitQuestion,传递 workFlowSessionId 和 recordId
onSubmitQuestion
(
question
,
productCode
,
lastWorkFlowSessionId
,
lastRecordId
)
// 跳过 toolId 和 extraParams 参数,正确传递 workFlowSessionId 和 recordId
onSubmitQuestion
(
question
,
productCode
,
undefined
,
undefined
,
lastWorkFlowSessionId
,
lastRecordId
)
}
return
(
index
===
showIndex
&&
(
<
div
className=
"chatItemBotContainer w-full"
key=
{
`${item.recordId}-
${index}`
}
<
div
className=
"chatItemBotContainer w-full"
key=
{
item
.
recordId
||
`
${index}`
}
>
<
div
className=
"flex"
>
<
Avatar
...
...
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