diff --git a/web/app/components/share/chat/index.tsx b/web/app/components/share/chat/index.tsx index f981f4044d..18164c4756 100644 --- a/web/app/components/share/chat/index.tsx +++ b/web/app/components/share/chat/index.tsx @@ -70,17 +70,18 @@ const Main: FC = ({ const [promptConfig, setPromptConfig] = useState(null) const [inited, setInited] = useState(false) const [plan, setPlan] = useState('basic') // basic/plus/pro + const [canReplaceLogo, setCanReplaceLogo] = useState(false) // in mobile, show sidebar by click button const [isShowSidebar, { setTrue: showSidebar, setFalse: hideSidebar }] = useBoolean(false) // Can Use metadata(https://beta.nextjs.org/docs/api-reference/metadata) to set title. But it only works in server side client. useEffect(() => { if (siteInfo?.title) { - if (plan !== 'basic') + if (canReplaceLogo) document.title = `${siteInfo.title}` else document.title = `${siteInfo.title} - Powered by Dify` } - }, [siteInfo?.title, plan]) + }, [siteInfo?.title, canReplaceLogo]) /* * conversation info @@ -363,9 +364,10 @@ const Main: FC = ({ (async () => { try { const [appData, conversationData, appParams]: any = await fetchInitData() - const { app_id: appId, site: siteInfo, plan }: any = appData + const { app_id: appId, site: siteInfo, plan, can_replace_logo }: any = appData setAppId(appId) setPlan(plan) + setCanReplaceLogo(can_replace_logo) const tempIsPublicVersion = siteInfo.prompt_public setIsPublicVersion(tempIsPublicVersion) const prompt_template = '' @@ -733,6 +735,7 @@ const Main: FC = ({ savedInputs={currInputs as Record} onInputsChange={setCurrInputs} plan={plan} + canReplaceLogo={canReplaceLogo} > { diff --git a/web/app/components/share/chat/welcome/index.tsx b/web/app/components/share/chat/welcome/index.tsx index 1ad54d6cea..b8e533daa0 100644 --- a/web/app/components/share/chat/welcome/index.tsx +++ b/web/app/components/share/chat/welcome/index.tsx @@ -26,6 +26,7 @@ export type IWelcomeProps = { savedInputs: Record onInputsChange: (inputs: Record) => void plan?: string + canReplaceLogo?: boolean } const Welcome: FC = ({ @@ -39,6 +40,7 @@ const Welcome: FC = ({ canEidtInpus, savedInputs, onInputsChange, + canReplaceLogo, }) => { const { t } = useTranslation() const hasVar = promptConfig.prompt_variables.length > 0 @@ -350,7 +352,7 @@ const Welcome: FC = ({ :
} - {plan === 'basic' && + {!canReplaceLogo && {t('share.chat.powerBy')} } diff --git a/web/app/components/share/chatbot/index.tsx b/web/app/components/share/chatbot/index.tsx index e02ef9d5be..e0ac6b86c3 100644 --- a/web/app/components/share/chatbot/index.tsx +++ b/web/app/components/share/chatbot/index.tsx @@ -54,15 +54,16 @@ const Main: FC = ({ const [promptConfig, setPromptConfig] = useState(null) const [inited, setInited] = useState(false) const [plan, setPlan] = useState('basic') // basic/plus/pro + const [canReplaceLogo, setCanReplaceLogo] = useState(false) // Can Use metadata(https://beta.nextjs.org/docs/api-reference/metadata) to set title. But it only works in server side client. useEffect(() => { if (siteInfo?.title) { - if (plan !== 'basic') + if (canReplaceLogo) document.title = `${siteInfo.title}` else document.title = `${siteInfo.title} - Powered by Dify` } - }, [siteInfo?.title, plan]) + }, [siteInfo?.title, canReplaceLogo]) /* * conversation info @@ -282,9 +283,10 @@ const Main: FC = ({ (async () => { try { const [appData, conversationData, appParams]: any = await fetchInitData() - const { app_id: appId, site: siteInfo, plan }: any = appData + const { app_id: appId, site: siteInfo, plan, can_replace_logo }: any = appData setAppId(appId) setPlan(plan) + setCanReplaceLogo(can_replace_logo) const tempIsPublicVersion = siteInfo.prompt_public setIsPublicVersion(tempIsPublicVersion) const prompt_template = '' @@ -589,6 +591,7 @@ const Main: FC = ({ savedInputs={currInputs as Record} onInputsChange={setCurrInputs} plan={plan} + canReplaceLogo={canReplaceLogo} > { shouldReload && ( diff --git a/web/app/components/share/chatbot/welcome/index.tsx b/web/app/components/share/chatbot/welcome/index.tsx index a69d6a27df..c8e9e4bb7e 100644 --- a/web/app/components/share/chatbot/welcome/index.tsx +++ b/web/app/components/share/chatbot/welcome/index.tsx @@ -26,6 +26,7 @@ export type IWelcomeProps = { savedInputs: Record onInputsChange: (inputs: Record) => void plan: string + canReplaceLogo?: boolean } const Welcome: FC = ({ @@ -39,6 +40,7 @@ const Welcome: FC = ({ canEditInputs, savedInputs, onInputsChange, + canReplaceLogo, }) => { const { t } = useTranslation() const hasVar = promptConfig.prompt_variables.length > 0 @@ -351,7 +353,7 @@ const Welcome: FC = ({ :
} - {plan === 'basic' && + {!canReplaceLogo && {t('share.chat.powerBy')} } diff --git a/web/app/components/share/text-generation/index.tsx b/web/app/components/share/text-generation/index.tsx index 2906eb8c85..a4fcf25f01 100644 --- a/web/app/components/share/text-generation/index.tsx +++ b/web/app/components/share/text-generation/index.tsx @@ -71,6 +71,7 @@ const TextGeneration: FC = ({ const [inputs, setInputs] = useState>({}) const [appId, setAppId] = useState('') const [siteInfo, setSiteInfo] = useState(null) + const [canReplaceLogo, setCanReplaceLogo] = useState(false) const [promptConfig, setPromptConfig] = useState(null) const [moreLikeThisConfig, setMoreLikeThisConfig] = useState(null) @@ -343,9 +344,10 @@ const TextGeneration: FC = ({ useEffect(() => { (async () => { const [appData, appParams]: any = await fetchInitData() - const { app_id: appId, site: siteInfo } = appData + const { app_id: appId, site: siteInfo, can_replace_logo } = appData setAppId(appId) setSiteInfo(siteInfo as SiteInfo) + setCanReplaceLogo(can_replace_logo) changeLanguage(siteInfo.default_language) const { user_input_form, more_like_this, file_upload, sensitive_word_avoidance }: any = appParams @@ -364,9 +366,13 @@ const TextGeneration: FC = ({ // Can Use metadata(https://beta.nextjs.org/docs/api-reference/metadata) to set title. But it only works in server side client. useEffect(() => { - if (siteInfo?.title) - document.title = `${siteInfo.title} - Powered by Dify` - }, [siteInfo?.title]) + if (siteInfo?.title) { + if (canReplaceLogo) + document.title = `${siteInfo.title}` + else + document.title = `${siteInfo.title} - Powered by Dify` + } + }, [siteInfo?.title, canReplaceLogo]) const [isShowResSidebar, { setTrue: showResSidebar, setFalse: hideResSidebar }] = useBoolean(false) const resRef = useRef(null) diff --git a/web/i18n/lang/common.en.ts b/web/i18n/lang/common.en.ts index dff6af70e0..8edeb8bb29 100644 --- a/web/i18n/lang/common.en.ts +++ b/web/i18n/lang/common.en.ts @@ -101,7 +101,7 @@ const translation = { }, settings: { accountGroup: 'ACCOUNT', - workplaceGroup: 'WORKPLACE', + workplaceGroup: 'WORKSPACE', account: 'My account', members: 'Members', billing: 'Billing',