Commit 9bb6ef57 by Liu

feat:推荐问题新增recordType&busiType字段

parent 66a4eb6f
......@@ -164,13 +164,23 @@ export function fetchGetFeedbackConfig() {
* @param conversationId
* @param recordId
* @param toolId 可选的工具ID
* @param busiType 可选的业务类型
* @param recordType 可选的记录类型
* @returns Promise<any>
*/
export function fetchQueryRecommendQuestion(conversationId: string, recordId: string, toolId?: string) {
export function fetchQueryRecommendQuestion(
conversationId: string,
recordId: string,
toolId?: string,
busiType?: string,
recordType?: string,
) {
return http.post('/conversation/api/conversation/mobile/v1/query_recommend_question', {
conversationId,
recordId,
...(toolId ? { toolId } : {}),
...(busiType ? { busiType } : {}),
...(recordType ? { recordType } : {}),
})
}
......
import { useEffect, useState } from 'react'
import { useSearchParams } from 'react-router-dom'
import { Button, Skeleton } from '@heroui/react'
import type { Answer } from '@/types/chat'
import { fetchQueryRecommendQuestion } from '@/api/chat'
......@@ -13,16 +14,30 @@ export const ChatAnswerRecommend: React.FC<ChatAnswerRecommendProps> = ({ answer
let isGet = false
const [questionList, setQuestionList] = useState<string[]>([])
const [loading, setLoading] = useState<boolean>(false)
const [searchParams] = useSearchParams()
const getAnswerRecommend = async () => {
setLoading(true)
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 busiType = shouldAttachBusiParams ? '02' : undefined
let recordType: string | undefined
if (shouldAttachBusiParams) {
// from=tactics 且 place=user → recordType=A03
// from=tactics 且 place!=user/无 → recordType=A01
recordType = place === 'user' ? 'A03' : 'A01'
}
try {
const res = await fetchQueryRecommendQuestion(
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