Add implement of Agent Workspace (include a taskmanager system)

This commit is contained in:
Liu Zhicong
2023-12-10 21:42:23 -08:00
parent 662aee7560
commit 3d00095650
10 changed files with 813 additions and 68 deletions
+5 -8
View File
@@ -85,10 +85,11 @@ class TelegramTunnel(AgentTunnel):
TelegramTunnel.all_bots[self.target_id] = self.bot
async def _run_app():
update_id = 0
try:
update_id = (await self.bot.get_updates())[0].update_id
except Exception as e:
update_id = None
update = await self.bot.get_updates()
if len(update) > 0:
update_id = update[0].update_id
except Exception as e:
logger.error(f"tg_tunnel error:{e}")
logger.exception(e)
@@ -97,11 +98,7 @@ class TelegramTunnel(AgentTunnel):
#logger.info("listening for new messages...")
while True:
try:
if update_id:
update_id = await self._do_process_raw_message(self.bot, update_id)
else:
update_id = (await self.bot.get_updates())[0].update_id
update_id = await self._do_process_raw_message(self.bot, update_id)
except NetworkError:
await asyncio.sleep(1)
except Forbidden: