Commit 2544e2a6 by Liu

fix:推荐问接口及参数

parent 1b9e87fd
......@@ -2,7 +2,7 @@ import { useEffect, useState } from 'react'
import { useSearchParams } from 'react-router-dom'
import { Button, Skeleton } from '@heroui/react'
import type { Answer } from '@/types/chat'
import { fetchOrderQueryRecommendQuestion, fetchQueryRecommendQuestion } from '@/api/chat'
import { fetchOrderQueryRecommendQuestion } from '@/api/chat'
import SendIcon from '@/assets/svg/sendBlack.svg?react'
interface ChatAnswerRecommendProps {
......@@ -20,49 +20,43 @@ export const ChatAnswerRecommend: React.FC<ChatAnswerRecommendProps> = ({ answer
onLoadingChange?.(true)
// 从 sessionStorage 中获取 toolId
const toolId = typeof window !== 'undefined' ? sessionStorage.getItem('currentToolId') : null
// 仅在 from=tactics 场景下,按照要求补充 busiType / recordType 参数
const from = searchParams.get('from')
const place = searchParams.get('place')
const shouldAttachBusiParams = from === 'tactics'
const isOrderTactics = from === 'tactics' && place === 'order'
const isSpecialToolId = toolId === '6712395743241'
let busiType: string | undefined
let recordType: string | undefined
if (isSpecialToolId) {
// 制度活化:toolId 为空或不存在
if (!toolId) {
busiType = '01'
recordType = 'A17'
}
// 特殊工具ID
else if (toolId === '6712395743241') {
busiType = '01'
recordType = 'A15'
}
else if (shouldAttachBusiParams) {
// 策略场景
else if (from === 'tactics') {
busiType = '02'
// from=tactics 且 place=order → recordType=A13 (使用 fetchOrderQueryRecommendQuestion)
if (isOrderTactics) {
recordType = 'A13'
if (place === 'user') {
recordType = 'A20'
}
// from=tactics 且 place=user → recordType=A03
else if (place === 'user') {
recordType = 'A03'
else if (place === 'order') {
recordType = 'A13'
}
// from=tactics 且 place!=user/无 → recordType=A01
else {
recordType = 'A01'
recordType = 'A19'
}
}
try {
const res = (isOrderTactics || isSpecialToolId)
? await fetchOrderQueryRecommendQuestion(
answer.conversationId || '',
answer.recordId || '',
toolId || undefined,
busiType,
recordType,
)
: await fetchQueryRecommendQuestion(
answer.conversationId || '',
answer.recordId || '',
toolId || undefined,
busiType,
recordType,
)
const res = await fetchOrderQueryRecommendQuestion(
answer.conversationId || '',
answer.recordId || '',
toolId || undefined,
busiType,
recordType,
)
if (res.ok) {
setQuestionList(res.data.questionList)
}
......
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