改名工具增加开关

pull/937/head
Bakadax 2025-05-12 18:16:18 +08:00
parent 74b86df9c5
commit 9b5e2c3c0a
3 changed files with 12 additions and 1 deletions

View File

@ -284,6 +284,7 @@ class BotConfig:
2 # PFC 聊天消息缓冲数量,有利于使聊天节奏更加紧凑流畅,请根据实际 LLM 响应速度进行调整默认2条
)
api_polling_max_retries: int = 3 # 神秘小功能
rename_person: bool = True # 是否启用改名工具,可以让麦麦对唯一名进行更改,可能可以更拟人地称呼他人,但是也可能导致记忆混淆的问题
# idle_chat
enable_idle_chat: bool = False # 是否启用 pfc 主动发言
@ -735,6 +736,10 @@ class BotConfig:
config.pfc_message_buffer_size = experimental_config.get(
"pfc_message_buffer_size", config.pfc_message_buffer_size
)
if config.INNER_VERSION in SpecifierSet(">=1.6.2.3"):
config.rename_person = experimental_config.get(
"rename_person", config.rename_person
)
def idle_chat(parent: dict):
idle_chat_config = parent["idle_chat"]

View File

@ -5,6 +5,7 @@ import pkgutil
import os
from src.common.logger_manager import get_logger
from rich.traceback import install
from src.config.config import global_config
install(extra_lines=3)
@ -64,6 +65,10 @@ def register_tool(tool_class: Type[BaseTool]):
if not tool_name:
raise ValueError(f"工具类 {tool_class.__name__} 没有定义 name 属性")
if not global_config.rename_person and tool_name == "rename_person":
logger.info(f"改名功能已关闭,改名工具未注册")
return
TOOL_REGISTRY[tool_name] = tool_class
logger.info(f"已注册: {tool_name}")

View File

@ -1,5 +1,5 @@
[inner]
version = "1.6.2.2"
version = "1.6.2.3"
#----以下是给开发人员阅读的,如果你只是部署了麦麦,不需要阅读----
#如果你想要修改配置文件请在修改后将version的值进行变更
@ -203,6 +203,7 @@ pfc_chatting = false # 是否启用PFC聊天该功能仅作用于私聊
api_polling_max_retries = 3
enable_pfc_reply_checker = true # 是否启用 PFC 的回复检查器
pfc_message_buffer_size = 2 # PFC 聊天消息缓冲数量,有利于使聊天节奏更加紧凑流畅,请根据实际 LLM 响应速度进行调整默认2条
rename_person = true # 是否启用改名工具,可以让麦麦对唯一名进行更改,可能可以更拟人地称呼他人,但是也可能导致记忆混淆的问题
[idle_chat]
enable_idle_chat = false # 是否启用 pfc 主动发言