From 2e51ee3a4217bae5e077ec30b80959e8b8cbb3cf Mon Sep 17 00:00:00 2001 From: selfrelease Date: Mon, 31 Aug 2026 17:23:05 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=8D=A2=E4=B8=80=E6=89=B9=E7=AC=AC3?= =?UTF-8?q?=E6=AC=A1=E5=8D=A1=E4=BD=8F=E9=97=AE=E9=A2=98,=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=E6=B1=A0=E7=B4=A2=E5=BC=95=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web2/src/components/common/ChatPanel.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/web2/src/components/common/ChatPanel.tsx b/web2/src/components/common/ChatPanel.tsx index f11b16f..9442859 100644 --- a/web2/src/components/common/ChatPanel.tsx +++ b/web2/src/components/common/ChatPanel.tsx @@ -555,7 +555,7 @@ export function ChatPanel({ const handleRefreshSamples = async () => { // 池里还有未展示的,直接取下一批 const nextIndex = poolIndex + BATCH_SIZE - if (dailyPool.length > 0 && nextIndex < dailyPool.length) { + if (nextIndex < dailyPool.length) { setPoolIndex(nextIndex) setDynamicSamples(dailyPool.slice(nextIndex, nextIndex + BATCH_SIZE)) return @@ -566,10 +566,12 @@ export function ChatPanel({ const phone = getPhone() || undefined const res = await api.generateSamples(scene, topic, dynamicSamples, phone) if (res.samples?.length > 0) { + // AI 生成的新问题加入池并显示 + const newPool = [...dailyPool, ...res.samples] + const newIndex = dailyPool.length + setDailyPool(newPool) + setPoolIndex(newIndex) setDynamicSamples(res.samples) - // AI 生成的新问题加入池,重置索引 - setDailyPool(prev => [...prev, ...res.samples]) - setPoolIndex(dailyPool.length) } } catch { toast.error('换一批失败,请稍后重试')