feat: install by local bundle change

This commit is contained in:
Joel 2024-11-19 18:32:17 +08:00
parent e151c2ee8c
commit 5947e38ea0
7 changed files with 12 additions and 11 deletions

View File

@ -30,7 +30,7 @@ const PluginList = () => {
type: 'github',
value: {
repo: 'YIXIAO0/test',
version: '1.11.5',
release: '1.11.5',
package: 'test.difypkg',
github_plugin_unique_identifier: 'yixiao0/test:0.0.1@3592166c87afcf944b4f13f27467a5c8f9e00bd349cb42033a072734a37431b4',
},
@ -40,7 +40,7 @@ const PluginList = () => {
value: {
package: 'dify-test.difypkg',
repo: 'WTW0313/dify-test',
version: '0.0.5-beta.2',
release: '0.0.5-beta.2',
github_plugin_unique_identifier: 'wtw0313/dify-test:0.0.1@1633daa043b47155d4228e2db7734245fd6d3e20ba812e5c02ce69fc1e3038f4',
},
},

View File

@ -25,8 +25,8 @@ const Item: FC<Props> = ({
const info = dependency.value
const { data, error } = useUploadGitHub({
repo: info.repo!,
version: info.version!,
package: info.package!,
version: info.release!,
package: info.packages!,
})
const [payload, setPayload] = React.useState<Plugin | null>(null)
useEffect(() => {

View File

@ -23,7 +23,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)
const [plugins, setPlugins, getPlugins] = useGetState<(Plugin | undefined)[]>((() => {
const hasLocalPackage = allPlugins.some(d => d.type === 'package')
if (!hasLocalPackage)

View File

@ -28,7 +28,7 @@ const InstallFromLocalPackage: React.FC<InstallFromLocalPackageProps> = ({
const [uniqueIdentifier, setUniqueIdentifier] = useState<string | null>(null)
const [manifest, setManifest] = useState<PluginDeclaration | null>(null)
const [errorMsg, setErrorMsg] = useState<string | null>(null)
const isBundle = file.name.endsWith('.bundle')
const isBundle = file.name.endsWith('.difybndl')
const [dependencies, setDependencies] = useState<Dependency[]>([])
const getTitle = useCallback(() => {

View File

@ -315,8 +315,8 @@ export type GitHubItemAndMarketPlaceDependency = {
type: 'github' | 'marketplace' | 'package'
value: {
repo?: string
version?: string
package?: string
release?: string
packages?: string
github_plugin_unique_identifier?: string
marketplace_plugin_unique_identifier?: string
plugin_unique_identifier?: string

View File

@ -274,4 +274,4 @@ export const DISABLE_UPLOAD_IMAGE_AS_ICON = process.env.NEXT_PUBLIC_DISABLE_UPLO
export const GITHUB_ACCESS_TOKEN = process.env.NEXT_PUBLIC_GITHUB_ACCESS_TOKEN || globalThis.document?.body?.getAttribute('data-public-github-access-token') || ''
export const SUPPORT_INSTALL_LOCAL_FILE_EXTENSIONS = '.difypkg,.bundle'
export const SUPPORT_INSTALL_LOCAL_FILE_EXTENSIONS = '.difypkg,.difybndl'

View File

@ -125,8 +125,8 @@ export const useInstallFromMarketplaceAndGitHub = ({
await post<InstallPackageResponse>('/workspaces/current/plugin/install/github', {
body: {
repo: data.value.repo!,
version: data.value.version!,
package: data.value.package!,
version: data.value.release!,
package: data.value.packages!,
plugin_unique_identifier: data.value.github_plugin_unique_identifier!,
},
})
@ -231,6 +231,7 @@ export const useFetchPluginsInMarketPlaceByIds = (unique_identifiers: string[])
unique_identifiers,
},
}),
enabled: unique_identifiers.filter(i => !!i).length > 0, // loaded then fetch
})
}