mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 11:42:29 +08:00
chore: install plugin by local use use query
This commit is contained in:
parent
822c18cb76
commit
f47b5ce63a
|
@ -8,7 +8,7 @@ import Button from '@/app/components/base/button'
|
|||
import { Trans, useTranslation } from 'react-i18next'
|
||||
import { RiLoader2Line } from '@remixicon/react'
|
||||
import Badge, { BadgeState } from '@/app/components/base/badge/index'
|
||||
import { installPackageFromLocal } from '@/service/plugins'
|
||||
import { useInstallPackageFromLocal } from '@/service/use-plugins'
|
||||
import checkTaskStatus from '../../base/check-task-status'
|
||||
import { usePluginTasksStore } from '@/app/components/plugins/plugin-page/store'
|
||||
|
||||
|
@ -33,6 +33,8 @@ const Installed: FC<Props> = ({
|
|||
}) => {
|
||||
const { t } = useTranslation()
|
||||
const [isInstalling, setIsInstalling] = React.useState(false)
|
||||
const { mutateAsync: installPackageFromLocal } = useInstallPackageFromLocal()
|
||||
|
||||
const {
|
||||
check,
|
||||
stop,
|
||||
|
|
|
@ -24,12 +24,6 @@ export const uploadPackageFile = async (file: File) => {
|
|||
}, false, '/workspaces/current/plugin/upload/pkg')
|
||||
}
|
||||
|
||||
export const installPackageFromLocal = async (uniqueIdentifier: string) => {
|
||||
return post<InstallPackageResponse>('/workspaces/current/plugin/install/pkg', {
|
||||
body: { plugin_unique_identifiers: [uniqueIdentifier] },
|
||||
})
|
||||
}
|
||||
|
||||
export const updateFromMarketPlace = async (body: Record<string, string>) => {
|
||||
return post<InstallPackageResponse>('/workspaces/current/plugin/upgrade/marketplace', {
|
||||
body,
|
||||
|
|
|
@ -43,6 +43,16 @@ export const useInstallPackageFromMarketPlace = () => {
|
|||
})
|
||||
}
|
||||
|
||||
export const useInstallPackageFromLocal = () => {
|
||||
return useMutation({
|
||||
mutationFn: (uniqueIdentifier: string) => {
|
||||
return post<InstallPackageResponse>('/workspaces/current/plugin/install/pkg', {
|
||||
body: { plugin_unique_identifiers: [uniqueIdentifier] },
|
||||
})
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export const useDebugKey = () => {
|
||||
return useQuery({
|
||||
queryKey: [NAME_SPACE, 'debugKey'],
|
||||
|
|
Loading…
Reference in New Issue
Block a user