diff --git a/dify_1.11.1/web/app/components/base/chat/chat-with-history/index.tsx b/dify_1.11.1/web/app/components/base/chat/chat-with-history/index.tsx index 6953be4b..7167b0e5 100644 --- a/dify_1.11.1/web/app/components/base/chat/chat-with-history/index.tsx +++ b/dify_1.11.1/web/app/components/base/chat/chat-with-history/index.tsx @@ -31,6 +31,7 @@ const ChatWithHistory: FC = ({ appChatListDataLoading, chatShouldReloadKey, isMobile, + isInstalledApp, themeBuilder, sidebarCollapseState, } = useChatWithHistoryContext() @@ -49,7 +50,7 @@ const ChatWithHistory: FC = ({ setShowSidePanel(false) }, [isSidebarCollapsed]) - useDocumentTitle(site?.title || 'Chat') + useDocumentTitle(site?.title || 'Chat', isInstalledApp ? '智能体平台' : undefined) return (
{ isResponding, } = useChatWithHistoryContext() const isSidebarCollapsed = sidebarCollapseState - const systemFeatures = useGlobalPublicStore(s => s.systemFeatures) + const [showConfirm, setShowConfirm] = useState(null) const [showRename, setShowRename] = useState(null) @@ -145,23 +144,6 @@ const Sidebar = ({ isPanel, panelVisible }: Props) => { data={appData?.site} forceClose={isPanel && !panelVisible} /> - {/* powered by */} -
- {!appData?.custom_config?.remove_webapp_brand && ( -
-
{t('share.chat.poweredBy')}
- { - systemFeatures.branding.enabled && systemFeatures.branding.workspace_logo - ? logo - : appData?.custom_config?.replace_webapp_logo - ? logo - : - } -
- )} -
{!!showConfirm && ( = ({ const [parentOrigin, setParentOrigin] = useState('') const [showToggleExpandButton, setShowToggleExpandButton] = useState(false) const [expanded, setExpanded] = useState(false) - const systemFeatures = useGlobalPublicStore(s => s.systemFeatures) + const handleMessageReceived = useCallback((event: MessageEvent) => { let currentParentOrigin = parentOrigin @@ -81,23 +80,6 @@ const Header: FC = ({ return (
- {/* powered by */} -
- {!appData?.custom_config?.remove_webapp_brand && ( -
-
{t('share.chat.poweredBy')}
- { - systemFeatures.branding.enabled && systemFeatures.branding.workspace_logo - ? logo - : appData?.custom_config?.replace_webapp_logo - ? logo - : - } -
- )} -
{currentConversationId && ( )} diff --git a/dify_1.11.1/web/app/components/base/chat/embedded-chatbot/index.tsx b/dify_1.11.1/web/app/components/base/chat/embedded-chatbot/index.tsx index 1553d1f1..7c84a321 100644 --- a/dify_1.11.1/web/app/components/base/chat/embedded-chatbot/index.tsx +++ b/dify_1.11.1/web/app/components/base/chat/embedded-chatbot/index.tsx @@ -2,7 +2,6 @@ import { useEffect, } from 'react' -import { useTranslation } from 'react-i18next' import { EmbeddedChatbotContext, useEmbeddedChatbotContext, @@ -16,10 +15,9 @@ import Loading from '@/app/components/base/loading' import LogoHeader from '@/app/components/base/logo/logo-embedded-chat-header' import Header from '@/app/components/base/chat/embedded-chatbot/header' import ChatWrapper from '@/app/components/base/chat/embedded-chatbot/chat-wrapper' -import DifyLogo from '@/app/components/base/logo/dify-logo' import cn from '@/utils/classnames' import useDocumentTitle from '@/hooks/use-document-title' -import { useGlobalPublicStore } from '@/context/global-public-context' + const Chatbot = () => { const { @@ -31,8 +29,6 @@ const Chatbot = () => { handleNewConversation, themeBuilder, } = useEmbeddedChatbotContext() - const { t } = useTranslation() - const systemFeatures = useGlobalPublicStore(s => s.systemFeatures) const customConfig = appData?.custom_config const site = appData?.site @@ -71,25 +67,6 @@ const Chatbot = () => { )}
- {/* powered by */} - {isMobile && ( -
- {!appData?.custom_config?.remove_webapp_brand && ( -
-
{t('share.chat.poweredBy')}
- { - systemFeatures.branding.enabled && systemFeatures.branding.workspace_logo - ? logo - : appData?.custom_config?.replace_webapp_logo - ? logo - : - } -
- )} -
- )}
) } diff --git a/dify_1.11.1/web/app/components/datasets/list/datasets.tsx b/dify_1.11.1/web/app/components/datasets/list/datasets.tsx index 69ea3957..07bd4046 100644 --- a/dify_1.11.1/web/app/components/datasets/list/datasets.tsx +++ b/dify_1.11.1/web/app/components/datasets/list/datasets.tsx @@ -37,7 +37,7 @@ const Datasets = ({ const observerRef = useRef(null) useEffect(() => { - document.title = `${t('dataset.knowledge')} - Dify` + document.title = `${t('dataset.knowledge')} - 智能体平台` }, [t]) useEffect(() => { diff --git a/dify_1.11.1/web/app/components/share/text-generation/index.tsx b/dify_1.11.1/web/app/components/share/text-generation/index.tsx index f5cb7005..335c3ba7 100644 --- a/dify_1.11.1/web/app/components/share/text-generation/index.tsx +++ b/dify_1.11.1/web/app/components/share/text-generation/index.tsx @@ -35,10 +35,9 @@ import Toast from '@/app/components/base/toast' import type { VisionFile, VisionSettings } from '@/types/app' import { Resolution, TransferMethod } from '@/types/app' import { useAppFavicon } from '@/hooks/use-app-favicon' -import DifyLogo from '@/app/components/base/logo/dify-logo' import cn from '@/utils/classnames' import { AccessMode } from '@/models/access-control' -import { useGlobalPublicStore } from '@/context/global-public-context' + import useDocumentTitle from '@/hooks/use-document-title' import { useWebAppStore } from '@/context/web-app-context' @@ -90,7 +89,7 @@ const TextGeneration: FC = ({ doSetInputs(newInputs) inputsRef.current = newInputs }, []) - const systemFeatures = useGlobalPublicStore(s => s.systemFeatures) + const [appId, setAppId] = useState('') const [siteInfo, setSiteInfo] = useState(null) const [customConfig, setCustomConfig] = useState | null>(null) @@ -397,7 +396,7 @@ const TextGeneration: FC = ({ }, [appData, appParams, fetchSavedMessage, isWorkflow]) // Can Use metadata(https://beta.nextjs.org/docs/api-reference/metadata) to set title. But it only works in server side client. - useDocumentTitle(siteInfo?.title || t('share.generation.title')) + useDocumentTitle(siteInfo?.title || t('share.generation.title'), isInstalledApp ? '智能体平台' : undefined) useAppFavicon({ enable: !isInstalledApp, @@ -594,23 +593,6 @@ const TextGeneration: FC = ({ /> )} - {/* powered by */} - {!customConfig?.remove_webapp_brand && ( -
-
{t('share.chat.poweredBy')}
- { - systemFeatures.branding.enabled && systemFeatures.branding.workspace_logo - ? logo - : customConfig?.replace_webapp_logo - ? logo - : - } -
- )} {/* Result */}
{ * Test title format with page title and default branding * Format: "[page] - Dify" */ - it('document title should be test-Dify if set title', () => { + it('document title should be test-智能体平台 if set title', () => { renderHook(() => useDocumentTitle('test')) - expect(document.title).toBe('test - Dify') + expect(document.title).toBe('test - 智能体平台') }) /** * Test title with only default branding (no page title) * Format: "Dify" */ - it('document title should be Dify if not set title', () => { + it('document title should be 智能体平台 if not set title', () => { renderHook(() => useDocumentTitle('')) - expect(document.title).toBe('Dify') + expect(document.title).toBe('智能体平台') }) }) diff --git a/dify_1.11.1/web/hooks/use-document-title.ts b/dify_1.11.1/web/hooks/use-document-title.ts index 10a167a9..f69ae7e3 100644 --- a/dify_1.11.1/web/hooks/use-document-title.ts +++ b/dify_1.11.1/web/hooks/use-document-title.ts @@ -4,20 +4,25 @@ import { useFavicon, useTitle } from 'ahooks' import { basePath } from '@/utils/var' import { useEffect } from 'react' -export default function useDocumentTitle(title: string) { +export default function useDocumentTitle(title: string, brandOverride?: string) { const isPending = useGlobalPublicStore(s => s.isGlobalPending) const systemFeatures = useGlobalPublicStore(s => s.systemFeatures) const prefix = title ? `${title} - ` : '' let titleStr = '' let favicon = '' if (isPending === false) { - if (systemFeatures.branding.enabled) { - titleStr = `${prefix}${systemFeatures.branding.application_title}` - favicon = systemFeatures.branding.favicon - } - else { - titleStr = `${prefix}Dify` - favicon = `${basePath}/favicon.ico` + if (brandOverride) { + titleStr = `${prefix}${brandOverride}` + favicon = systemFeatures.branding.enabled ? systemFeatures.branding.favicon : `${basePath}/favicon.ico` + } else { + if (systemFeatures.branding.enabled) { + titleStr = `${prefix}${systemFeatures.branding.application_title}` + favicon = systemFeatures.branding.favicon + } + else { + titleStr = `${prefix}智能体平台` + favicon = `${basePath}/favicon.ico` + } } } useTitle(titleStr)