2024-04-08 18:51:46 +08:00
|
|
|
from enum import Enum
|
|
|
|
|
2024-08-15 10:53:05 +08:00
|
|
|
from .model import App, AppMode, Message
|
2024-08-13 14:44:10 +08:00
|
|
|
from .types import StringUUID
|
2024-08-15 10:53:05 +08:00
|
|
|
from .workflow import ConversationVariable, Workflow, WorkflowNodeExecutionStatus
|
2024-08-13 14:44:10 +08:00
|
|
|
|
2024-09-10 17:08:06 +08:00
|
|
|
__all__ = ["ConversationVariable", "StringUUID", "AppMode", "WorkflowNodeExecutionStatus", "Workflow", "App", "Message"]
|
2024-04-29 11:58:17 +08:00
|
|
|
|
2024-04-08 18:51:46 +08:00
|
|
|
|
|
|
|
class CreatedByRole(Enum):
|
|
|
|
"""
|
|
|
|
Enum class for createdByRole
|
|
|
|
"""
|
2024-08-13 14:44:10 +08:00
|
|
|
|
2024-09-10 17:08:06 +08:00
|
|
|
ACCOUNT = "account"
|
|
|
|
END_USER = "end_user"
|
2024-04-08 18:51:46 +08:00
|
|
|
|
|
|
|
@classmethod
|
2024-09-10 17:08:06 +08:00
|
|
|
def value_of(cls, value: str) -> "CreatedByRole":
|
2024-04-08 18:51:46 +08:00
|
|
|
"""
|
|
|
|
Get value of given mode.
|
|
|
|
|
|
|
|
:param value: mode value
|
|
|
|
:return: mode
|
|
|
|
"""
|
|
|
|
for role in cls:
|
|
|
|
if role.value == value:
|
|
|
|
return role
|
2024-09-10 17:08:06 +08:00
|
|
|
raise ValueError(f"invalid createdByRole value {value}")
|