增加 config.py 主动发言相关

pull/937/head
Bakadax 2025-05-06 08:59:44 +08:00
parent 701e793276
commit e294253b1a
3 changed files with 17 additions and 2 deletions

View File

@ -274,6 +274,12 @@ class BotConfig:
talk_allowed_private = set()
enable_pfc_chatting: bool = False # 是否启用PFC聊天
# idle_conversation
enable_idle_conversation: bool = True # 是否启用 pfc 主动发言(未完善)
idle_check_interval: int = 10 # 检查间隔10分钟检查一次
min_idle_time: int = 7200 # 最短无活动时间2小时 (7200秒)
max_idle_time: int = 18000 # 最长无活动时间5小时 (18000秒)
# 模型配置
llm_reasoning: dict[str, str] = field(default_factory=lambda: {})
# llm_reasoning_minor: dict[str, str] = field(default_factory=lambda: {})
@ -659,6 +665,14 @@ class BotConfig:
if config.INNER_VERSION in SpecifierSet(">=1.1.0"):
config.enable_pfc_chatting = experimental_config.get("pfc_chatting", config.enable_pfc_chatting)
def idle_conversation(parent: dict):
idle_conversation_config = parent["idle_conversation"]
if config.INNER_VERSION in SpecifierSet(">=1.6.2"):
config.enable_idle_conversation = idle_conversation_config.get("enable_idle_conversation", config.enable_idle_conversation)
config.idle_check_interval = idle_conversation_config.get("idle_check_interval", config.idle_check_interval)
config.min_idle_time = idle_conversation_config.get("min_idle_time", config.min_idle_time)
config.max_idle_time = idle_conversation_config.get("max_idle_time", config.max_idle_time)
# 版本表达式:>=1.0.0,<2.0.0
# 允许字段func: method, support: str, notice: str, necessary: bool
# 如果使用 notice 字段,在该组配置加载时,会展示该字段对用户的警示
@ -692,6 +706,7 @@ class BotConfig:
"chat": {"func": chat, "support": ">=1.6.0", "necessary": False},
"normal_chat": {"func": normal_chat, "support": ">=1.6.0", "necessary": False},
"focus_chat": {"func": focus_chat, "support": ">=1.6.0", "necessary": False},
"idle_conversation": {"func": idle_conversation, "support": ">=1.6.2", "necessary": False},
}
# 原地修改,将 字符串版本表达式 转换成 版本对象

View File

@ -16,7 +16,7 @@ if TYPE_CHECKING:
from ..chat.message import Message
from .conversation import Conversation
logger = get_module_logger("pfc")
logger = get_module_logger("idle_conversation")
class IdleConversationStarter:
"""长时间无对话主动发起对话的组件

View File

@ -1,5 +1,5 @@
[inner]
version = "1.6.1"
version = "1.6.2"
#----以下是给开发人员阅读的,如果你只是部署了麦麦,不需要阅读----
#如果你想要修改配置文件请在修改后将version的值进行变更