From 5a5ebb95fcbf6885465d1bd4b9f77f638a306970 Mon Sep 17 00:00:00 2001 From: chordfish <592229466@qq.com> Date: Fri, 10 Mar 2023 12:35:58 +0800 Subject: [PATCH] =?UTF-8?q?bug:=E4=BF=AE=E5=A4=8D=E4=B8=8A=E6=AC=A1?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=90=8E=E4=B8=8D=E5=93=8D=E5=BA=94=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/openai/session.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/pkg/openai/session.py b/pkg/openai/session.py index 3873a06..d980e48 100644 --- a/pkg/openai/session.py +++ b/pkg/openai/session.py @@ -129,15 +129,12 @@ class Session: # 从配置文件获取会话预设信息 def get_default_prompt(self, use_default: str = None): - config = pkg.utils.context.get_config() - import pkg.openai.dprompt as dprompt if use_default is None: use_default = dprompt.get_current() - current_default_prompt = dprompt.get_prompt(use_default) - + current_default_prompt, bot_name, bot_filter = dprompt.get_prompt(use_default) return current_default_prompt def __init__(self, name: str): @@ -148,6 +145,7 @@ class Session: self.response_lock = threading.Lock() self.prompt = self.get_default_prompt() + logging.debug("prompt is: {}".format(self.prompt)) # 设定检查session最后一次对话是否超过过期时间的计时器 def schedule(self): @@ -191,7 +189,7 @@ class Session: self.last_interact_timestamp = int(time.time()) # 触发插件事件 - if self.prompt == self.get_default_prompt(): + if self.prompt == self.get_default_prompt()[0]: args = { 'session_name': self.name, 'session': self, @@ -274,7 +272,7 @@ class Session: # 持久化session def persistence(self): - if self.prompt == self.get_default_prompt(): + if self.prompt == self.get_default_prompt()[0]: return db_inst = pkg.utils.context.get_database_manager()