From 5afdb462bd3c30d7686dca884b0222828b5ec934 Mon Sep 17 00:00:00 2001 From: Constaline Date: Tue, 4 Mar 2025 11:39:44 +0800 Subject: [PATCH] feat: when inputForms is empty, ConfigPanel set hide --- web/app/components/base/chat/chat-with-history/hooks.tsx | 6 ++++++ web/app/components/base/chat/embedded-chatbot/hooks.tsx | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/web/app/components/base/chat/chat-with-history/hooks.tsx b/web/app/components/base/chat/chat-with-history/hooks.tsx index 64dbb13acf..98340f50e8 100644 --- a/web/app/components/base/chat/chat-with-history/hooks.tsx +++ b/web/app/components/base/chat/chat-with-history/hooks.tsx @@ -207,6 +207,12 @@ export const useChatWithHistory = (installedAppInfo?: InstalledApp) => { handleNewConversationInputsChange(conversationInputs) }, [handleNewConversationInputsChange, inputsForms]) + // when inputForms is empty, ConfigPanel set hide + useEffect(() => { + if (!inputsForms || inputsForms.length === 0) + setShowConfigPanelBeforeChat(false) + }, [inputsForms, setShowConfigPanelBeforeChat]) + const { data: newConversation } = useSWR(newConversationId ? [isInstalledApp, appId, newConversationId] : null, () => generationConversationName(isInstalledApp, appId, newConversationId), { revalidateOnFocus: false }) const [originConversationList, setOriginConversationList] = useState([]) useEffect(() => { diff --git a/web/app/components/base/chat/embedded-chatbot/hooks.tsx b/web/app/components/base/chat/embedded-chatbot/hooks.tsx index 077eefc325..2e8beca328 100644 --- a/web/app/components/base/chat/embedded-chatbot/hooks.tsx +++ b/web/app/components/base/chat/embedded-chatbot/hooks.tsx @@ -317,6 +317,12 @@ export const useEmbeddedChatbot = () => { notify({ type: 'success', message: t('common.api.success') }) }, [isInstalledApp, appId, t, notify]) + // when inputForms is empty, ConfigPanel set hide + useEffect(() => { + if (!inputsForms || inputsForms.length === 0) + setShowConfigPanelBeforeChat(false) + }, [inputsForms, setShowConfigPanelBeforeChat]) + return { appInfoError, appInfoLoading,