Commit 4a148bc8 by Liu

fix:创建会话时修改传参

parent e2690a46
...@@ -125,13 +125,13 @@ export const TacticsChat: React.FC = () => { ...@@ -125,13 +125,13 @@ export const TacticsChat: React.FC = () => {
const getConversationExtra = useCallback(() => { const getConversationExtra = useCallback(() => {
if (userMeta?.place === 'user') { if (userMeta?.place === 'user') {
return { return {
description: '02', busiType: '02',
busiId: userMeta.userId, busiId: userMeta.userId,
} }
} }
if (tacticsMeta) { if (tacticsMeta) {
return { return {
description: '02', busiType: '02',
busiId: tacticsMeta.taskId, busiId: tacticsMeta.taskId,
} }
} }
...@@ -418,11 +418,11 @@ export const TacticsChat: React.FC = () => { ...@@ -418,11 +418,11 @@ export const TacticsChat: React.FC = () => {
} }
// from=tactics 场景下补充业务识别参数 // from=tactics 场景下补充业务识别参数
if (userMeta?.place === 'user') { if (userMeta?.place === 'user') {
requestBody.description ??= '02' requestBody.busiType ??= '02'
requestBody.busiId ??= userMeta.userId requestBody.busiId ??= userMeta.userId
} }
else if (tacticsMeta) { else if (tacticsMeta) {
requestBody.description ??= '02' requestBody.busiType ??= '02'
requestBody.busiId ??= tacticsMeta.taskId requestBody.busiId ??= tacticsMeta.taskId
} }
// 如果 includeQuestion 为 false,不展示问题但接口参数中仍要传递 question // 如果 includeQuestion 为 false,不展示问题但接口参数中仍要传递 question
......
...@@ -40,7 +40,7 @@ export const TacticsHome: React.FC = () => { ...@@ -40,7 +40,7 @@ export const TacticsHome: React.FC = () => {
partOrAll: searchParams.get('partOrAll') || undefined, partOrAll: searchParams.get('partOrAll') || undefined,
channel: searchParams.get('channel') || undefined, channel: searchParams.get('channel') || undefined,
channelName: searchParams.get('channelName') || undefined, channelName: searchParams.get('channelName') || undefined,
description: '02', busiType: '02',
busiId: searchParams.get('taskId') || undefined, busiId: searchParams.get('taskId') || undefined,
} }
}, [searchParams]) }, [searchParams])
...@@ -73,7 +73,7 @@ export const TacticsHome: React.FC = () => { ...@@ -73,7 +73,7 @@ export const TacticsHome: React.FC = () => {
cstId: searchParams.get('cstId') || undefined, cstId: searchParams.get('cstId') || undefined,
userId: searchParams.get('userId') || undefined, userId: searchParams.get('userId') || undefined,
numberType: searchParams.get('numberType') || undefined, numberType: searchParams.get('numberType') || undefined,
description: '02', busiType: '02',
busiId: searchParams.get('userId') || undefined, busiId: searchParams.get('userId') || undefined,
} }
}, [searchParams]) }, [searchParams])
...@@ -99,13 +99,13 @@ export const TacticsHome: React.FC = () => { ...@@ -99,13 +99,13 @@ export const TacticsHome: React.FC = () => {
const getConversationExtra = useCallback(() => { const getConversationExtra = useCallback(() => {
if (userMeta?.place === 'user') { if (userMeta?.place === 'user') {
return { return {
description: '02', busiType: '02',
busiId: userMeta.userId, busiId: userMeta.userId,
} }
} }
if (tacticsMeta) { if (tacticsMeta) {
return { return {
description: '02', busiType: '02',
busiId: tacticsMeta.taskId, busiId: tacticsMeta.taskId,
} }
} }
...@@ -137,6 +137,18 @@ export const TacticsHome: React.FC = () => { ...@@ -137,6 +137,18 @@ export const TacticsHome: React.FC = () => {
shouldSendQuestion: '', 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) { if (location.state?.fromCollect) {
......
...@@ -33,7 +33,7 @@ export function withRouteChangeHandler(WrappedComponent: React.ComponentType) { ...@@ -33,7 +33,7 @@ export function withRouteChangeHandler(WrappedComponent: React.ComponentType) {
userId: searchParams.get('userId') || undefined, userId: searchParams.get('userId') || undefined,
numberType: searchParams.get('numberType') || undefined, numberType: searchParams.get('numberType') || undefined,
place, place,
description: '02', busiType: '02',
busiId: searchParams.get('userId') || undefined, busiId: searchParams.get('userId') || undefined,
} }
sessionStorage.setItem('userMeta', JSON.stringify(userMeta)) sessionStorage.setItem('userMeta', JSON.stringify(userMeta))
...@@ -48,7 +48,7 @@ export function withRouteChangeHandler(WrappedComponent: React.ComponentType) { ...@@ -48,7 +48,7 @@ export function withRouteChangeHandler(WrappedComponent: React.ComponentType) {
channel: searchParams.get('channel') || undefined, channel: searchParams.get('channel') || undefined,
channelName: searchParams.get('channelName') || undefined, channelName: searchParams.get('channelName') || undefined,
from, from,
description: '02', busiType: '02',
busiId: searchParams.get('taskId') || undefined, busiId: searchParams.get('taskId') || undefined,
} }
sessionStorage.setItem('tacticsMeta', JSON.stringify(meta)) 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