diff --git a/pkg/qqbot/blob.py b/pkg/qqbot/blob.py index 96bcf8c3..81b5f1ce 100644 --- a/pkg/qqbot/blob.py +++ b/pkg/qqbot/blob.py @@ -66,7 +66,7 @@ def check_text(text: str) -> list: """检查文本是否为长消息,并转换成该使用的消息链组件""" if not hasattr(config, 'blob_message_threshold'): return [text] - + if len(text) > config.blob_message_threshold: if not hasattr(config, 'blob_message_strategy'): raise AttributeError('未定义长消息处理策略') diff --git a/pkg/qqbot/message.py b/pkg/qqbot/message.py index c8fa8b76..30c9ba49 100644 --- a/pkg/qqbot/message.py +++ b/pkg/qqbot/message.py @@ -63,7 +63,7 @@ def process_normal_message(text_message: str, mgr, config, launcher_type: str, reply = event.get_return_value("reply") if not event.is_prevented_default(): - reply = blob.check_text(prefix + text) + reply = prefix + text except openai.error.APIConnectionError as e: err_msg = str(e) if err_msg.__contains__('Error communicating with OpenAI'): diff --git a/pkg/qqbot/process.py b/pkg/qqbot/process.py index 3ca275ac..4dda7521 100644 --- a/pkg/qqbot/process.py +++ b/pkg/qqbot/process.py @@ -26,6 +26,7 @@ import pkg.plugin.host as plugin_host import pkg.plugin.models as plugin_models import pkg.qqbot.ignore as ignore import pkg.qqbot.banlist as banlist +import pkg.qqbot.blob as blob processing = [] @@ -157,6 +158,7 @@ def process_message(launcher_type: str, launcher_id: int, text_message: str, mes reply[0][:min(100, len(reply[0]))] + ( "..." if len(reply[0]) > 100 else ""))) reply = [mgr.reply_filter.process(reply[0])] + reply = blob.check_text(reply[0]) else: logging.info("回复[{}]消息".format(session_name))