mirror of https://github.com/langgenius/dify.git
feat(trigger): enhance subscription schema and provider configuration
- Update ProviderConfig to allow a list as a default value - Introduce SubscriptionSchema for better organization of subscription-related configurations - Modify TriggerProviderApiEntity to use Optional for subscription_schema - Add custom_model_schema to TriggerProviderEntity for additional configuration options Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
parent
72f9e77368
commit
5ddd5e49ee
|
|
@ -192,7 +192,7 @@ class ProviderConfig(BasicProviderConfig):
|
|||
|
||||
scope: AppSelectorScope | ModelSelectorScope | ToolSelectorScope | None = None
|
||||
required: bool = False
|
||||
default: Optional[Union[int, str, float, bool]] = None
|
||||
default: Optional[Union[int, str, float, bool, list]] = None
|
||||
options: Optional[list[Option]] = None
|
||||
label: Optional[I18nObject] = None
|
||||
help: Optional[I18nObject] = None
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ from core.entities.provider_entities import ProviderConfig
|
|||
from core.plugin.entities.plugin_daemon import CredentialType
|
||||
from core.trigger.entities.entities import (
|
||||
OAuthSchema,
|
||||
SubscriptionSchema,
|
||||
TriggerDescription,
|
||||
TriggerEntity,
|
||||
TriggerParameter,
|
||||
|
|
@ -26,7 +27,9 @@ class TriggerProviderApiEntity(BaseModel):
|
|||
identity: TriggerProviderIdentity = Field(description="The identity of the trigger provider")
|
||||
credentials_schema: list[ProviderConfig] = Field(description="The credentials schema of the trigger provider")
|
||||
oauth_schema: Optional[OAuthSchema] = Field(description="The OAuth schema of the trigger provider")
|
||||
subscription_schema: list[ProviderConfig] = Field(description="The subscription schema of the trigger provider")
|
||||
subscription_schema: Optional[SubscriptionSchema] = Field(
|
||||
description="The subscription schema of the trigger provider"
|
||||
)
|
||||
triggers: list[TriggerEntity] = Field(description="The triggers of the trigger provider")
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -99,6 +99,20 @@ class OAuthSchema(BaseModel):
|
|||
default_factory=list, description="The schema of the OAuth credentials"
|
||||
)
|
||||
|
||||
class SubscriptionSchema(BaseModel):
|
||||
"""
|
||||
The subscription schema of the trigger provider
|
||||
"""
|
||||
|
||||
parameters_schema: list[ProviderConfig] | None = Field(
|
||||
default_factory=list,
|
||||
description="The parameters schema required to create a subscription",
|
||||
)
|
||||
|
||||
properties_schema: list[ProviderConfig] | None = Field(
|
||||
default_factory=list,
|
||||
description="The configuration schema stored in the subscription entity",
|
||||
)
|
||||
|
||||
class TriggerProviderEntity(BaseModel):
|
||||
"""
|
||||
|
|
@ -114,8 +128,7 @@ class TriggerProviderEntity(BaseModel):
|
|||
default=None,
|
||||
description="The OAuth schema of the trigger provider if OAuth is supported",
|
||||
)
|
||||
subscription_schema: list[ProviderConfig] = Field(
|
||||
default_factory=list,
|
||||
subscription_schema: SubscriptionSchema = Field(
|
||||
description="The subscription schema for trigger(webhook, polling, etc.) subscription parameters",
|
||||
)
|
||||
triggers: list[TriggerEntity] = Field(default=[], description="The triggers of the trigger provider")
|
||||
|
|
|
|||
Loading…
Reference in New Issue