Commit 5b51f76d by Liu

fix:历史记录进入会话时提问接口参数

parent 3924711e
...@@ -262,6 +262,12 @@ export const Chat: React.FC = () => { ...@@ -262,6 +262,12 @@ export const Chat: React.FC = () => {
requestBody.busiType = '01' requestBody.busiType = '01'
requestBody.recordType = '01' requestBody.recordType = '01'
} }
// 兜底逻辑:如果 toolId 不在预期范围内,默认使用制度活化的参数
else {
requestBody.toolId = resolvedToolId
requestBody.busiType = '01'
requestBody.recordType = '01'
}
fetchStreamResponse( fetchStreamResponse(
fetchUrl, fetchUrl,
...@@ -406,22 +412,17 @@ export const Chat: React.FC = () => { ...@@ -406,22 +412,17 @@ export const Chat: React.FC = () => {
// 只有当 Redux 中的 toolId 与最终确定的 toolId 不一致时,才更新 // 只有当 Redux 中的 toolId 与最终确定的 toolId 不一致时,才更新
if (currentToolId !== toolIdFromState) { if (currentToolId !== toolIdFromState) {
dispatch(setCurrentToolId(toolIdFromState)) dispatch(setCurrentToolId(toolIdFromState))
// 从收藏返回时,同步到 sessionStorage,避免 ChatEditor 清除 toolId
if (fromCollect) {
sessionStorage.setItem('currentToolId', toolIdFromState)
}
}
else {
if (fromCollect && !sessionStorage.getItem('currentToolId')) {
sessionStorage.setItem('currentToolId', toolIdFromState)
}
} }
// 无条件同步到 sessionStorage,确保 ChatEditor 和 handleSubmitQuestion 能获取到正确的 toolId
sessionStorage.setItem('currentToolId', toolIdFromState)
} }
else { else {
// 如果从 location.state 传递的是 null,清除 toolId // 如果从 location.state 传递的是 null,清除 toolId
if (currentToolId) { if (currentToolId) {
dispatch(clearCurrentToolId()) dispatch(clearCurrentToolId())
} }
// 清除 sessionStorage,确保制度活化模式正确
sessionStorage.removeItem('currentToolId')
} }
// 清除 ref,避免下次路由变化时误用 // 清除 ref,避免下次路由变化时误用
toolIdFromStateRef.current = undefined toolIdFromStateRef.current = undefined
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment