adapt to new value name

This commit is contained in:
streetycat
2023-09-20 08:45:53 +00:00
committed by zhangzhen
parent 0de5534723
commit ee3f9ebcea
4 changed files with 28 additions and 11 deletions
+21
View File
@@ -0,0 +1,21 @@
# 2023-09-20 08:41:50.636730
+/set_config proxy
# 2023-09-20 08:42:18.936143
+/open math_school 小学老师
# 2023-09-20 08:42:23.884698
+3+5=8
# 2023-09-20 08:43:13.219129
+/set_config proxy
# 2023-09-20 08:43:23.430306
+socks5@192.168.100.91:1080@zhangzhen@123456
# 2023-09-20 08:43:35.319913
+/open math_school 小学老师
# 2023-09-20 08:43:41.557234
+3+5=8
+1 -3
View File
@@ -97,9 +97,7 @@ class UserConfig:
raise Exception("user config key %s not exist",key)
if config_item.value is None:
default_config_item = config_item.clone()
default_config_item.value = config_item.default_value
return default_config_item
return config_item.default_value
return config_item.value
+5 -7
View File
@@ -194,15 +194,13 @@ class AIOS_Shell:
if len(args) == 1:
key = args[0]
config_item = AIStorage.get_instance().get_user_config().get_config_item(key)
old_value = AIStorage.get_instance().get_user_config().get_value(key)
old_value = None
if config_item is not None:
old_value = config_item.value
value = await session.prompt_async(f"{key} : {config_item.desc} \nCurrent : {old_value}\nPlease input new value:",style=shell_style)
AIStorage.get_instance().get_user_config().set_value(key,value)
await AIStorage.get_instance().get_user_config().save_to_user_config()
show_text = FormattedText([("class:title", f"set {key} to {value} success!")])
value = await session.prompt_async(f"{key} : {config_item.desc} \nCurrent : {old_value}\nPlease input new value:",style=shell_style)
AIStorage.get_instance().get_user_config().set_value(key,value)
await AIStorage.get_instance().get_user_config().save_to_user_config()
show_text = FormattedText([("class:title", f"set {key} to {value} success!")])
return show_text
case 'connect':
+1 -1
View File
@@ -11,7 +11,7 @@ sys.path.append(directory + '/../../')
from aios_kernel import AIStorage
def apply_storage():
proxy_cfg = AIStorage.get_instance().get_user_config().get_user_config("proxy")
proxy_cfg = AIStorage.get_instance().get_user_config().get_config_item("proxy")
if proxy_cfg is None:
return