Imporve /open command: detetive target before open.
This commit is contained in:
@@ -39,11 +39,6 @@ class CalenderEnvironment(Environment):
|
||||
self.add_ai_function(SimpleAIFunction("get_time",
|
||||
"get current time",
|
||||
self._get_now))
|
||||
|
||||
#self.add_ai_function(SimpleAIFunction("serach_events",
|
||||
# "search events in calender",
|
||||
# self._search_events))
|
||||
|
||||
get_param = {
|
||||
"start_time": "start time (UTC) of event",
|
||||
"end_time": "end time (UTC) of event"
|
||||
|
||||
@@ -48,6 +48,12 @@ class AgentManager:
|
||||
pass
|
||||
|
||||
|
||||
async def is_exist(self,agent_id:str) -> bool:
|
||||
the_aget = await self.get(agent_id)
|
||||
if the_aget:
|
||||
return True
|
||||
return False
|
||||
|
||||
async def get(self,agent_id:str) -> AIAgent:
|
||||
the_agent = self.loaded_agent_instance.get(agent_id)
|
||||
if the_agent:
|
||||
|
||||
@@ -57,7 +57,13 @@ class WorkflowManager:
|
||||
if await self._load_workflow_agents(sub_workflow) is False:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
async def is_exist(self,workflow_id:str) -> bool:
|
||||
the_workflow = await self.get_workflow(workflow_id)
|
||||
if the_workflow:
|
||||
return True
|
||||
return False
|
||||
|
||||
async def get_workflow(self,workflow_id:str) -> Workflow:
|
||||
the_workflow : Workflow = self.loaded_workflow.get(workflow_id)
|
||||
if the_workflow:
|
||||
|
||||
@@ -233,7 +233,7 @@ class AIOS_Shell:
|
||||
match tunnel_type:
|
||||
case "telegram":
|
||||
tunnel_config["type"] = "TelegramTunnel"
|
||||
input_table["token"] = UserConfigItem("telegram bot token")
|
||||
input_table["token"] = UserConfigItem("telegram bot token\n You can get it from https://t.me/BotFather ,read https://core.telegram.org/bots#how-do-i-create-a-bot for more details")
|
||||
input_table["allow"] = UserConfigItem("allow group (default is member,you can choose contact or guest)")
|
||||
case "email":
|
||||
tunnel_config["type"] = "EmailTunnel"
|
||||
@@ -491,6 +491,16 @@ class AIOS_Shell:
|
||||
else:
|
||||
topic = "default"
|
||||
|
||||
target_exist = False
|
||||
if await AgentManager.get_instance().is_exist(target_id):
|
||||
target_exist = True
|
||||
if await WorkflowManager.get_instance().is_exist(target_id):
|
||||
target_exist = True
|
||||
|
||||
if target_exist is False:
|
||||
show_text = FormattedText([("class:error", f"Target {target_id} not exist!")])
|
||||
return show_text
|
||||
|
||||
self.current_target = target_id
|
||||
self.current_topic = topic
|
||||
show_text = FormattedText([("class:title", f"current session switch to {topic}@{target_id}")])
|
||||
|
||||
Reference in New Issue
Block a user