Workflow is almost done.

This commit is contained in:
Liu Zhicong
2023-09-01 00:39:36 -07:00
parent 27f163ddd3
commit b4990e4c57
11 changed files with 469 additions and 175 deletions
+11 -1
View File
@@ -34,6 +34,7 @@ class AIBus:
self.unhandle_handler = None
async def post_message(self,target_id,msg:AgentMsg,use_unhandle=True) -> bool:
target_id = target_id.split(".")[0]
handler = self.handlers.get(target_id)
if handler:
handler.queue.put_nowait(msg)
@@ -62,6 +63,7 @@ class AIBus:
return handler.results.get(msg_id)
async def send_message(self,target_id:str,msg:AgentMsg) -> AgentMsg:
target_id = target_id.split(".")[0]
post_result = await self.post_message(target_id,msg)
if post_result is False:
return None
@@ -126,4 +128,12 @@ class AIBus:
handler.working_task = asyncio.create_task(self.process_queue(handler))
#send message to target logic:
# find target handler:
# process_message(msg):
# session = get_session(msg.sender,msg.target)
# history: open(sender,target,topic)