mirror of
https://mirror.skon.top/github.com/langgenius/dify.git
synced 2026-04-20 23:40:16 +08:00
Some checks failed
autofix.ci / autofix (push) Has been cancelled
Build and Push API & Web / build (api, {{defaultContext}}:api, Dockerfile, DIFY_API_IMAGE_NAME, linux/amd64, ubuntu-latest, build-api-amd64) (push) Has been cancelled
Build and Push API & Web / build (api, {{defaultContext}}:api, Dockerfile, DIFY_API_IMAGE_NAME, linux/arm64, ubuntu-24.04-arm, build-api-arm64) (push) Has been cancelled
Build and Push API & Web / build (web, {{defaultContext}}, web/Dockerfile, DIFY_WEB_IMAGE_NAME, linux/amd64, ubuntu-latest, build-web-amd64) (push) Has been cancelled
Build and Push API & Web / build (web, {{defaultContext}}, web/Dockerfile, DIFY_WEB_IMAGE_NAME, linux/arm64, ubuntu-24.04-arm, build-web-arm64) (push) Has been cancelled
Build and Push API & Web / create-manifest (api, DIFY_API_IMAGE_NAME, merge-api-images) (push) Has been cancelled
Build and Push API & Web / create-manifest (web, DIFY_WEB_IMAGE_NAME, merge-web-images) (push) Has been cancelled
Main CI Pipeline / Skip Duplicate Checks (push) Has been cancelled
Main CI Pipeline / Check Changed Files (push) Has been cancelled
Main CI Pipeline / Run API Tests (push) Has been cancelled
Main CI Pipeline / Skip API Tests (push) Has been cancelled
Main CI Pipeline / API Tests (push) Has been cancelled
Main CI Pipeline / Run Web Tests (push) Has been cancelled
Main CI Pipeline / Skip Web Tests (push) Has been cancelled
Main CI Pipeline / Web Tests (push) Has been cancelled
Main CI Pipeline / Run Web Full-Stack E2E (push) Has been cancelled
Main CI Pipeline / Skip Web Full-Stack E2E (push) Has been cancelled
Main CI Pipeline / Web Full-Stack E2E (push) Has been cancelled
Main CI Pipeline / Style Check (push) Has been cancelled
Main CI Pipeline / Run VDB Tests (push) Has been cancelled
Main CI Pipeline / Skip VDB Tests (push) Has been cancelled
Main CI Pipeline / VDB Tests (push) Has been cancelled
Main CI Pipeline / Run DB Migration Test (push) Has been cancelled
Main CI Pipeline / Skip DB Migration Test (push) Has been cancelled
Main CI Pipeline / DB Migration Test (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
76 lines
2.5 KiB
TypeScript
76 lines
2.5 KiB
TypeScript
import type {
|
|
Dependency,
|
|
InstallPackageResponse,
|
|
PluginInfoFromMarketPlace,
|
|
PluginManifestInMarket,
|
|
TaskStatusResponse,
|
|
UninstallPluginResponse,
|
|
updatePackageResponse,
|
|
uploadGitHubResponse,
|
|
} from '@/app/components/plugins/types'
|
|
import { get, getMarketplace, post, upload } from './base'
|
|
|
|
export const uploadFile = async (file: File, isBundle: boolean) => {
|
|
const formData = new FormData()
|
|
formData.append(isBundle ? 'bundle' : 'pkg', file)
|
|
return upload({
|
|
xhr: new XMLHttpRequest(),
|
|
data: formData,
|
|
}, false, `/workspaces/current/plugin/upload/${isBundle ? 'bundle' : 'pkg'}`)
|
|
}
|
|
|
|
export const updateFromMarketPlace = async (body: Record<string, string>) => {
|
|
return post<InstallPackageResponse>('/workspaces/current/plugin/upgrade/marketplace', {
|
|
body,
|
|
})
|
|
}
|
|
|
|
export const updateFromGitHub = async (repoUrl: string, selectedVersion: string, selectedPackage: string, originalPlugin: string, newPlugin: string) => {
|
|
return post<updatePackageResponse>('/workspaces/current/plugin/upgrade/github', {
|
|
body: {
|
|
repo: repoUrl,
|
|
version: selectedVersion,
|
|
package: selectedPackage,
|
|
original_plugin_unique_identifier: originalPlugin,
|
|
new_plugin_unique_identifier: newPlugin,
|
|
},
|
|
})
|
|
}
|
|
|
|
export const uploadGitHub = async (repoUrl: string, selectedVersion: string, selectedPackage: string) => {
|
|
return post<uploadGitHubResponse>('/workspaces/current/plugin/upload/github', {
|
|
body: {
|
|
repo: repoUrl,
|
|
version: selectedVersion,
|
|
package: selectedPackage,
|
|
},
|
|
})
|
|
}
|
|
|
|
export const fetchManifestFromMarketPlace = async (uniqueIdentifier: string) => {
|
|
return getMarketplace<{ data: { plugin: PluginManifestInMarket, version: { version: string } } }>(`/plugins/identifier?unique_identifier=${uniqueIdentifier}`)
|
|
}
|
|
|
|
export const fetchBundleInfoFromMarketPlace = async ({
|
|
org,
|
|
name,
|
|
version,
|
|
}: Record<string, string>) => {
|
|
return getMarketplace<{ data: { version: { dependencies: Dependency[] } } }>(`/bundles/${org}/${name}/${version}`)
|
|
}
|
|
|
|
export const fetchPluginInfoFromMarketPlace = async ({
|
|
org,
|
|
name,
|
|
}: Record<string, string>) => {
|
|
return getMarketplace<{ data: { plugin: PluginInfoFromMarketPlace, version: { version: string } } }>(`/plugins/${org}/${name}`)
|
|
}
|
|
|
|
export const checkTaskStatus = async (taskId: string) => {
|
|
return get<TaskStatusResponse>(`/workspaces/current/plugin/tasks/${taskId}`)
|
|
}
|
|
|
|
export const uninstallPlugin = async (pluginId: string) => {
|
|
return post<UninstallPluginResponse>('/workspaces/current/plugin/uninstall', { body: { plugin_installation_id: pluginId } })
|
|
}
|