Commit 662bca48 by HoMeTown

fix: 修复recommend重复获取的问题

parent 9bef3d84
...@@ -9,6 +9,7 @@ interface ChatAnswerRecommendProps { ...@@ -9,6 +9,7 @@ interface ChatAnswerRecommendProps {
onSubmitQuestion: (question: string) => void onSubmitQuestion: (question: string) => void
} }
export const ChatAnswerRecommend: React.FC<ChatAnswerRecommendProps> = ({ answer, onSubmitQuestion }) => { export const ChatAnswerRecommend: React.FC<ChatAnswerRecommendProps> = ({ answer, onSubmitQuestion }) => {
let isGet = false
const [questionList, setQuestionList] = useState<string[]>([]) const [questionList, setQuestionList] = useState<string[]>([])
const getAnswerRecommend = async () => { const getAnswerRecommend = async () => {
const res = await fetchQueryRecommendQuestion(answer.conversationId || '', answer.recordId || '') const res = await fetchQueryRecommendQuestion(answer.conversationId || '', answer.recordId || '')
...@@ -18,8 +19,11 @@ export const ChatAnswerRecommend: React.FC<ChatAnswerRecommendProps> = ({ answer ...@@ -18,8 +19,11 @@ export const ChatAnswerRecommend: React.FC<ChatAnswerRecommendProps> = ({ answer
} }
useEffect(() => { useEffect(() => {
getAnswerRecommend() if (!isGet) {
}) isGet = true
getAnswerRecommend()
}
}, [])
return ( return (
<div className="pl-[62px] mt-[12px] flex flex-col"> <div className="pl-[62px] mt-[12px] flex flex-col">
{questionList.length !== 0 && ( {questionList.length !== 0 && (
......
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