mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 03:32:23 +08:00
chore: plugin icon not show
This commit is contained in:
parent
f2765b9d31
commit
e135707f88
|
@ -1,10 +1,10 @@
|
||||||
import { fetchIcon } from '@/service/plugins'
|
import { apiPrefix } from '@/config'
|
||||||
import { fetchWorkspaces } from '@/service/common'
|
import { fetchWorkspaces } from '@/service/common'
|
||||||
|
|
||||||
let tenantId: string | null | undefined = null
|
let tenantId: string | null | undefined = null
|
||||||
|
|
||||||
const useGetIcon = () => {
|
const useGetIcon = () => {
|
||||||
const getIcon = async (fileName: string) => {
|
const getIconUrl = async (fileName: string) => {
|
||||||
if (!tenantId) {
|
if (!tenantId) {
|
||||||
const { workspaces } = await fetchWorkspaces({
|
const { workspaces } = await fetchWorkspaces({
|
||||||
url: '/workspaces',
|
url: '/workspaces',
|
||||||
|
@ -12,12 +12,11 @@ const useGetIcon = () => {
|
||||||
})
|
})
|
||||||
tenantId = workspaces.find(v => v.current)?.id
|
tenantId = workspaces.find(v => v.current)?.id
|
||||||
}
|
}
|
||||||
const res = await fetchIcon(tenantId!, fileName)
|
return `${apiPrefix}/workspaces/current/plugin/icon?tenant_id=${tenantId}&filename=${fileName}`
|
||||||
return res
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
getIcon,
|
getIconUrl,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ const InstallFromLocalPackage: React.FC<InstallFromLocalPackageProps> = ({
|
||||||
return t(`${i18nPrefix}.installPlugin`)
|
return t(`${i18nPrefix}.installPlugin`)
|
||||||
}, [step])
|
}, [step])
|
||||||
|
|
||||||
const { getIcon } = useGetIcon()
|
const { getIconUrl } = useGetIcon()
|
||||||
|
|
||||||
const handleUploaded = useCallback(async (result: {
|
const handleUploaded = useCallback(async (result: {
|
||||||
uniqueIdentifier: string
|
uniqueIdentifier: string
|
||||||
|
@ -49,8 +49,7 @@ const InstallFromLocalPackage: React.FC<InstallFromLocalPackageProps> = ({
|
||||||
manifest,
|
manifest,
|
||||||
uniqueIdentifier,
|
uniqueIdentifier,
|
||||||
} = result
|
} = result
|
||||||
// TODO: wait for api to fix result
|
const icon = await getIconUrl(manifest!.icon)
|
||||||
const icon: any = await getIcon(manifest!.icon)
|
|
||||||
setUniqueIdentifier(uniqueIdentifier)
|
setUniqueIdentifier(uniqueIdentifier)
|
||||||
setManifest({
|
setManifest({
|
||||||
...manifest,
|
...manifest,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user