From 28795000abafd760518833b3b318fcb7d35ea2bb Mon Sep 17 00:00:00 2001 From: keting lu Date: Thu, 17 Apr 2025 14:46:22 +0800 Subject: [PATCH] =?UTF-8?q?chore=EF=BC=9Aconversation=20svg?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../runOnce/text-generation/result/ai.svg | 3 +++ .../runOnce/text-generation/result/human.svg | 3 +++ .../runOnce/text-generation/result/index.tsx | 25 ++++++++++--------- 3 files changed, 19 insertions(+), 12 deletions(-) create mode 100644 web/app/components/runOnce/text-generation/result/ai.svg create mode 100644 web/app/components/runOnce/text-generation/result/human.svg diff --git a/web/app/components/runOnce/text-generation/result/ai.svg b/web/app/components/runOnce/text-generation/result/ai.svg new file mode 100644 index 0000000000..f9f022e000 --- /dev/null +++ b/web/app/components/runOnce/text-generation/result/ai.svg @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/web/app/components/runOnce/text-generation/result/human.svg b/web/app/components/runOnce/text-generation/result/human.svg new file mode 100644 index 0000000000..306804047d --- /dev/null +++ b/web/app/components/runOnce/text-generation/result/human.svg @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/web/app/components/runOnce/text-generation/result/index.tsx b/web/app/components/runOnce/text-generation/result/index.tsx index 74a29551a1..74c1ecf7c3 100644 --- a/web/app/components/runOnce/text-generation/result/index.tsx +++ b/web/app/components/runOnce/text-generation/result/index.tsx @@ -361,17 +361,15 @@ const Result: FC = ({ const handleScroll = throttle(() => { const distanceToBottom = el.scrollHeight - el.scrollTop - el.clientHeight - console.log('1', el.scrollHeight, el.scrollTop, el.clientHeight) - console.log('renderRef', renderRef.current?.scrollHeight, renderRef.current?.scrollTop, renderRef.current?.clientHeight) - const atBottom = distanceToBottom <= 200 // 缓冲 20px 容错 + const atBottom = distanceToBottom <= 200 setIsAtBottom(atBottom) - }, 1000) + }, 200) const delay = setTimeout(() => { isInitialMount.current = false el.addEventListener('scroll', handleScroll) - }, 300) // 避免内容撑开误判 + }, 300) return () => { clearTimeout(delay) @@ -383,9 +381,9 @@ const Result: FC = ({ if (!el || !isAtBottom) return let attempts = 0 - const maxAttempts = 30 // 最多尝试 30 次,避免死循环 - const delayMs = 16 // 每帧尝试(≈ 60fps) - const threshold = 10 // 容忍范围内算到底了 + const maxAttempts = 30 + const delayMs = 16 + const threshold = 10 const tryScroll = () => { if (!el) return @@ -399,7 +397,6 @@ const Result: FC = ({ requestAnimationFrame(tryScroll) } else { - // 最后再确保锚点视图内 bottomRef.current?.scrollIntoView({ behavior: 'smooth' }) } } @@ -428,13 +425,17 @@ const Result: FC = ({ /> )} - + +
+
+
{t('run.aiAnalysis')} -
+
+