From 6ce58bde8ccff54216ea102fb2f9c41e08e80dc6 Mon Sep 17 00:00:00 2001 From: dataCenter430 Date: Tue, 3 Mar 2026 21:31:30 +0100 Subject: [PATCH 1/3] feat(web): show web app description on chat app screen --- .../chat-with-history/header-in-mobile.tsx | 79 ++++++----- .../chat/chat-with-history/header/index.tsx | 133 ++++++++++-------- .../chat/embedded-chatbot/header/index.tsx | 78 +++++----- .../base/chat/embedded-chatbot/index.tsx | 6 + 4 files changed, 166 insertions(+), 130 deletions(-) diff --git a/web/app/components/base/chat/chat-with-history/header-in-mobile.tsx b/web/app/components/base/chat/chat-with-history/header-in-mobile.tsx index 25189e097d..c078910570 100644 --- a/web/app/components/base/chat/chat-with-history/header-in-mobile.tsx +++ b/web/app/components/base/chat/chat-with-history/header-in-mobile.tsx @@ -59,45 +59,54 @@ const HeaderInMobile = () => { const [showSidebar, setShowSidebar] = useState(false) const [showChatSettings, setShowChatSettings] = useState(false) + const showDescription = !currentConversationId && appData?.site?.description + return ( <> -
- setShowSidebar(true)}> -
- -
- {!currentConversationId && ( - <> - +
+ setShowSidebar(true)}> +
+ +
+ {!currentConversationId && ( + <> + +
+ {appData?.site.title} +
+ + )} + {currentConversationId && ( + handleOperate(isPin ? 'unpin' : 'pin')} + isShowDelete + isShowRenameConversation + onRenameConversation={() => handleOperate('rename')} + onDelete={() => handleOperate('delete')} /> -
- {appData?.site.title} -
- - )} - {currentConversationId && ( - handleOperate(isPin ? 'unpin' : 'pin')} - isShowDelete - isShowRenameConversation - onRenameConversation={() => handleOperate('rename')} - onDelete={() => handleOperate('delete')} - /> - )} + )} +
+ setShowChatSettings(true)} + hideViewChatSettings={inputsForms.length < 1} + />
- setShowChatSettings(true)} - hideViewChatSettings={inputsForms.length < 1} - /> + {showDescription && ( +
+ {appData?.site?.description} +
+ )}
{showSidebar && (
{ handleRenameConversation(showRename.id, newName, { onSuccess: handleCancelRename }) }, [showRename, handleRenameConversation, handleCancelRename]) + const showDescription = !currentConversationId && appData?.site?.description + return ( <> -
-
- handleSidebarCollapse(false)}> - - -
- -
- {!currentConversationId && ( -
{appData?.site.title}
- )} - {currentConversationId && currentConversationItem && isSidebarCollapsed && ( - <> -
/
- handleOperate(isPin ? 'unpin' : 'pin')} - isShowDelete - isShowRenameConversation - onRenameConversation={() => handleOperate('rename')} - onDelete={() => handleOperate('delete')} +
+
+
+ handleSidebarCollapse(false)}> + + +
+ - - )} -
-
+
+ {!currentConversationId && ( +
{appData?.site.title}
+ )} + {currentConversationId && currentConversationItem && isSidebarCollapsed && ( + <> +
/
+ handleOperate(isPin ? 'unpin' : 'pin')} + isShowDelete + isShowRenameConversation + onRenameConversation={() => handleOperate('rename')} + onDelete={() => handleOperate('delete')} + /> + + )} +
+
+
+ {isSidebarCollapsed && ( + +
+ + + +
+
+ )}
- {isSidebarCollapsed && ( - -
- - +
+ {currentConversationId && ( + + + -
- - )} -
-
- {currentConversationId && ( - - - - - - )} - {currentConversationId && inputsForms.length > 0 && ( - - )} + + )} + {currentConversationId && inputsForms.length > 0 && ( + + )} +
+ {showDescription && ( +
+ {appData?.site?.description} +
+ )}
{!!showConfirm && ( void } @@ -30,6 +31,7 @@ const Header: FC = ({ allowResetChat, customerIcon, title, + description, theme, onCreateNewChat, }) => { @@ -141,47 +143,57 @@ const Header: FC = ({ return (
-
- {customerIcon} -
- {title} +
+
+ {customerIcon} +
+ {title} +
-
-
- { - showToggleExpandButton && ( +
+ { + showToggleExpandButton && ( + + + { + expanded + ? + : + } + + + ) + } + {currentConversationId && allowResetChat && ( - - { - expanded - ? - : - } + + - ) - } - {currentConversationId && allowResetChat && ( - - - - - - )} - {currentConversationId && inputsForms.length > 0 && !allInputsHidden && ( - - )} + )} + {currentConversationId && inputsForms.length > 0 && !allInputsHidden && ( + + )} +
+ {description && ( +
+ {description} +
+ )}
) } diff --git a/web/app/components/base/chat/embedded-chatbot/index.tsx b/web/app/components/base/chat/embedded-chatbot/index.tsx index 635e8d4aee..7fa986786d 100644 --- a/web/app/components/base/chat/embedded-chatbot/index.tsx +++ b/web/app/components/base/chat/embedded-chatbot/index.tsx @@ -60,10 +60,16 @@ const Chatbot = () => { isMobile={isMobile} allowResetChat={allowResetChat} title={site?.title || ''} + description={site?.description} customerIcon={isDify() ? difyIcon : ''} theme={themeBuilder?.theme} onCreateNewChat={handleNewConversation} /> + {!isMobile && site?.description && ( +
+ {site.description} +
+ )}
{appChatListDataLoading && ( From 21c3701ed78b37b0c2dea51be37fc8b34b8f6ca3 Mon Sep 17 00:00:00 2001 From: dataCenter430 Date: Tue, 3 Mar 2026 21:53:15 +0100 Subject: [PATCH 2/3] fix: centralized description logic in useChatWithHistoryContext --- .../base/chat/chat-with-history/context.tsx | 4 ++++ .../base/chat/chat-with-history/header-in-mobile.tsx | 11 ++++++----- .../base/chat/chat-with-history/header/index.tsx | 10 +++++----- .../components/base/chat/chat-with-history/hooks.tsx | 5 +++++ .../components/base/chat/chat-with-history/index.tsx | 4 ++++ 5 files changed, 24 insertions(+), 10 deletions(-) diff --git a/web/app/components/base/chat/chat-with-history/context.tsx b/web/app/components/base/chat/chat-with-history/context.tsx index 49dd06ca52..203be00fe7 100644 --- a/web/app/components/base/chat/chat-with-history/context.tsx +++ b/web/app/components/base/chat/chat-with-history/context.tsx @@ -20,6 +20,8 @@ import { createContext, useContext } from 'use-context-selector' export type ChatWithHistoryContextValue = { appMeta?: AppMeta | null appData?: AppData | null + siteDescription?: string + showSiteDescription: boolean appParams?: ChatConfig appChatListDataLoading?: boolean currentConversationId: string @@ -95,5 +97,7 @@ export const ChatWithHistoryContext = createContext setCurrentConversationInputs: noop, allInputsHidden: false, initUserVariables: {}, + siteDescription: '', + showSiteDescription: false, }) export const useChatWithHistoryContext = () => useContext(ChatWithHistoryContext) diff --git a/web/app/components/base/chat/chat-with-history/header-in-mobile.tsx b/web/app/components/base/chat/chat-with-history/header-in-mobile.tsx index c078910570..b36d36349f 100644 --- a/web/app/components/base/chat/chat-with-history/header-in-mobile.tsx +++ b/web/app/components/base/chat/chat-with-history/header-in-mobile.tsx @@ -6,6 +6,7 @@ import AppIcon from '@/app/components/base/app-icon' import InputsFormContent from '@/app/components/base/chat/chat-with-history/inputs-form/content' import RenameModal from '@/app/components/base/chat/chat-with-history/sidebar/rename-modal' import Confirm from '@/app/components/base/confirm' +import { cn } from '@/utils/classnames' import { useChatWithHistoryContext } from './context' import MobileOperationDropdown from './header/mobile-operation-dropdown' import Operation from './header/operation' @@ -14,6 +15,8 @@ import Sidebar from './sidebar' const HeaderInMobile = () => { const { appData, + siteDescription, + showSiteDescription, currentConversationId, currentConversationItem, pinnedConversationList, @@ -59,11 +62,9 @@ const HeaderInMobile = () => { const [showSidebar, setShowSidebar] = useState(false) const [showChatSettings, setShowChatSettings] = useState(false) - const showDescription = !currentConversationId && appData?.site?.description - return ( <> -
+
setShowSidebar(true)}>
@@ -102,9 +103,9 @@ const HeaderInMobile = () => { hideViewChatSettings={inputsForms.length < 1} />
- {showDescription && ( + {showSiteDescription && (
- {appData?.site?.description} + {siteDescription}
)}
diff --git a/web/app/components/base/chat/chat-with-history/header/index.tsx b/web/app/components/base/chat/chat-with-history/header/index.tsx index 7343344886..a31bc1b35a 100644 --- a/web/app/components/base/chat/chat-with-history/header/index.tsx +++ b/web/app/components/base/chat/chat-with-history/header/index.tsx @@ -21,6 +21,8 @@ import Operation from './operation' const Header = () => { const { appData, + siteDescription, + showSiteDescription, currentConversationId, currentConversationItem, inputsForms, @@ -70,11 +72,9 @@ const Header = () => { handleRenameConversation(showRename.id, newName, { onSuccess: handleCancelRename }) }, [showRename, handleRenameConversation, handleCancelRename]) - const showDescription = !currentConversationId && appData?.site?.description - return ( <> -
+
handleSidebarCollapse(false)}> @@ -142,9 +142,9 @@ const Header = () => { )}
- {showDescription && ( + {showSiteDescription && (
- {appData?.site?.description} + {siteDescription}
)}
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 da344a9789..288f61790c 100644 --- a/web/app/components/base/chat/chat-with-history/hooks.tsx +++ b/web/app/components/base/chat/chat-with-history/hooks.tsx @@ -193,6 +193,9 @@ export const useChatWithHistory = (installedAppInfo?: InstalledApp) => { } }, [appId, conversationIdInfo, setConversationIdInfo, userId]) + const siteDescription = appData?.site?.description || '' + const showSiteDescription = !currentConversationId && !!siteDescription + const [newConversationId, setNewConversationId] = useState('') const chatShouldReloadKey = useMemo(() => { if (currentConversationId === newConversationId) @@ -587,6 +590,8 @@ export const useChatWithHistory = (installedAppInfo?: InstalledApp) => { currentConversationItem, handleConversationIdInfoChange, appData, + siteDescription, + showSiteDescription, appParams: appParams || {} as ChatConfig, appMeta, appPinnedConversationData, diff --git a/web/app/components/base/chat/chat-with-history/index.tsx b/web/app/components/base/chat/chat-with-history/index.tsx index be6f047535..40638dd2c1 100644 --- a/web/app/components/base/chat/chat-with-history/index.tsx +++ b/web/app/components/base/chat/chat-with-history/index.tsx @@ -147,11 +147,15 @@ const ChatWithHistoryWrap: FC = ({ setCurrentConversationInputs, allInputsHidden, initUserVariables, + siteDescription, + showSiteDescription, } = useChatWithHistory(installedAppInfo) return (