Add GetNotified and Notify components
This commit is contained in:
parent
d1557d8c1e
commit
9a93e5e417
3 changed files with 12 additions and 11 deletions
|
|
@ -21,20 +21,21 @@ class NotifyComponent(CustomComponent):
|
||||||
def build(
|
def build(
|
||||||
self, name: str, record: Optional[Record] = None, append: bool = False
|
self, name: str, record: Optional[Record] = None, append: bool = False
|
||||||
) -> Record:
|
) -> Record:
|
||||||
if state and not isinstance(state, Record):
|
if record and not isinstance(record, Record):
|
||||||
if isinstance(state, str):
|
if isinstance(record, str):
|
||||||
state = Record(text=state)
|
record = Record(text=record)
|
||||||
elif isinstance(state, dict):
|
elif isinstance(record, dict):
|
||||||
state = Record(data=state)
|
record = Record(data=record)
|
||||||
else:
|
else:
|
||||||
state = Record(text=str(state))
|
record = Record(text=str(record))
|
||||||
elif not state:
|
elif not record:
|
||||||
state = Record(text="")
|
record = Record(text="")
|
||||||
if record:
|
if record:
|
||||||
if append:
|
if append:
|
||||||
self.append_state(name, record)
|
self.append_state(name, record)
|
||||||
else:
|
else:
|
||||||
self.update_state(name, record)
|
self.update_state(name, record)
|
||||||
else:
|
else:
|
||||||
state = "No record provided."
|
self.status = "No record provided."
|
||||||
self.status = state
|
self.status = record
|
||||||
|
return record
|
||||||
|
|
|
||||||
|
|
@ -699,7 +699,7 @@ class Graph:
|
||||||
return ChatVertex
|
return ChatVertex
|
||||||
elif node_name in ["ShouldRunNext"]:
|
elif node_name in ["ShouldRunNext"]:
|
||||||
return RoutingVertex
|
return RoutingVertex
|
||||||
elif node_name in ["SharedState"]:
|
elif node_name in ["SharedState", "Notify", "GetNotified"]:
|
||||||
return StateVertex
|
return StateVertex
|
||||||
elif node_base_type in lazy_load_vertex_dict.VERTEX_TYPE_MAP:
|
elif node_base_type in lazy_load_vertex_dict.VERTEX_TYPE_MAP:
|
||||||
return lazy_load_vertex_dict.VERTEX_TYPE_MAP[node_base_type]
|
return lazy_load_vertex_dict.VERTEX_TYPE_MAP[node_base_type]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue