mirror of
https://github.com/langgenius/dify.git
synced 2026-05-04 17:38:04 +08:00
feat: change subscription field in workflow
This commit is contained in:
@ -22,13 +22,10 @@ export const SubscriptionMenu = memo(({ payload, selectedSubscriptionId, onSubsc
|
||||
provider: currentProvider.name,
|
||||
declaration: {
|
||||
tool: undefined,
|
||||
endpoint: undefined,
|
||||
// @ts-expect-error just remain the necessary fields
|
||||
trigger: {
|
||||
subscription_schema: currentProvider.subscription_schema,
|
||||
credentials_schema: currentProvider.credentials_schema,
|
||||
oauth_schema: {
|
||||
client_schema: currentProvider.oauth_client_schema,
|
||||
},
|
||||
subscription_schema: currentProvider.subscription_schema || [],
|
||||
subscription_constructor: currentProvider.subscription_constructor,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
@ -51,14 +51,6 @@ const useConfig = (id: string, payload: PluginTriggerNodeType) => {
|
||||
)
|
||||
}, [currentProvider, event_name])
|
||||
|
||||
// Dynamic subscription parameters (from subscription_schema.parameters_schema)
|
||||
const subscriptionParameterSchema = useMemo(() => {
|
||||
if (!currentProvider?.subscription_schema?.parameters_schema) return []
|
||||
return toolParametersToFormSchemas(
|
||||
currentProvider.subscription_schema.parameters_schema as any,
|
||||
)
|
||||
}, [currentProvider])
|
||||
|
||||
// Dynamic trigger parameters (from specific trigger.parameters)
|
||||
const triggerSpecificParameterSchema = useMemo(() => {
|
||||
if (!currentEvent) return []
|
||||
@ -126,27 +118,6 @@ const useConfig = (id: string, payload: PluginTriggerNodeType) => {
|
||||
|
||||
const showAuthRequired = !isAuthenticated && !!currentProvider
|
||||
|
||||
// Check supported authentication methods
|
||||
const supportedAuthMethods = useMemo(() => {
|
||||
if (!currentProvider) return []
|
||||
|
||||
const methods = []
|
||||
|
||||
if (
|
||||
currentProvider.oauth_client_schema
|
||||
&& currentProvider.oauth_client_schema.length > 0
|
||||
)
|
||||
methods.push('oauth')
|
||||
|
||||
if (
|
||||
currentProvider.credentials_schema
|
||||
&& currentProvider.credentials_schema.length > 0
|
||||
)
|
||||
methods.push('api_key')
|
||||
|
||||
return methods
|
||||
}, [currentProvider])
|
||||
|
||||
return {
|
||||
readOnly,
|
||||
inputs,
|
||||
@ -154,14 +125,12 @@ const useConfig = (id: string, payload: PluginTriggerNodeType) => {
|
||||
currentTrigger: currentEvent,
|
||||
triggerParameterSchema,
|
||||
triggerParameterValue,
|
||||
subscriptionParameterSchema,
|
||||
setTriggerParameterValue,
|
||||
setInputVar,
|
||||
outputSchema,
|
||||
hasObjectOutput,
|
||||
isAuthenticated,
|
||||
showAuthRequired,
|
||||
supportedAuthMethods,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user