mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-05-03 00:02:36 +00:00
Added in Thiago fix
This commit is contained in:
@@ -137,6 +137,12 @@ class Flow(Generic[T], metaclass=FlowMeta):
|
||||
_routers: Dict[str, str] = {}
|
||||
initial_state: Union[Type[T], T, None] = None
|
||||
|
||||
def __class_getitem__(cls, item):
|
||||
class _FlowGeneric(cls):
|
||||
_initial_state_T = item
|
||||
|
||||
return _FlowGeneric
|
||||
|
||||
def __init__(self):
|
||||
print("[Flow.__init__] Initializing Flow")
|
||||
self._methods: Dict[str, Callable] = {}
|
||||
@@ -152,6 +158,8 @@ class Flow(Generic[T], metaclass=FlowMeta):
|
||||
|
||||
def _create_initial_state(self) -> T:
|
||||
print("[Flow._create_initial_state] Creating initial state")
|
||||
if self.initial_state is None and hasattr(self, "_initial_state_T"):
|
||||
return self._initial_state_T() # type: ignore
|
||||
if self.initial_state is None:
|
||||
return {} # type: ignore
|
||||
elif isinstance(self.initial_state, type):
|
||||
|
||||
Reference in New Issue
Block a user