mirror of https://github.com/langgenius/dify.git
refactor(trigger): update plugin and trigger entity structures
- Removed unnecessary newline in `TriggerPluginNode` class for consistency. - Made `provider` in `TriggerIdentity` optional to enhance flexibility. - Added `trigger` field to `PluginDeclaration` and updated `PluginCategory` to include `Trigger`, improving the integration of trigger functionalities within the plugin architecture. These changes streamline the entity definitions and enhance the overall structure of the trigger and plugin components.
This commit is contained in:
parent
fbb7b02e90
commit
add2ca85f2
|
|
@ -91,7 +91,6 @@ class ProviderConfigEncrypter:
|
|||
|
||||
return data
|
||||
|
||||
|
||||
def mask_tool_credentials(self, data: dict[str, Any]) -> dict[str, Any]:
|
||||
return self.mask_credentials(data)
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ from core.plugin.entities.base import BasePluginEntity
|
|||
from core.plugin.entities.endpoint import EndpointProviderDeclaration
|
||||
from core.tools.entities.common_entities import I18nObject
|
||||
from core.tools.entities.tool_entities import ToolProviderEntity
|
||||
from core.trigger.entities.entities import TriggerProviderEntity
|
||||
|
||||
|
||||
class PluginInstallationSource(enum.StrEnum):
|
||||
|
|
@ -62,6 +63,7 @@ class PluginCategory(enum.StrEnum):
|
|||
Model = "model"
|
||||
Extension = "extension"
|
||||
AgentStrategy = "agent-strategy"
|
||||
Trigger = "trigger"
|
||||
|
||||
|
||||
class PluginDeclaration(BaseModel):
|
||||
|
|
@ -89,6 +91,7 @@ class PluginDeclaration(BaseModel):
|
|||
repo: Optional[str] = Field(default=None)
|
||||
verified: bool = Field(default=False)
|
||||
tool: Optional[ToolProviderEntity] = None
|
||||
trigger: Optional[TriggerProviderEntity] = None
|
||||
model: Optional[ProviderEntity] = None
|
||||
endpoint: Optional[EndpointProviderDeclaration] = None
|
||||
agent_strategy: Optional[AgentStrategyProviderEntity] = None
|
||||
|
|
@ -104,6 +107,8 @@ class PluginDeclaration(BaseModel):
|
|||
values["category"] = PluginCategory.Model
|
||||
elif values.get("agent_strategy"):
|
||||
values["category"] = PluginCategory.AgentStrategy
|
||||
elif values.get("trigger"):
|
||||
values["category"] = PluginCategory.Trigger
|
||||
else:
|
||||
values["category"] = PluginCategory.Extension
|
||||
return values
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ class TriggerIdentity(BaseModel):
|
|||
author: str = Field(..., description="The author of the trigger")
|
||||
name: str = Field(..., description="The name of the trigger")
|
||||
label: I18nObject = Field(..., description="The label of the trigger")
|
||||
provider: str = Field(..., description="The provider of the trigger")
|
||||
provider: Optional[str] = Field(default=None, description="The provider of the trigger")
|
||||
|
||||
|
||||
class TriggerDescription(BaseModel):
|
||||
|
|
@ -250,6 +250,7 @@ class SubscriptionBuilderUpdater(BaseModel):
|
|||
if self.expires_at:
|
||||
subscription_builder.expires_at = self.expires_at
|
||||
|
||||
|
||||
# Export all entities
|
||||
__all__ = [
|
||||
"OAuthSchema",
|
||||
|
|
|
|||
|
|
@ -62,4 +62,4 @@ class TriggerPluginNode(BaseNode):
|
|||
return NodeRunResult(
|
||||
status=WorkflowNodeExecutionStatus.SUCCEEDED,
|
||||
outputs={},
|
||||
)
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue