Feat: add check before install plugin (#20014)

This commit is contained in:
NFish 2025-06-18 15:51:23 +08:00 • committed by GitHub
commit 614c5e087e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
30 changed files with 337 additions and 135 deletions

View file

@ -1,4 +1,4 @@
import { MAX_VAR_KEY_LENGTH, VAR_ITEM_TEMPLATE, VAR_ITEM_TEMPLATE_IN_WORKFLOW, getMaxVarNameLength } from '@/config'
import { MARKETPLACE_URL_PREFIX, MAX_VAR_KEY_LENGTH, VAR_ITEM_TEMPLATE, VAR_ITEM_TEMPLATE_IN_WORKFLOW, getMaxVarNameLength } from '@/config'
import {
CONTEXT_PLACEHOLDER_TEXT,
HISTORY_PLACEHOLDER_TEXT,
@ -108,3 +108,15 @@ export const getVars = (value: string) => {
// Set the value of basePath
// example: /dify
export const basePath = ''
export function getMarketplaceUrl(path: string, params?: Record<string, string | undefined>) {
const searchParams = new URLSearchParams({ source: encodeURIComponent(window.location.origin) })
if (params) {
Object.keys(params).forEach((key) => {
const value = params[key]
if (value !== undefined && value !== null)
searchParams.append(key, value)
})
}
return `${MARKETPLACE_URL_PREFIX}${path}?${searchParams.toString()}`
}