Commit 4a148bc8 by Liu

fix:创建会话时修改传参

parent e2690a46
......@@ -125,13 +125,13 @@ export const TacticsChat: React.FC = () => {
const getConversationExtra = useCallback(() => {
if (userMeta?.place === 'user') {
return {
description: '02',
busiType: '02',
busiId: userMeta.userId,
}
}
if (tacticsMeta) {
return {
description: '02',
busiType: '02',
busiId: tacticsMeta.taskId,
}
}
......@@ -418,11 +418,11 @@ export const TacticsChat: React.FC = () => {
}
// from=tactics 场景下补充业务识别参数
if (userMeta?.place === 'user') {
requestBody.description ??= '02'
requestBody.busiType ??= '02'
requestBody.busiId ??= userMeta.userId
}
else if (tacticsMeta) {
requestBody.description ??= '02'
requestBody.busiType ??= '02'
requestBody.busiId ??= tacticsMeta.taskId
}
// 如果 includeQuestion 为 false,不展示问题但接口参数中仍要传递 question
......
......@@ -40,7 +40,7 @@ export const TacticsHome: React.FC = () => {
partOrAll: searchParams.get('partOrAll') || undefined,
channel: searchParams.get('channel') || undefined,
channelName: searchParams.get('channelName') || undefined,
description: '02',
busiType: '02',
busiId: searchParams.get('taskId') || undefined,
}
}, [searchParams])
......@@ -73,7 +73,7 @@ export const TacticsHome: React.FC = () => {
cstId: searchParams.get('cstId') || undefined,
userId: searchParams.get('userId') || undefined,
numberType: searchParams.get('numberType') || undefined,
description: '02',
busiType: '02',
busiId: searchParams.get('userId') || undefined,
}
}, [searchParams])
......@@ -99,13 +99,13 @@ export const TacticsHome: React.FC = () => {
const getConversationExtra = useCallback(() => {
if (userMeta?.place === 'user') {
return {
description: '02',
busiType: '02',
busiId: userMeta.userId,
}
}
if (tacticsMeta) {
return {
description: '02',
busiType: '02',
busiId: tacticsMeta.taskId,
}
}
......@@ -137,6 +137,18 @@ export const TacticsHome: React.FC = () => {
shouldSendQuestion: '',
}),
)
.unwrap()
.then((res) => {
const conversationId = res?.conversation?.id
const from = searchParams.get('from')
const place = searchParams.get('place')
if (conversationId && from === 'tactics') {
const storageKey = place === 'user' ? 'tactics_user_conversation_id' : 'tactics_conversation_id'
window.localStorage.setItem(storageKey, conversationId)
}
// eslint-disable-next-line no-console
console.log('[TacticsHome] created conversationId', conversationId)
})
}
// 清除状态以避免下次影响
if (location.state?.fromCollect) {
......
......@@ -33,7 +33,7 @@ export function withRouteChangeHandler(WrappedComponent: React.ComponentType) {
userId: searchParams.get('userId') || undefined,
numberType: searchParams.get('numberType') || undefined,
place,
description: '02',
busiType: '02',
busiId: searchParams.get('userId') || undefined,
}
sessionStorage.setItem('userMeta', JSON.stringify(userMeta))
......@@ -48,7 +48,7 @@ export function withRouteChangeHandler(WrappedComponent: React.ComponentType) {
channel: searchParams.get('channel') || undefined,
channelName: searchParams.get('channelName') || undefined,
from,
description: '02',
busiType: '02',
busiId: searchParams.get('taskId') || undefined,
}
sessionStorage.setItem('tacticsMeta', JSON.stringify(meta))
......
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