Commit c0b9e9f7 by Liu

fix:常见问题提问时逻辑

parent 9379fb86
......@@ -759,8 +759,9 @@ export const Chat: React.FC = () => {
const skipHistoryLoad = Boolean((location.state as { skipHistoryLoad?: boolean } | null)?.skipHistoryLoad)
if (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
// 更新 toolId 相关状态(如果有)
if (initialToolId !== undefined) {
......
......@@ -502,8 +502,15 @@ export const TacticsChat: React.FC = () => {
}
// 如果是 workflow 提交,添加 paramMap、recordId 和 workFlowSessionId
if (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) {
requestBody.recordId = extra.recordId
}
......@@ -754,9 +761,9 @@ export const TacticsChat: React.FC = () => {
// 2. 提取所有 recordId
const recordIdList: string[] = []
qaRecords.forEach((record) => {
qaRecords.forEach((record: any) => {
if (record.answerList && record.answerList.length > 0) {
record.answerList.forEach((answer) => {
record.answerList.forEach((answer: any) => {
if (answer.recordId) {
recordIdList.push(answer.recordId)
}
......@@ -1279,7 +1286,9 @@ export const TacticsChat: React.FC = () => {
{record.role === 'user' && <ChatItemUser record={record} />}
{record.role === 'ai' && (
<ChatAnswerBox
onSubmitQuestion={handleAnswerBoxSubmit}
onSubmitQuestion={(question, productCode, _toolId, _extraParams, workFlowSessionId, recordId) => {
void handleAnswerBoxSubmit(question, productCode, workFlowSessionId, recordId)
}}
isLastAnswer={index === allItems.length - 1}
showIndex={0}
record={record}
......
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