mirror of
https://gitee.com/dify_ai/dify.git
synced 2024-12-01 02:38:12 +08:00
fix: app logo (#4483)
This commit is contained in:
parent
528faceb35
commit
8b931b085c
@ -161,13 +161,13 @@ class CustomConfigWorkspaceApi(Resource):
|
|||||||
parser.add_argument('replace_webapp_logo', type=str, location='json')
|
parser.add_argument('replace_webapp_logo', type=str, location='json')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
tenant = db.session.query(Tenant).filter(Tenant.id == current_user.current_tenant_id).one_or_404()
|
||||||
|
|
||||||
custom_config_dict = {
|
custom_config_dict = {
|
||||||
'remove_webapp_brand': args['remove_webapp_brand'],
|
'remove_webapp_brand': args['remove_webapp_brand'],
|
||||||
'replace_webapp_logo': args['replace_webapp_logo'],
|
'replace_webapp_logo': args['replace_webapp_logo'] if args['replace_webapp_logo'] is not None else tenant.custom_config_dict.get('replace_webapp_logo') ,
|
||||||
}
|
}
|
||||||
|
|
||||||
tenant = db.session.query(Tenant).filter(Tenant.id == current_user.current_tenant_id).one_or_404()
|
|
||||||
|
|
||||||
tenant.custom_config_dict = custom_config_dict
|
tenant.custom_config_dict = custom_config_dict
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
|
@ -146,14 +146,14 @@ const ConfigPanel = () => {
|
|||||||
? null
|
? null
|
||||||
: (
|
: (
|
||||||
<div className={`flex items-center justify-end ${isMobile && 'w-full'}`}>
|
<div className={`flex items-center justify-end ${isMobile && 'w-full'}`}>
|
||||||
<a className='flex items-center pr-3 space-x-3' href="https://dify.ai/" target="_blank">
|
<div className='flex items-center pr-3 space-x-3'>
|
||||||
<span className='uppercase'>{t('share.chat.powerBy')}</span>
|
<span className='uppercase'>{t('share.chat.powerBy')}</span>
|
||||||
{
|
{
|
||||||
customConfig?.replace_webapp_logo
|
customConfig?.replace_webapp_logo
|
||||||
? <img src={customConfig?.replace_webapp_logo} alt='logo' className='block w-auto h-5' />
|
? <img src={customConfig?.replace_webapp_logo} alt='logo' className='block w-auto h-5' />
|
||||||
: <FootLogo />
|
: <FootLogo />
|
||||||
}
|
}
|
||||||
</a>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ const CustomWebAppBrand = () => {
|
|||||||
isCurrentWorkspaceManager,
|
isCurrentWorkspaceManager,
|
||||||
} = useAppContext()
|
} = useAppContext()
|
||||||
const [fileId, setFileId] = useState('')
|
const [fileId, setFileId] = useState('')
|
||||||
|
const [imgKey, setImgKey] = useState(Date.now())
|
||||||
const [uploadProgress, setUploadProgress] = useState(0)
|
const [uploadProgress, setUploadProgress] = useState(0)
|
||||||
const isSandbox = enableBilling && plan.type === Plan.sandbox
|
const isSandbox = enableBilling && plan.type === Plan.sandbox
|
||||||
const uploading = uploadProgress > 0 && uploadProgress < 100
|
const uploading = uploadProgress > 0 && uploadProgress < 100
|
||||||
@ -73,6 +74,7 @@ const CustomWebAppBrand = () => {
|
|||||||
})
|
})
|
||||||
mutateCurrentWorkspace()
|
mutateCurrentWorkspace()
|
||||||
setFileId('')
|
setFileId('')
|
||||||
|
setImgKey(Date.now())
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleRestore = async () => {
|
const handleRestore = async () => {
|
||||||
@ -80,7 +82,7 @@ const CustomWebAppBrand = () => {
|
|||||||
url: '/workspaces/custom-config',
|
url: '/workspaces/custom-config',
|
||||||
body: {
|
body: {
|
||||||
remove_webapp_brand: false,
|
remove_webapp_brand: false,
|
||||||
replace_webapp_logo: null,
|
replace_webapp_logo: '',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
mutateCurrentWorkspace()
|
mutateCurrentWorkspace()
|
||||||
@ -91,7 +93,6 @@ const CustomWebAppBrand = () => {
|
|||||||
url: '/workspaces/custom-config',
|
url: '/workspaces/custom-config',
|
||||||
body: {
|
body: {
|
||||||
remove_webapp_brand: checked,
|
remove_webapp_brand: checked,
|
||||||
replace_webapp_logo: webappLogo,
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
mutateCurrentWorkspace()
|
mutateCurrentWorkspace()
|
||||||
@ -121,7 +122,7 @@ const CustomWebAppBrand = () => {
|
|||||||
POWERED BY
|
POWERED BY
|
||||||
{
|
{
|
||||||
webappLogo
|
webappLogo
|
||||||
? <img key={webappLogo} src={webappLogo} alt='logo' className='ml-2 block w-auto h-5' />
|
? <img src={`${webappLogo}?hash=${imgKey}`} alt='logo' className='ml-2 block w-auto h-5' />
|
||||||
: <LogoSite className='ml-2 !h-5' />
|
: <LogoSite className='ml-2 !h-5' />
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user