mirror of
https://github.com/langgenius/dify.git
synced 2026-01-28 22:53:23 +08:00
- Refactored DraftWorkflowTriggerNodeApi and DraftWorkflowTriggerRunApi to implement polling for trigger events instead of listening, improving responsiveness and reliability. - Introduced TriggerSubscriptionBuilderGetApi to retrieve subscription instances for trigger providers, enhancing the API's capabilities. - Removed deprecated trigger event classes and streamlined event handling in TriggerDebugService, ensuring a cleaner architecture. - Updated Queue and Stream entities to reflect the changes in trigger event handling, improving overall clarity and maintainability. These enhancements significantly improve the trigger debugging experience and API usability.
50 lines
1.4 KiB
Python
50 lines
1.4 KiB
Python
from enum import StrEnum
|
|
|
|
|
|
class NodeType(StrEnum):
|
|
START = "start"
|
|
END = "end"
|
|
ANSWER = "answer"
|
|
LLM = "llm"
|
|
KNOWLEDGE_RETRIEVAL = "knowledge-retrieval"
|
|
IF_ELSE = "if-else"
|
|
CODE = "code"
|
|
TEMPLATE_TRANSFORM = "template-transform"
|
|
QUESTION_CLASSIFIER = "question-classifier"
|
|
HTTP_REQUEST = "http-request"
|
|
TOOL = "tool"
|
|
VARIABLE_AGGREGATOR = "variable-aggregator"
|
|
LEGACY_VARIABLE_AGGREGATOR = "variable-assigner" # TODO: Merge this into VARIABLE_AGGREGATOR in the database.
|
|
LOOP = "loop"
|
|
LOOP_START = "loop-start"
|
|
LOOP_END = "loop-end"
|
|
ITERATION = "iteration"
|
|
ITERATION_START = "iteration-start" # Fake start node for iteration.
|
|
PARAMETER_EXTRACTOR = "parameter-extractor"
|
|
VARIABLE_ASSIGNER = "assigner"
|
|
DOCUMENT_EXTRACTOR = "document-extractor"
|
|
LIST_OPERATOR = "list-operator"
|
|
AGENT = "agent"
|
|
TRIGGER_WEBHOOK = "trigger-webhook"
|
|
TRIGGER_SCHEDULE = "trigger-schedule"
|
|
TRIGGER_PLUGIN = "trigger-plugin"
|
|
|
|
@property
|
|
def is_start_node(self) -> bool:
|
|
return self in [
|
|
NodeType.START,
|
|
NodeType.TRIGGER_WEBHOOK,
|
|
NodeType.TRIGGER_SCHEDULE,
|
|
NodeType.TRIGGER_PLUGIN,
|
|
]
|
|
|
|
|
|
class ErrorStrategy(StrEnum):
|
|
FAIL_BRANCH = "fail-branch"
|
|
DEFAULT_VALUE = "default-value"
|
|
|
|
|
|
class FailBranchSourceHandle(StrEnum):
|
|
FAILED = "fail-branch"
|
|
SUCCESS = "success-branch"
|