mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-07-17 09:56:06 +00:00
chore: 移除过时的兼容性处理代码
This commit is contained in:
@@ -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, []
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"),
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user