diff --git a/web/app/components/base/chat/chat-with-history/context.ts b/web/app/components/base/chat/chat-with-history/context.ts index 49dd06ca52..203be00fe7 100644 --- a/web/app/components/base/chat/chat-with-history/context.ts +++ b/web/app/components/base/chat/chat-with-history/context.ts @@ -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 52d8ac9286..b308205aa9 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, @@ -63,43 +66,50 @@ const HeaderInMobile = () => { 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} - /> + {showSiteDescription && ( +
+ {siteDescription} +
+ )}
{showSidebar && (
{ const { appData, + siteDescription, + showSiteDescription, currentConversationId, currentConversationItem, inputsForms, @@ -74,72 +76,79 @@ const Header = () => { 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 && ( + + )} +
+ {showSiteDescription && ( +
+ {siteDescription} +
+ )}
{!!showConfirm && ( { } }, [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 ( void } @@ -29,6 +30,7 @@ const Header: FC = ({ allowResetChat, customerIcon, title, + description, theme, onCreateNewChat, }) => { @@ -142,47 +144,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 && (