mirror of
https://github.com/langgenius/dify.git
synced 2026-04-30 07:28:05 +08:00
add workflow logics
This commit is contained in:
0
api/core/workflow/__init__.py
Normal file
0
api/core/workflow/__init__.py
Normal file
32
api/core/workflow/entities/NodeEntities.py
Normal file
32
api/core/workflow/entities/NodeEntities.py
Normal file
@ -0,0 +1,32 @@
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class NodeType(Enum):
|
||||
"""
|
||||
Node Types.
|
||||
"""
|
||||
START = 'start'
|
||||
END = 'end'
|
||||
DIRECT_ANSWER = 'direct-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_ASSIGNER = 'variable-assigner'
|
||||
|
||||
@classmethod
|
||||
def value_of(cls, value: str) -> 'BlockType':
|
||||
"""
|
||||
Get value of given block type.
|
||||
|
||||
:param value: block type value
|
||||
:return: block type
|
||||
"""
|
||||
for block_type in cls:
|
||||
if block_type.value == value:
|
||||
return block_type
|
||||
raise ValueError(f'invalid block type value {value}')
|
||||
0
api/core/workflow/entities/__init__.py
Normal file
0
api/core/workflow/entities/__init__.py
Normal file
0
api/core/workflow/nodes/__init__.py
Normal file
0
api/core/workflow/nodes/__init__.py
Normal file
0
api/core/workflow/nodes/end/__init__.py
Normal file
0
api/core/workflow/nodes/end/__init__.py
Normal file
0
api/core/workflow/nodes/end/end_node.py
Normal file
0
api/core/workflow/nodes/end/end_node.py
Normal file
25
api/core/workflow/nodes/end/entities.py
Normal file
25
api/core/workflow/nodes/end/entities.py
Normal file
@ -0,0 +1,25 @@
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class EndNodeOutputType(Enum):
|
||||
"""
|
||||
END Node Output Types.
|
||||
|
||||
none, plain-text, structured
|
||||
"""
|
||||
NONE = 'none'
|
||||
PLAIN_TEXT = 'plain-text'
|
||||
STRUCTURED = 'structured'
|
||||
|
||||
@classmethod
|
||||
def value_of(cls, value: str) -> 'OutputType':
|
||||
"""
|
||||
Get value of given output type.
|
||||
|
||||
:param value: output type value
|
||||
:return: output type
|
||||
"""
|
||||
for output_type in cls:
|
||||
if output_type.value == value:
|
||||
return output_type
|
||||
raise ValueError(f'invalid output type value {value}')
|
||||
0
api/core/workflow/workflow_engine_manager.py
Normal file
0
api/core/workflow/workflow_engine_manager.py
Normal file
Reference in New Issue
Block a user