refactor: 修改引入风格

This commit is contained in:
RockChinQ
2023-11-13 21:59:23 +08:00
parent e3b280758c
commit 665de5dc43
47 changed files with 324 additions and 364 deletions
+8 -8
View File
@@ -1,11 +1,11 @@
from ..aamgr import AbstractCommandNode, Context
import tips as tips_custom
import pkg.openai.session
import pkg.utils.context
from .. import aamgr
from ....openai import session
from ....utils import context
@AbstractCommandNode.register(
@aamgr.AbstractCommandNode.register(
parent=None,
name='reset',
description='重置当前会话',
@@ -13,21 +13,21 @@ import pkg.utils.context
aliases=[],
privilege=1
)
class ResetCommand(AbstractCommandNode):
class ResetCommand(aamgr.AbstractCommandNode):
@classmethod
def process(cls, ctx: Context) -> tuple[bool, list]:
def process(cls, ctx: aamgr.Context) -> tuple[bool, list]:
params = ctx.params
session_name = ctx.session_name
reply = ""
if len(params) == 0:
pkg.openai.session.get_session(session_name).reset(explicit=True)
session.get_session(session_name).reset(explicit=True)
reply = [tips_custom.command_reset_message]
else:
try:
import pkg.openai.dprompt as dprompt
pkg.openai.session.get_session(session_name).reset(explicit=True, use_prompt=params[0])
session.get_session(session_name).reset(explicit=True, use_prompt=params[0])
reply = [tips_custom.command_reset_name_message+"{}".format(dprompt.mode_inst().get_full_name(params[0]))]
except Exception as e:
reply = ["[bot]会话重置失败:{}".format(e)]