更新remote项,使其真正有作用,更新config到0.0.10

This commit is contained in:
SengokuCola
2025-03-17 11:53:57 +08:00
parent c86614bd29
commit 665ef54cdd
4 changed files with 22 additions and 13 deletions

View File

@@ -51,6 +51,8 @@ class BotConfig:
ban_msgs_regex = set() ban_msgs_regex = set()
max_response_length: int = 1024 # 最大回复长度 max_response_length: int = 1024 # 最大回复长度
remote_enable: bool = False # 是否启用远程控制
# 模型配置 # 模型配置
llm_reasoning: Dict[str, str] = field(default_factory=lambda: {}) 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_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) 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): def mood(parent: dict):
mood_config = parent["mood"] mood_config = parent["mood"]
config.mood_update_interval = mood_config.get("mood_update_interval", config.mood_update_interval) 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"}, "message": {"func": message, "support": ">=0.0.0"},
"memory": {"func": memory, "support": ">=0.0.0", "necessary": False}, "memory": {"func": memory, "support": ">=0.0.0", "necessary": False},
"mood": {"func": mood, "support": ">=0.0.0"}, "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}, "keywords_reaction": {"func": keywords_reaction, "support": ">=0.0.2", "necessary": False},
"chinese_typo": {"func": chinese_typo, "support": ">=0.0.3", "necessary": False}, "chinese_typo": {"func": chinese_typo, "support": ">=0.0.3", "necessary": False},
"groups": {"func": groups, "support": ">=0.0.0"}, "groups": {"func": groups, "support": ">=0.0.0"},

View File

@@ -214,7 +214,7 @@ class MessageManager:
try: try:
if ( if (
msg.is_head msg.is_head
and msg.update_thinking_time() > 30 and msg.update_thinking_time() > 10
and not message_earliest.is_private_message() # 避免在私聊时插入reply and not message_earliest.is_private_message() # 避免在私聊时插入reply
): ):
msg.set_reply() msg.set_reply()

View File

@@ -6,6 +6,7 @@ import os
import json import json
import threading import threading
from src.common.logger import get_module_logger from src.common.logger import get_module_logger
from src.plugins.chat.config import global_config
logger = get_module_logger("remote") logger = get_module_logger("remote")
@@ -92,13 +93,14 @@ class HeartbeatThread(threading.Thread):
self.running = False self.running = False
def main(): def main():
"""主函数,启动心跳线程""" if global_config.remote_enable:
# 配置 """主函数,启动心跳线程"""
SERVER_URL = "http://hyybuth.xyz:10058" # 配置
HEARTBEAT_INTERVAL = 300 # 5分钟 SERVER_URL = "http://hyybuth.xyz:10058"
HEARTBEAT_INTERVAL = 300 # 5分钟
# 创建并启动心跳线程
heartbeat_thread = HeartbeatThread(SERVER_URL, HEARTBEAT_INTERVAL) # 创建并启动心跳线程
heartbeat_thread.start() heartbeat_thread = HeartbeatThread(SERVER_URL, HEARTBEAT_INTERVAL)
heartbeat_thread.start()
return heartbeat_thread # 返回线程对象,便于外部控制
return heartbeat_thread # 返回线程对象,便于外部控制

View File

@@ -1,5 +1,5 @@
[inner] [inner]
version = "0.0.9" version = "0.0.10"
#以下是给开发人员阅读的,一般用户不需要阅读 #以下是给开发人员阅读的,一般用户不需要阅读
#如果你想要修改配置文件请在修改后将version的值进行变更 #如果你想要修改配置文件请在修改后将version的值进行变更
@@ -123,7 +123,7 @@ talk_frequency_down = [] #降低回复频率的群
ban_user_id = [] #禁止回复消息的QQ号 ban_user_id = [] #禁止回复消息的QQ号
[remote] #测试功能,发送统计信息,主要是看全球有多少只麦麦 [remote] #测试功能,发送统计信息,主要是看全球有多少只麦麦
enable = false #默认关闭 enable = true
#V3 #V3