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('换一批失败,请稍后重试')