修改bug

This commit is contained in:
meng_xi_pan
2025-04-09 17:19:10 +08:00
parent 1ca2b89f82
commit 9e8ef948cc
3 changed files with 8 additions and 5 deletions

View File

@@ -187,6 +187,7 @@ class ReasoningChat:
# 处理缓冲器结果 # 处理缓冲器结果
if not buffer_result: if not buffer_result:
await willing_manager.bombing_buffer_message_handle(message.message_info.message_id) await willing_manager.bombing_buffer_message_handle(message.message_info.message_id)
willing_manager.delete(message.message_info.message_id)
if message.message_segment.type == "text": if message.message_segment.type == "text":
logger.info(f"触发缓冲,已炸飞消息:{message.processed_plain_text}") logger.info(f"触发缓冲,已炸飞消息:{message.processed_plain_text}")
elif message.message_segment.type == "image": elif message.message_segment.type == "image":

View File

@@ -212,6 +212,7 @@ class ThinkFlowChat:
# 处理缓冲器结果 # 处理缓冲器结果
if not buffer_result: if not buffer_result:
await willing_manager.bombing_buffer_message_handle(message.message_info.message_id) await willing_manager.bombing_buffer_message_handle(message.message_info.message_id)
willing_manager.delete(message.message_info.message_id)
if message.message_segment.type == "text": if message.message_segment.type == "text":
logger.info(f"触发缓冲,已炸飞消息:{message.processed_plain_text}") logger.info(f"触发缓冲,已炸飞消息:{message.processed_plain_text}")
elif message.message_segment.type == "image": elif message.message_segment.type == "image":

View File

@@ -69,14 +69,15 @@ class BaseWillingManager(ABC):
module = importlib.import_module(f".mode_{manager_type}", __package__) module = importlib.import_module(f".mode_{manager_type}", __package__)
manager_class = getattr(module, f"{manager_type.capitalize()}WillingManager") manager_class = getattr(module, f"{manager_type.capitalize()}WillingManager")
if not issubclass(manager_class, cls): if not issubclass(manager_class, cls):
manager_class = getattr(module, "ClassicalWillingManager") raise
logger.info("未找到当前意愿模式对应文件,使用经典配方~")
else: else:
logger.info(f"成功载入willing模式{manager_type}") logger.info(f"成功载入willing模式{manager_type}")
return manager_class() return manager_class()
except (ImportError, AttributeError) as e: except:
logger.error(f"Failed to create willing manager: {str(e)}") module = importlib.import_module(f".mode_classical", __package__)
raise ValueError(f"Invalid willing manager type: {manager_type}") from e manager_class = getattr(module, "ClassicalWillingManager")
logger.info("未找到当前意愿模式对应文件,使用经典配方~")
return manager_class()
def __init__(self): def __init__(self):
self.chat_reply_willing: Dict[str, float] = {} # 存储每个聊天流的回复意愿(chat_id) self.chat_reply_willing: Dict[str, float] = {} # 存储每个聊天流的回复意愿(chat_id)