fix: load package dsl error

This commit is contained in:
Joel 2024-11-20 14:27:46 +08:00
parent bb2914652a
commit 40d025052d
3 changed files with 26 additions and 22 deletions

View File

@ -22,12 +22,12 @@ const PluginList = () => {
<InstallBundle
onClose={hide}
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: {
@ -37,21 +37,21 @@ const PluginList = () => {
github_plugin_unique_identifier: 'yixiao0/test:0.0.1@3592166c87afcf944b4f13f27467a5c8f9e00bd349cb42033a072734a37431b4',
},
},
{
type: 'github',
value: {
package: 'dify-test.difypkg',
repo: 'WTW0313/dify-test',
release: '0.0.5-beta.2',
github_plugin_unique_identifier: 'wtw0313/dify-test:0.0.1@1633daa043b47155d4228e2db7734245fd6d3e20ba812e5c02ce69fc1e3038f4',
},
},
{
type: 'marketplace',
value: {
plugin_unique_identifier: 'langgenius/openai:0.0.2@7baee9635a07573ea192621ebfdacb39db466fa691e75255beaf48bf41d44375',
},
},
// {
// type: 'github',
// value: {
// package: 'dify-test.difypkg',
// repo: 'WTW0313/dify-test',
// release: '0.0.5-beta.2',
// github_plugin_unique_identifier: 'wtw0313/dify-test:0.0.1@1633daa043b47155d4228e2db7734245fd6d3e20ba812e5c02ce69fc1e3038f4',
// },
// },
// {
// type: 'marketplace',
// value: {
// plugin_unique_identifier: 'langgenius/openai:0.0.2@7baee9635a07573ea192621ebfdacb39db466fa691e75255beaf48bf41d44375',
// },
// },
]} />
)
}

View File

@ -5,6 +5,7 @@ import type { Plugin } from '../../../types'
import type { PackageDependency } from '../../../types'
import { pluginManifestToCardPluginProps } from '../../utils'
import LoadedItem from './loaded-item'
import LoadingError from '../../base/loading-error'
type Props = {
checked: boolean
@ -17,6 +18,9 @@ const PackageItem: FC<Props> = ({
checked,
onCheckedChange,
}) => {
if (!payload.value?.manifest)
return <LoadingError />
const plugin = pluginManifestToCardPluginProps(payload.value.manifest)
return (
<LoadedItem

View File

@ -24,7 +24,7 @@ const InstallByDSLList: FC<Props> = ({
onLoadedAllPlugin,
}) => {
const { isLoading: isFetchingMarketplaceData, data: marketplaceRes } = useFetchPluginsInMarketPlaceByIds(allPlugins.filter(d => d.type === 'marketplace').map(d => (d as GitHubItemAndMarketPlaceDependency).value.plugin_unique_identifier!))
console.log(allPlugins)
// console.log(allPlugins)
const [plugins, setPlugins, getPlugins] = useGetState<(Plugin | undefined)[]>((() => {
const hasLocalPackage = allPlugins.some(d => d.type === 'package')
if (!hasLocalPackage)