chore: 移除过时的兼容性处理代码

This commit is contained in:
RockChinQ
2024-01-18 00:52:29 +08:00
parent aa433bd5ab
commit 5bbc38a7a3
8 changed files with 22 additions and 85 deletions
-3
View File
@@ -38,9 +38,6 @@ class PluginCommand(aamgr.AbstractCommandNode):
reply = [reply_str]
return True, reply
elif ctx.params[0].startswith("http"):
reply = ["[bot]err: 此命令已弃用,请使用 !plugin get <插件仓库地址> 进行安装"]
return True, reply
else:
return False, []
-4
View File
@@ -39,8 +39,6 @@ class DefaultCommand(aamgr.AbstractCommandNode):
reply_str += "\n当前默认情景预设:{}\n".format(dprompt.mode_inst().get_using_name())
reply_str += "请使用 !default set <情景预设名称> 来设置默认情景预设"
reply = [reply_str]
elif params[0] != "set":
reply = ["[bot]err: 已弃用,请使用!default set <情景预设名称> 来设置默认情景预设"]
else:
return False, []
@@ -69,7 +67,5 @@ class DefaultSetCommand(aamgr.AbstractCommandNode):
reply = ["[bot]已设置默认情景预设为:{}".format(full_name)]
except Exception as e:
reply = ["[bot]err: {}".format(e)]
else:
reply = ["[bot]err: 仅管理员可设置默认情景预设"]
return True, reply
+3 -6
View File
@@ -39,12 +39,9 @@ class ListCommand(aamgr.AbstractCommandNode):
# 时间(使用create_timestamp转换) 序号 部分内容
datetime_obj = datetime.datetime.fromtimestamp(results[i]['create_timestamp'])
msg = ""
try:
msg = json.loads(results[i]['prompt'])
except json.decoder.JSONDecodeError:
msg = pkg.openai.session.reset_session_prompt(session_name, results[i]['prompt'])
# 持久化
pkg.openai.session.get_session(session_name).persistence()
msg = json.loads(results[i]['prompt'])
if len(msg) >= 2:
reply_str += "#{} 创建:{} {}\n".format(i + page * 10,
datetime_obj.strftime("%Y-%m-%d %H:%M:%S"),
+4 -8
View File
@@ -17,14 +17,10 @@ def get_limitation(session_name: str) -> int:
"""获取会话的限制次数"""
config = context.get_config_manager().data
if type(config['rate_limitation']) == dict:
# 如果被指定了
if session_name in config['rate_limitation']:
return config['rate_limitation'][session_name]
else:
return config['rate_limitation']["default"]
elif type(config['rate_limitation']) == int:
return config['rate_limitation']
if session_name in config['rate_limitation']:
return config['rate_limitation'][session_name]
else:
return config['rate_limitation']["default"]
def add_usage(session_name: str):