调参仙人有福了,添加了willing_manager的自选功能
This commit is contained in:
32
src/plugins/willing/willing_manager.py
Normal file
32
src/plugins/willing/willing_manager.py
Normal file
@@ -0,0 +1,32 @@
|
||||
from typing import Optional
|
||||
from loguru import logger
|
||||
|
||||
from ..chat.config import global_config
|
||||
from .mode_classical import WillingManager as ClassicalWillingManager
|
||||
from .mode_dynamic import WillingManager as DynamicWillingManager
|
||||
from .mode_custom import WillingManager as CustomWillingManager
|
||||
|
||||
def init_willing_manager() -> Optional[object]:
|
||||
"""
|
||||
根据配置初始化并返回对应的WillingManager实例
|
||||
|
||||
Returns:
|
||||
对应mode的WillingManager实例
|
||||
"""
|
||||
mode = global_config.willing_mode.lower()
|
||||
|
||||
if mode == "classical":
|
||||
logger.info("使用经典回复意愿管理器")
|
||||
return ClassicalWillingManager()
|
||||
elif mode == "dynamic":
|
||||
logger.info("使用动态回复意愿管理器")
|
||||
return DynamicWillingManager()
|
||||
elif mode == "custom":
|
||||
logger.warning(f"自定义的回复意愿管理器模式: {mode}")
|
||||
return CustomWillingManager()
|
||||
else:
|
||||
logger.warning(f"未知的回复意愿管理器模式: {mode}, 将使用经典模式")
|
||||
return ClassicalWillingManager()
|
||||
|
||||
# 全局willing_manager对象
|
||||
willing_manager = init_willing_manager()
|
||||
Reference in New Issue
Block a user