From 139dfb76e41ad066dd2f53ef0ae8a22e894dc954 Mon Sep 17 00:00:00 2001 From: fengxiangdebaozi <10845145+fengxiangdebaozi@user.noreply.gitee.com> Date: Thu, 14 May 2026 14:59:12 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend-web/src/App.tsx | 8 +++++++- .../src/components/workspace/messages/message-list.tsx | 6 ++++-- frontend-web/src/pages/AgentChatPage.tsx | 9 +++++++++ frontend-web/src/pages/ChatPage.tsx | 9 +++++++++ 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/frontend-web/src/App.tsx b/frontend-web/src/App.tsx index c1122c19..66fda5ba 100644 --- a/frontend-web/src/App.tsx +++ b/frontend-web/src/App.tsx @@ -5,6 +5,8 @@ import { ThemeProvider as NextThemesProvider } from "next-themes"; import { QueryClientProvider } from "@/components/query-client-provider"; import { I18nProvider } from "@/core/i18n/context"; import { detectLocale } from "@/core/i18n/locale"; +import { ChatProvider } from "@/contexts/ChatContext"; +import { ThemeProvider } from "@/contexts/ThemeContext"; import { HashRouter, useLocation } from "react-router-dom"; @@ -26,7 +28,11 @@ function AppProviders({ children }: { children: React.ReactNode }) { forcedTheme={forcedTheme} > - {children} + + + {children} + + ); diff --git a/frontend-web/src/components/workspace/messages/message-list.tsx b/frontend-web/src/components/workspace/messages/message-list.tsx index b9c8b90b..b27775be 100644 --- a/frontend-web/src/components/workspace/messages/message-list.tsx +++ b/frontend-web/src/components/workspace/messages/message-list.tsx @@ -454,6 +454,7 @@ function ClarificationCard({ const payload = getClarificationPayload(message); const [customAnswer, setCustomAnswer] = useState(""); const [submitting, setSubmitting] = useState(false); + const [submitted, setSubmitted] = useState(false); const options = useMemo( () => @@ -473,16 +474,17 @@ function ClarificationCard({ ); } - const disabled = isLoading || submitting || !onSubmit; + const disabled = false; async function submitAnswer(answer: string) { const trimmed = answer.trim(); - if (!trimmed || disabled) { + if (!trimmed) { return; } setSubmitting(true); try { await onSubmit?.(trimmed); + setSubmitted(true); } finally { setSubmitting(false); } diff --git a/frontend-web/src/pages/AgentChatPage.tsx b/frontend-web/src/pages/AgentChatPage.tsx index 19bd0918..871998b9 100644 --- a/frontend-web/src/pages/AgentChatPage.tsx +++ b/frontend-web/src/pages/AgentChatPage.tsx @@ -98,6 +98,14 @@ export default function AgentChatPage() { [sendMessage, threadId, agent_id], ); + const handleClarificationSubmit = useCallback( + (answer: string) => { + setHasStartedConversation(true); + void sendMessage(threadId, { text: answer, files: [] }, { agent_id }); + }, + [sendMessage, threadId, agent_id], + ); + const handleStop = useCallback(async () => { await thread.stop(); }, [thread]); @@ -160,6 +168,7 @@ export default function AgentChatPage() { thread={thread} paddingBottom={messageListPaddingBottom} tokenUsageEnabled={tokenUsageEnabled} + onClarificationSubmit={handleClarificationSubmit} /> diff --git a/frontend-web/src/pages/ChatPage.tsx b/frontend-web/src/pages/ChatPage.tsx index 0ac3427c..3ada83f5 100644 --- a/frontend-web/src/pages/ChatPage.tsx +++ b/frontend-web/src/pages/ChatPage.tsx @@ -95,6 +95,14 @@ export default function ChatPage() { }, [sendMessage, threadId], ); + + const handleClarificationSubmit = useCallback( + (answer: string) => { + setHasStartedConversation(true); + void sendMessage(threadId, { text: answer, files: [] }); + }, + [sendMessage, threadId], + ); const handleStop = useCallback(async () => { await thread.stop(); }, [thread]); @@ -137,6 +145,7 @@ export default function ChatPage() { thread={thread} paddingBottom={messageListPaddingBottom} tokenUsageEnabled={tokenUsageEnabled} + onClarificationSubmit={handleClarificationSubmit} />