From b7f20019142c374059837713946993cfa8e68331 Mon Sep 17 00:00:00 2001 From: MT-Mint <798521692@qq.com> Date: Thu, 7 May 2026 10:17:34 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E9=9C=80=E6=B1=82?= =?UTF-8?q?=E9=81=97=E7=95=99=E9=97=AE=E9=A2=98=EF=BC=9AhasSubmitted?= =?UTF-8?q?=E5=8F=98=E9=87=8F=E3=80=82=E7=8E=B0=E5=9C=A8=E4=B8=8D=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E9=80=9A=E8=BF=87=E7=AC=AC=E4=B8=80=E6=AC=A1=E5=8F=91?= =?UTF-8?q?=E5=87=BA=E5=AF=B9=E8=AF=9D=E6=9D=A5=E5=88=87=E6=8D=A2=E6=AC=A2?= =?UTF-8?q?=E8=BF=8E=E9=A1=B5=E5=92=8C=E5=AF=B9=E8=AF=9D=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../[agent_name]/chats/[thread_id]/page.tsx | 1 - .../app/workspace/chats/[thread_id]/page.tsx | 39 +++---------------- .../src/components/workspace/input-box.tsx | 17 +++----- 3 files changed, 12 insertions(+), 45 deletions(-) diff --git a/frontend/src/app/workspace/agents/[agent_name]/chats/[thread_id]/page.tsx b/frontend/src/app/workspace/agents/[agent_name]/chats/[thread_id]/page.tsx index 9b9cb59f..b7ed7305 100644 --- a/frontend/src/app/workspace/agents/[agent_name]/chats/[thread_id]/page.tsx +++ b/frontend/src/app/workspace/agents/[agent_name]/chats/[thread_id]/page.tsx @@ -166,7 +166,6 @@ export default function AgentChatPage() { threadId={threadId} autoFocus={isNewThread} showWelcomeStyle={isNewThread} - hasSubmitted={!isNewThread} status={ thread.error ? "error" diff --git a/frontend/src/app/workspace/chats/[thread_id]/page.tsx b/frontend/src/app/workspace/chats/[thread_id]/page.tsx index ad95d9f2..82d7f2cb 100644 --- a/frontend/src/app/workspace/chats/[thread_id]/page.tsx +++ b/frontend/src/app/workspace/chats/[thread_id]/page.tsx @@ -233,7 +233,6 @@ export default function ChatPage() { [thread.values.artifacts], ); - const [hasSubmitted, setHasSubmitted] = useState(false); const [historyCutoff, setHistoryCutoff] = useState(null); useEffect(() => { @@ -241,7 +240,6 @@ export default function ChatPage() { setHistoryCutoff(null); return; } - if (hasSubmitted) return; // Welcome 态下、未提交前,把当前已有消息都当作“历史”切掉。 // 这样即使历史消息是后续异步补齐,也不会重新露出。 setHistoryCutoff((prev) => { @@ -250,7 +248,6 @@ export default function ChatPage() { return next > prev ? next : prev; }); }, [ - hasSubmitted, historyCutoff, shouldRenderHistory, thread.isThreadLoading, @@ -322,7 +319,6 @@ export default function ChatPage() { if (isNewThread && safeThreadId && !isThreadInitReady) { return; } - setHasSubmitted(true); if (safeThreadId && (isNewThread || showWelcomeStyle)) { router.replace(`/workspace/chats/${safeThreadId}?is_chatting=true`); } @@ -343,22 +339,6 @@ export default function ChatPage() { await thread.stop(); }, [thread]); - const resetNewSessionState = useCallback(() => { - setIsNewThread(true); - setHasSubmitted(false); - setHistoryCutoff(null); - setArtifacts([]); - deselectArtifact(); - setArtifactsOpen(false); - setArtifactsFullscreen(false); - }, [ - deselectArtifact, - setArtifacts, - setArtifactsFullscreen, - setArtifactsOpen, - setIsNewThread, - ]); - return (
@@ -466,16 +446,14 @@ export default function ChatPage() {
@@ -570,9 +548,7 @@ export default function ChatPage() {
{!(showWelcomeStyle && thread.isThreadLoading) ? ( @@ -581,7 +557,6 @@ export default function ChatPage() { className={cn("w-full rounded-[20px] bg-ws-surface-elevated")} threadId={threadId} showWelcomeStyle={showWelcomeStyle} - hasSubmitted={hasSubmitted} autoFocus={showWelcomeStyle} status={ thread.error @@ -593,9 +568,7 @@ export default function ChatPage() { context={settings.context} extraHeader={
- {showWelcomeStyle && !hasSubmitted && ( - - )} + {showWelcomeStyle && }
} disabled={ diff --git a/frontend/src/components/workspace/input-box.tsx b/frontend/src/components/workspace/input-box.tsx index 49ebc4f5..85d2ddb1 100644 --- a/frontend/src/components/workspace/input-box.tsx +++ b/frontend/src/components/workspace/input-box.tsx @@ -219,7 +219,6 @@ export function InputBox({ context, extraHeader, showWelcomeStyle, - hasSubmitted, initialValue, onContextChange, onSubmit, @@ -238,7 +237,6 @@ export function InputBox({ }; extraHeader?: React.ReactNode; showWelcomeStyle: boolean; - hasSubmitted?: boolean; initialValue?: string; onContextChange?: ( context: Omit< @@ -294,14 +292,13 @@ export function InputBox({ const [isInputToolsTourReady, setIsInputToolsTourReady] = useState(false); const { data: referenceFilesData } = useReferenceFiles(threadIdFromProps); - // isNewThread 时禁用收缩,始终保持展开(除非已提交消息) - const effectiveIsFocused = - ((showWelcomeStyle ?? false) && !hasSubmitted) || isFocused; + // Welcome 态下禁用收缩,始终保持展开 + const effectiveIsFocused = (showWelcomeStyle ?? false) || isFocused; const shouldShowSuggestionList = - showWelcomeStyle && !hasSubmitted && searchParams.get("mode") !== "skill"; + showWelcomeStyle && searchParams.get("mode") !== "skill"; useEffect(() => { - if (!showWelcomeStyle || hasSubmitted) { + if (!showWelcomeStyle) { setIsInputToolsTourReady(false); return; } @@ -318,14 +315,13 @@ export function InputBox({ return () => window.cancelAnimationFrame(frameId); }, [ showWelcomeStyle, - hasSubmitted, shouldShowSuggestionList, iframeSkill.isBootstrapping, iframeSkill.selectedSkills.length, ]); useEffect(() => { - if (!showWelcomeStyle || hasSubmitted || !isInputToolsTourReady) { + if (!showWelcomeStyle || !isInputToolsTourReady) { setIsInputToolsTourOpen(false); return; } @@ -337,7 +333,7 @@ export function InputBox({ if (!hasSeenTourForCurrentThread) { setIsInputToolsTourOpen(true); } - }, [showWelcomeStyle, hasSubmitted, isInputToolsTourReady, threadId]); + }, [showWelcomeStyle, isInputToolsTourReady, threadId]); const finishInputToolsTour = useCallback(() => { const seenState = parseInputToolsTourSeenState( @@ -817,7 +813,6 @@ export function InputBox({ "border-0 rounded-[20px] backdrop-blur-sm", "transition-[height] duration-300 ease-out shadow-none ", !showWelcomeStyle && "h-[200px] shadow-[0_0_20px_0_rgba(0,0,0,0.10)]", - hasSubmitted && "shadow-[0_0_20px_0_rgba(0,0,0,0.10)]!", effectiveIsFocused ? "h-[200px]" : "h-[80px]", )} disabled={isInputDisabled}