diff --git a/src/plugins/chat/config.py b/src/plugins/chat/config.py index d2d5d2165..3d8e1bbcd 100644 --- a/src/plugins/chat/config.py +++ b/src/plugins/chat/config.py @@ -51,6 +51,8 @@ class BotConfig: ban_msgs_regex = set() max_response_length: int = 1024 # 最大回复长度 + + remote_enable: bool = False # 是否启用远程控制 # 模型配置 llm_reasoning: Dict[str, str] = field(default_factory=lambda: {}) @@ -314,6 +316,10 @@ class BotConfig: config.memory_forget_percentage = memory_config.get("memory_forget_percentage", config.memory_forget_percentage) config.memory_compress_rate = memory_config.get("memory_compress_rate", config.memory_compress_rate) + def remote(parent: dict): + remote_config = parent["remote"] + config.remote_enable = remote_config.get("enable", config.remote_enable) + def mood(parent: dict): mood_config = parent["mood"] config.mood_update_interval = mood_config.get("mood_update_interval", config.mood_update_interval) @@ -367,6 +373,7 @@ class BotConfig: "message": {"func": message, "support": ">=0.0.0"}, "memory": {"func": memory, "support": ">=0.0.0", "necessary": False}, "mood": {"func": mood, "support": ">=0.0.0"}, + "remote": {"func": remote, "support": ">=0.0.10", "necessary": False}, "keywords_reaction": {"func": keywords_reaction, "support": ">=0.0.2", "necessary": False}, "chinese_typo": {"func": chinese_typo, "support": ">=0.0.3", "necessary": False}, "groups": {"func": groups, "support": ">=0.0.0"}, diff --git a/src/plugins/chat/message_sender.py b/src/plugins/chat/message_sender.py index b88861ac3..2a6450dff 100644 --- a/src/plugins/chat/message_sender.py +++ b/src/plugins/chat/message_sender.py @@ -214,7 +214,7 @@ class MessageManager: try: if ( msg.is_head - and msg.update_thinking_time() > 30 + and msg.update_thinking_time() > 10 and not message_earliest.is_private_message() # 避免在私聊时插入reply ): msg.set_reply() diff --git a/src/plugins/remote/remote.py b/src/plugins/remote/remote.py index 127806ebd..1c7c2e9e1 100644 --- a/src/plugins/remote/remote.py +++ b/src/plugins/remote/remote.py @@ -6,6 +6,7 @@ import os import json import threading from src.common.logger import get_module_logger +from src.plugins.chat.config import global_config logger = get_module_logger("remote") @@ -92,13 +93,14 @@ class HeartbeatThread(threading.Thread): self.running = False def main(): - """主函数,启动心跳线程""" - # 配置 - SERVER_URL = "http://hyybuth.xyz:10058" - HEARTBEAT_INTERVAL = 300 # 5分钟(秒) - - # 创建并启动心跳线程 - heartbeat_thread = HeartbeatThread(SERVER_URL, HEARTBEAT_INTERVAL) - heartbeat_thread.start() - - return heartbeat_thread # 返回线程对象,便于外部控制 \ No newline at end of file + if global_config.remote_enable: + """主函数,启动心跳线程""" + # 配置 + SERVER_URL = "http://hyybuth.xyz:10058" + HEARTBEAT_INTERVAL = 300 # 5分钟(秒) + + # 创建并启动心跳线程 + heartbeat_thread = HeartbeatThread(SERVER_URL, HEARTBEAT_INTERVAL) + heartbeat_thread.start() + + return heartbeat_thread # 返回线程对象,便于外部控制 \ No newline at end of file diff --git a/template/bot_config_template.toml b/template/bot_config_template.toml index 89ebbe162..15a395616 100644 --- a/template/bot_config_template.toml +++ b/template/bot_config_template.toml @@ -1,5 +1,5 @@ [inner] -version = "0.0.9" +version = "0.0.10" #以下是给开发人员阅读的,一般用户不需要阅读 #如果你想要修改配置文件,请在修改后将version的值进行变更 @@ -123,7 +123,7 @@ talk_frequency_down = [] #降低回复频率的群 ban_user_id = [] #禁止回复消息的QQ号 [remote] #测试功能,发送统计信息,主要是看全球有多少只麦麦 -enable = false #默认关闭 +enable = true #V3