Imporve /open command: detetive target before open.

This commit is contained in:
Liu Zhicong
2023-10-03 18:52:10 -07:00
parent a92b3f15dc
commit 4f43c4abed
5 changed files with 25 additions and 7 deletions
+11 -1
View File
@@ -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}")])