feat: can install github
This commit is contained in:
parent
bba80f465b
commit
6b759795d5
@ -13,12 +13,12 @@ const PluginList = () => {
|
||||
return (
|
||||
<div className='pb-3 bg-white'>
|
||||
<InstallBundle onClose={() => { }} fromDSLPayload={[
|
||||
{
|
||||
type: 'marketplace',
|
||||
value: {
|
||||
plugin_unique_identifier: 'langgenius/google:0.0.2@dcb354c9d0fee60e6e9c9eb996e1e485bbef343ba8cd545c0cfb3ec80970f6f1',
|
||||
},
|
||||
},
|
||||
// {
|
||||
// type: 'marketplace',
|
||||
// value: {
|
||||
// plugin_unique_identifier: 'langgenius/google:0.0.2@dcb354c9d0fee60e6e9c9eb996e1e485bbef343ba8cd545c0cfb3ec80970f6f1',
|
||||
// },
|
||||
// },
|
||||
{
|
||||
type: 'github',
|
||||
value: {
|
||||
@ -28,12 +28,12 @@ const PluginList = () => {
|
||||
github_plugin_unique_identifier: 'yixiao0/test:0.0.1@3592166c87afcf944b4f13f27467a5c8f9e00bd349cb42033a072734a37431b4',
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'marketplace',
|
||||
value: {
|
||||
plugin_unique_identifier: 'langgenius/openai:0.0.1@f88fdb98d104466db16a425bfe3af8c1bcad45047a40fb802d98a989ac57a5a3',
|
||||
},
|
||||
},
|
||||
// {
|
||||
// type: 'marketplace',
|
||||
// value: {
|
||||
// plugin_unique_identifier: 'langgenius/openai:0.0.1@f88fdb98d104466db16a425bfe3af8c1bcad45047a40fb802d98a989ac57a5a3',
|
||||
// },
|
||||
// },
|
||||
]} />
|
||||
<div className='mx-3 '>
|
||||
{/* <h2 className='my-3'>Dify Plugin list</h2> */}
|
||||
|
@ -26,9 +26,12 @@ const InstallByDSLList: FC<Props> = ({
|
||||
const [plugins, setPlugins, getPlugins] = useGetState<Plugin[]>([])
|
||||
const handlePlugInFetched = useCallback((index: number) => {
|
||||
return (p: Plugin) => {
|
||||
setPlugins(plugins.map((item, i) => i === index ? p : item))
|
||||
const nextPlugins = produce(plugins, (draft) => {
|
||||
draft[index] = p
|
||||
})
|
||||
setPlugins(nextPlugins)
|
||||
}
|
||||
}, [plugins])
|
||||
}, [plugins, setPlugins])
|
||||
|
||||
const marketPlaceInDSLIndex = useMemo(() => {
|
||||
const res: number[] = []
|
||||
|
@ -35,15 +35,16 @@ const Install: FC<Props> = ({
|
||||
const nextSelectedIndexes = isSelected ? selectedIndexes.filter(i => i !== selectedIndex) : [...selectedIndexes, selectedIndex]
|
||||
setSelectedIndexes(nextSelectedIndexes)
|
||||
}
|
||||
|
||||
const [canInstall, setCanInstall] = React.useState(false)
|
||||
const handleLoadedAllPlugin = useCallback(() => {
|
||||
setCanInstall(true)
|
||||
}, [selectedPlugins, selectedIndexes])
|
||||
}, [])
|
||||
|
||||
// Install from marketplace and github
|
||||
const { mutate: installFromMarketplaceAndGitHub, isPending: isInstalling } = useInstallFromMarketplaceAndGitHub({
|
||||
onSuccess: () => {
|
||||
console.log('success!')
|
||||
onSuccess: (res: { success: boolean }[]) => {
|
||||
console.log(res)
|
||||
},
|
||||
})
|
||||
console.log(canInstall, !isInstalling, selectedPlugins.length === 0)
|
||||
|
@ -97,7 +97,7 @@ export const useUploadGitHub = (payload: {
|
||||
export const useInstallFromMarketplaceAndGitHub = ({
|
||||
onSuccess,
|
||||
}: {
|
||||
onSuccess?: () => void
|
||||
onSuccess?: (res: { success: boolean }[]) => void
|
||||
}) => {
|
||||
return useMutation({
|
||||
mutationFn: (payload: Dependency[]) => {
|
||||
|
Loading…
Reference in New Issue
Block a user