fix:将s4u启用放到配置文件防止git更新
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -41,6 +41,7 @@ config/bot_config.toml
|
|||||||
config/bot_config.toml.bak
|
config/bot_config.toml.bak
|
||||||
config/lpmm_config.toml
|
config/lpmm_config.toml
|
||||||
config/lpmm_config.toml.bak
|
config/lpmm_config.toml.bak
|
||||||
|
src/mais4u/config/s4u_config.toml
|
||||||
template/compare/bot_config_template.toml
|
template/compare/bot_config_template.toml
|
||||||
template/compare/model_config_template.toml
|
template/compare/model_config_template.toml
|
||||||
(测试版)麦麦生成人格.bat
|
(测试版)麦麦生成人格.bat
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ from src.plugin_system.base.component_types import ChatMode, EventType
|
|||||||
from src.plugin_system.core import events_manager
|
from src.plugin_system.core import events_manager
|
||||||
from src.plugin_system.apis import generator_api, send_api, message_api, database_api
|
from src.plugin_system.apis import generator_api, send_api, message_api, database_api
|
||||||
from src.mais4u.mai_think import mai_thinking_manager
|
from src.mais4u.mai_think import mai_thinking_manager
|
||||||
from src.mais4u.constant_s4u import ENABLE_S4U
|
|
||||||
import math
|
import math
|
||||||
|
from src.mais4u.s4u_config import s4u_config
|
||||||
# no_reply逻辑已集成到heartFC_chat.py中,不再需要导入
|
# no_reply逻辑已集成到heartFC_chat.py中,不再需要导入
|
||||||
from src.chat.chat_loop.hfc_utils import send_typing, stop_typing
|
from src.chat.chat_loop.hfc_utils import send_typing, stop_typing
|
||||||
|
|
||||||
@@ -379,7 +379,7 @@ class HeartFChatting:
|
|||||||
|
|
||||||
logger.info(f"{self.log_prefix} 开始第{self._cycle_counter}次思考")
|
logger.info(f"{self.log_prefix} 开始第{self._cycle_counter}次思考")
|
||||||
|
|
||||||
if ENABLE_S4U:
|
if s4u_config.enable_s4u:
|
||||||
await send_typing()
|
await send_typing()
|
||||||
|
|
||||||
async with global_prompt_manager.async_message_scope(self.chat_stream.context.get_template_name()):
|
async with global_prompt_manager.async_message_scope(self.chat_stream.context.get_template_name()):
|
||||||
@@ -597,7 +597,7 @@ class HeartFChatting:
|
|||||||
reply_text = action_reply_text
|
reply_text = action_reply_text
|
||||||
|
|
||||||
|
|
||||||
if ENABLE_S4U:
|
if s4u_config.enable_s4u:
|
||||||
await stop_typing()
|
await stop_typing()
|
||||||
await mai_thinking_manager.get_mai_think(self.stream_id).do_think_after_response(reply_text)
|
await mai_thinking_manager.get_mai_think(self.stream_id).do_think_after_response(reply_text)
|
||||||
|
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ class ChatManager:
|
|||||||
# 更新用户信息和群组信息
|
# 更新用户信息和群组信息
|
||||||
stream.update_active_time()
|
stream.update_active_time()
|
||||||
stream = copy.deepcopy(stream) # 返回副本以避免外部修改影响缓存
|
stream = copy.deepcopy(stream) # 返回副本以避免外部修改影响缓存
|
||||||
if user_info.platform and user_info.user_id:
|
if user_info and user_info.platform and user_info.user_id:
|
||||||
stream.user_info = user_info
|
stream.user_info = user_info
|
||||||
if group_info:
|
if group_info:
|
||||||
stream.group_info = group_info
|
stream.group_info = group_info
|
||||||
|
|||||||
@@ -45,7 +45,8 @@ def init_prompt():
|
|||||||
|
|
||||||
动作:reply
|
动作:reply
|
||||||
动作描述:参与聊天回复,发送文本进行表达
|
动作描述:参与聊天回复,发送文本进行表达
|
||||||
- 你想要闲聊或者随便附
|
- 你想要闲聊或者随便附和
|
||||||
|
- 有人提到了你,但是你还没有回应
|
||||||
- {mentioned_bonus}
|
- {mentioned_bonus}
|
||||||
- 如果你刚刚进行了回复,不要对同一个话题重复回应
|
- 如果你刚刚进行了回复,不要对同一个话题重复回应
|
||||||
{{
|
{{
|
||||||
|
|||||||
@@ -1,132 +0,0 @@
|
|||||||
[inner]
|
|
||||||
version = "1.1.0"
|
|
||||||
|
|
||||||
#----以下是S4U聊天系统配置文件----
|
|
||||||
# S4U (Smart 4 U) 聊天系统是MaiBot的核心对话模块
|
|
||||||
# 支持优先级队列、消息中断、VIP用户等高级功能
|
|
||||||
#
|
|
||||||
# 如果你想要修改配置文件,请在修改后将version的值进行变更
|
|
||||||
# 如果新增项目,请参考src/mais4u/s4u_config.py中的S4UConfig类
|
|
||||||
#
|
|
||||||
# 版本格式:主版本号.次版本号.修订号
|
|
||||||
#----S4U配置说明结束----
|
|
||||||
|
|
||||||
[s4u]
|
|
||||||
# 消息管理配置
|
|
||||||
message_timeout_seconds = 80 # 普通消息存活时间(秒),超过此时间的消息将被丢弃
|
|
||||||
recent_message_keep_count = 8 # 保留最近N条消息,超出范围的普通消息将被移除
|
|
||||||
|
|
||||||
# 优先级系统配置
|
|
||||||
at_bot_priority_bonus = 100.0 # @机器人时的优先级加成分数
|
|
||||||
vip_queue_priority = true # 是否启用VIP队列优先级系统
|
|
||||||
enable_message_interruption = true # 是否允许高优先级消息中断当前回复
|
|
||||||
|
|
||||||
# 打字效果配置
|
|
||||||
typing_delay = 0.1 # 打字延迟时间(秒),模拟真实打字速度
|
|
||||||
enable_dynamic_typing_delay = false # 是否启用基于文本长度的动态打字延迟
|
|
||||||
|
|
||||||
# 动态打字延迟参数(仅在enable_dynamic_typing_delay=true时生效)
|
|
||||||
chars_per_second = 15.0 # 每秒字符数,用于计算动态打字延迟
|
|
||||||
min_typing_delay = 0.2 # 最小打字延迟(秒)
|
|
||||||
max_typing_delay = 2.0 # 最大打字延迟(秒)
|
|
||||||
|
|
||||||
# 系统功能开关
|
|
||||||
enable_old_message_cleanup = true # 是否自动清理过旧的普通消息
|
|
||||||
enable_loading_indicator = true # 是否显示加载提示
|
|
||||||
|
|
||||||
enable_streaming_output = false # 是否启用流式输出,false时全部生成后一次性发送
|
|
||||||
|
|
||||||
max_context_message_length = 30
|
|
||||||
max_core_message_length = 20
|
|
||||||
|
|
||||||
# 模型配置
|
|
||||||
[models]
|
|
||||||
# 主要对话模型配置
|
|
||||||
[models.chat]
|
|
||||||
name = "qwen3-8b"
|
|
||||||
provider = "BAILIAN"
|
|
||||||
pri_in = 0.5
|
|
||||||
pri_out = 2
|
|
||||||
temp = 0.7
|
|
||||||
enable_thinking = false
|
|
||||||
|
|
||||||
# 规划模型配置
|
|
||||||
[models.motion]
|
|
||||||
name = "qwen3-8b"
|
|
||||||
provider = "BAILIAN"
|
|
||||||
pri_in = 0.5
|
|
||||||
pri_out = 2
|
|
||||||
temp = 0.7
|
|
||||||
enable_thinking = false
|
|
||||||
|
|
||||||
# 情感分析模型配置
|
|
||||||
[models.emotion]
|
|
||||||
name = "qwen3-8b"
|
|
||||||
provider = "BAILIAN"
|
|
||||||
pri_in = 0.5
|
|
||||||
pri_out = 2
|
|
||||||
temp = 0.7
|
|
||||||
|
|
||||||
# 记忆模型配置
|
|
||||||
[models.memory]
|
|
||||||
name = "qwen3-8b"
|
|
||||||
provider = "BAILIAN"
|
|
||||||
pri_in = 0.5
|
|
||||||
pri_out = 2
|
|
||||||
temp = 0.7
|
|
||||||
|
|
||||||
# 工具使用模型配置
|
|
||||||
[models.tool_use]
|
|
||||||
name = "qwen3-8b"
|
|
||||||
provider = "BAILIAN"
|
|
||||||
pri_in = 0.5
|
|
||||||
pri_out = 2
|
|
||||||
temp = 0.7
|
|
||||||
|
|
||||||
# 嵌入模型配置
|
|
||||||
[models.embedding]
|
|
||||||
name = "text-embedding-v1"
|
|
||||||
provider = "OPENAI"
|
|
||||||
dimension = 1024
|
|
||||||
|
|
||||||
# 视觉语言模型配置
|
|
||||||
[models.vlm]
|
|
||||||
name = "qwen-vl-plus"
|
|
||||||
provider = "BAILIAN"
|
|
||||||
pri_in = 0.5
|
|
||||||
pri_out = 2
|
|
||||||
temp = 0.7
|
|
||||||
|
|
||||||
# 知识库模型配置
|
|
||||||
[models.knowledge]
|
|
||||||
name = "qwen3-8b"
|
|
||||||
provider = "BAILIAN"
|
|
||||||
pri_in = 0.5
|
|
||||||
pri_out = 2
|
|
||||||
temp = 0.7
|
|
||||||
|
|
||||||
# 实体提取模型配置
|
|
||||||
[models.entity_extract]
|
|
||||||
name = "qwen3-8b"
|
|
||||||
provider = "BAILIAN"
|
|
||||||
pri_in = 0.5
|
|
||||||
pri_out = 2
|
|
||||||
temp = 0.7
|
|
||||||
|
|
||||||
# 问答模型配置
|
|
||||||
[models.qa]
|
|
||||||
name = "qwen3-8b"
|
|
||||||
provider = "BAILIAN"
|
|
||||||
pri_in = 0.5
|
|
||||||
pri_out = 2
|
|
||||||
temp = 0.7
|
|
||||||
|
|
||||||
# 兼容性配置(已废弃,请使用models.motion)
|
|
||||||
[model_motion] # 在麦麦的一些组件中使用的小模型,消耗量较大,建议使用速度较快的小模型
|
|
||||||
# 强烈建议使用免费的小模型
|
|
||||||
name = "qwen3-8b"
|
|
||||||
provider = "BAILIAN"
|
|
||||||
pri_in = 0.5
|
|
||||||
pri_out = 2
|
|
||||||
temp = 0.7
|
|
||||||
enable_thinking = false # 是否启用思考
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
[inner]
|
[inner]
|
||||||
version = "1.1.0"
|
version = "1.2.0"
|
||||||
|
|
||||||
#----以下是S4U聊天系统配置文件----
|
#----以下是S4U聊天系统配置文件----
|
||||||
# S4U (Smart 4 U) 聊天系统是MaiBot的核心对话模块
|
# S4U (Smart 4 U) 聊天系统是MaiBot的核心对话模块
|
||||||
@@ -12,6 +12,7 @@ version = "1.1.0"
|
|||||||
#----S4U配置说明结束----
|
#----S4U配置说明结束----
|
||||||
|
|
||||||
[s4u]
|
[s4u]
|
||||||
|
enable_s4u = false
|
||||||
# 消息管理配置
|
# 消息管理配置
|
||||||
message_timeout_seconds = 120 # 普通消息存活时间(秒),超过此时间的消息将被丢弃
|
message_timeout_seconds = 120 # 普通消息存活时间(秒),超过此时间的消息将被丢弃
|
||||||
recent_message_keep_count = 6 # 保留最近N条消息,超出范围的普通消息将被移除
|
recent_message_keep_count = 6 # 保留最近N条消息,超出范围的普通消息将被移除
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
ENABLE_S4U = True
|
|
||||||
@@ -19,7 +19,6 @@ from src.mais4u.s4u_config import s4u_config
|
|||||||
from src.person_info.person_info import get_person_id
|
from src.person_info.person_info import get_person_id
|
||||||
from .super_chat_manager import get_super_chat_manager
|
from .super_chat_manager import get_super_chat_manager
|
||||||
from .yes_or_no import yes_or_no_head
|
from .yes_or_no import yes_or_no_head
|
||||||
from src.mais4u.constant_s4u import ENABLE_S4U
|
|
||||||
|
|
||||||
logger = get_logger("S4U_chat")
|
logger = get_logger("S4U_chat")
|
||||||
|
|
||||||
@@ -166,7 +165,7 @@ class S4UChatManager:
|
|||||||
return self.s4u_chats[chat_stream.stream_id]
|
return self.s4u_chats[chat_stream.stream_id]
|
||||||
|
|
||||||
|
|
||||||
if not ENABLE_S4U:
|
if not s4u_config.enable_s4u:
|
||||||
s4u_chat_manager = None
|
s4u_chat_manager = None
|
||||||
else:
|
else:
|
||||||
s4u_chat_manager = S4UChatManager()
|
s4u_chat_manager = S4UChatManager()
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ from src.config.config import global_config, model_config
|
|||||||
from src.chat.utils.prompt_builder import Prompt, global_prompt_manager
|
from src.chat.utils.prompt_builder import Prompt, global_prompt_manager
|
||||||
from src.manager.async_task_manager import AsyncTask, async_task_manager
|
from src.manager.async_task_manager import AsyncTask, async_task_manager
|
||||||
from src.plugin_system.apis import send_api
|
from src.plugin_system.apis import send_api
|
||||||
from src.mais4u.constant_s4u import ENABLE_S4U
|
from src.mais4u.s4u_config import s4u_config
|
||||||
|
|
||||||
"""
|
"""
|
||||||
情绪管理系统使用说明:
|
情绪管理系统使用说明:
|
||||||
@@ -447,7 +447,7 @@ class MoodManager:
|
|||||||
asyncio.create_task(new_mood.send_emotion_update(new_mood.mood_values))
|
asyncio.create_task(new_mood.send_emotion_update(new_mood.mood_values))
|
||||||
|
|
||||||
|
|
||||||
if ENABLE_S4U:
|
if s4u_config.enable_s4u:
|
||||||
init_prompt()
|
init_prompt()
|
||||||
mood_manager = MoodManager()
|
mood_manager = MoodManager()
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ from typing import Dict, List, Optional
|
|||||||
from src.common.logger import get_logger
|
from src.common.logger import get_logger
|
||||||
from src.chat.message_receive.message import MessageRecvS4U
|
from src.chat.message_receive.message import MessageRecvS4U
|
||||||
# 全局SuperChat管理器实例
|
# 全局SuperChat管理器实例
|
||||||
from src.mais4u.constant_s4u import ENABLE_S4U
|
from src.mais4u.s4u_config import s4u_config
|
||||||
|
|
||||||
logger = get_logger("super_chat_manager")
|
logger = get_logger("super_chat_manager")
|
||||||
|
|
||||||
@@ -299,7 +299,7 @@ class SuperChatManager:
|
|||||||
|
|
||||||
|
|
||||||
# sourcery skip: assign-if-exp
|
# sourcery skip: assign-if-exp
|
||||||
if ENABLE_S4U:
|
if s4u_config.enable_s4u:
|
||||||
super_chat_manager = SuperChatManager()
|
super_chat_manager = SuperChatManager()
|
||||||
else:
|
else:
|
||||||
super_chat_manager = None
|
super_chat_manager = None
|
||||||
|
|||||||
@@ -191,6 +191,9 @@ class S4UModelConfig(S4UConfigBase):
|
|||||||
@dataclass
|
@dataclass
|
||||||
class S4UConfig(S4UConfigBase):
|
class S4UConfig(S4UConfigBase):
|
||||||
"""S4U聊天系统配置类"""
|
"""S4U聊天系统配置类"""
|
||||||
|
|
||||||
|
enable_s4u: bool = False
|
||||||
|
"""是否启用S4U聊天系统"""
|
||||||
|
|
||||||
message_timeout_seconds: int = 120
|
message_timeout_seconds: int = 120
|
||||||
"""普通消息存活时间(秒),超过此时间的消息将被丢弃"""
|
"""普通消息存活时间(秒),超过此时间的消息将被丢弃"""
|
||||||
@@ -353,16 +356,12 @@ def load_s4u_config(config_path: str) -> S4UGlobalConfig:
|
|||||||
raise e
|
raise e
|
||||||
|
|
||||||
|
|
||||||
if not ENABLE_S4U:
|
|
||||||
s4u_config = None
|
|
||||||
s4u_config_main = None
|
|
||||||
else:
|
|
||||||
# 初始化S4U配置
|
# 初始化S4U配置
|
||||||
logger.info(f"S4U当前版本: {S4U_VERSION}")
|
logger.info(f"S4U当前版本: {S4U_VERSION}")
|
||||||
update_s4u_config()
|
update_s4u_config()
|
||||||
|
|
||||||
logger.info("正在加载S4U配置文件...")
|
s4u_config_main = load_s4u_config(config_path=CONFIG_PATH)
|
||||||
s4u_config_main = load_s4u_config(config_path=CONFIG_PATH)
|
logger.info("S4U配置文件加载完成!")
|
||||||
logger.info("S4U配置文件加载完成!")
|
|
||||||
|
|
||||||
s4u_config: S4UConfig = s4u_config_main.s4u
|
s4u_config: S4UConfig = s4u_config_main.s4u
|
||||||
Reference in New Issue
Block a user