Merge branch 'dev' of https://github.com/MoFox-Studio/MoFox_Bot into dev
This commit is contained in:
@@ -1468,18 +1468,15 @@ class DefaultReplyer:
|
|||||||
if now < start_time:
|
if now < start_time:
|
||||||
now += timedelta(days=1)
|
now += timedelta(days=1)
|
||||||
|
|
||||||
if start_time <= now < end_time:
|
duration_minutes = (now - start_time).total_seconds() / 60
|
||||||
duration_minutes = (now - start_time).total_seconds() / 60
|
remaining_minutes = (end_time - now).total_seconds() / 60
|
||||||
remaining_minutes = (end_time - now).total_seconds() / 60
|
schedule_block = (
|
||||||
schedule_block = (
|
|
||||||
f"你当前正在进行“{activity}”,"
|
f"你当前正在进行“{activity}”,"
|
||||||
f"计划时间从{start_time.strftime('%H:%M')}到{end_time.strftime('%H:%M')}。"
|
f"计划时间从{start_time.strftime('%H:%M')}到{end_time.strftime('%H:%M')}。"
|
||||||
f"这项活动已经开始了{duration_minutes:.0f}分钟,"
|
f"这项活动已经开始了{duration_minutes:.0f}分钟,"
|
||||||
f"预计还有{remaining_minutes:.0f}分钟结束。"
|
f"预计还有{remaining_minutes:.0f}分钟结束。"
|
||||||
"(此为你的当前状态,仅供参考。除非被直接询问,否则不要在对话中主动提及。)"
|
"(此为你的当前状态,仅供参考。除非被直接询问,否则不要在对话中主动提及。)"
|
||||||
)
|
)
|
||||||
else:
|
|
||||||
schedule_block = f"你当前正在进行“{activity}”。(此为你的当前状态,仅供参考。除非被直接询问,否则不要在对话中主动提及。)"
|
|
||||||
|
|
||||||
except (ValueError, AttributeError):
|
except (ValueError, AttributeError):
|
||||||
schedule_block = f"你当前正在进行“{activity}”。(此为你的当前状态,仅供参考。除非被直接询问,否则不要在对话中主动提及。)"
|
schedule_block = f"你当前正在进行“{activity}”。(此为你的当前状态,仅供参考。除非被直接询问,否则不要在对话中主动提及。)"
|
||||||
|
|||||||
@@ -350,10 +350,10 @@ def _default_normal_response_parser(
|
|||||||
api_response.tool_calls = []
|
api_response.tool_calls = []
|
||||||
for call in message_part.tool_calls:
|
for call in message_part.tool_calls:
|
||||||
try:
|
try:
|
||||||
arguments = orjson.loads(repair_json(call.function.arguments))
|
arguments = orjson.loads(repair_json(call.function.arguments)) # type: ignore
|
||||||
if not isinstance(arguments, dict):
|
if not isinstance(arguments, dict):
|
||||||
raise RespParseException(resp, "响应解析失败,工具调用参数无法解析为字典类型")
|
raise RespParseException(resp, "响应解析失败,工具调用参数无法解析为字典类型")
|
||||||
api_response.tool_calls.append(ToolCall(call.id, call.function.name, arguments))
|
api_response.tool_calls.append(ToolCall(call.id, call.function.name, arguments)) # type: ignore
|
||||||
except orjson.JSONDecodeError as e:
|
except orjson.JSONDecodeError as e:
|
||||||
raise RespParseException(resp, "响应解析失败,无法解析工具调用参数") from e
|
raise RespParseException(resp, "响应解析失败,无法解析工具调用参数") from e
|
||||||
|
|
||||||
|
|||||||
20
src/main.py
20
src/main.py
@@ -218,14 +218,6 @@ class MainSystem:
|
|||||||
|
|
||||||
cleanup_tasks = []
|
cleanup_tasks = []
|
||||||
|
|
||||||
# 停止数据库服务
|
|
||||||
try:
|
|
||||||
from src.common.database.core import close_engine as stop_database
|
|
||||||
|
|
||||||
cleanup_tasks.append(("数据库服务", stop_database()))
|
|
||||||
except Exception as e:
|
|
||||||
logger.error(f"准备停止数据库服务时出错: {e}")
|
|
||||||
|
|
||||||
# 停止消息批处理器
|
# 停止消息批处理器
|
||||||
try:
|
try:
|
||||||
from src.chat.message_receive.storage import get_message_storage_batcher, get_message_update_batcher
|
from src.chat.message_receive.storage import get_message_storage_batcher, get_message_update_batcher
|
||||||
@@ -329,6 +321,18 @@ class MainSystem:
|
|||||||
else:
|
else:
|
||||||
logger.warning("没有需要清理的任务")
|
logger.warning("没有需要清理的任务")
|
||||||
|
|
||||||
|
# 停止数据库服务 (在所有其他任务完成后最后停止)
|
||||||
|
try:
|
||||||
|
from src.common.database.core import close_engine as stop_database
|
||||||
|
|
||||||
|
logger.info("正在停止数据库服务...")
|
||||||
|
await asyncio.wait_for(stop_database(), timeout=15.0)
|
||||||
|
logger.info("🛑 数据库服务已停止")
|
||||||
|
except asyncio.TimeoutError:
|
||||||
|
logger.error("停止数据库服务超时")
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"停止数据库服务时出错: {e}")
|
||||||
|
|
||||||
def _cleanup(self) -> None:
|
def _cleanup(self) -> None:
|
||||||
"""同步清理资源(向后兼容)"""
|
"""同步清理资源(向后兼容)"""
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
[inner]
|
[inner]
|
||||||
version = "1.3.6"
|
version = "1.3.7"
|
||||||
|
|
||||||
# 配置文件版本号迭代规则同bot_config.toml
|
# 配置文件版本号迭代规则同bot_config.toml
|
||||||
|
|
||||||
@@ -53,8 +53,8 @@ price_out = 8.0 # 输出价格(用于API调用统计,单
|
|||||||
#use_anti_truncation = true # [可选] 启用反截断功能。当模型输出不完整时,系统会自动重试。建议只为有需要的模型(如Gemini)开启。
|
#use_anti_truncation = true # [可选] 启用反截断功能。当模型输出不完整时,系统会自动重试。建议只为有需要的模型(如Gemini)开启。
|
||||||
|
|
||||||
[[models]]
|
[[models]]
|
||||||
model_identifier = "deepseek-ai/DeepSeek-V3.1-Terminus"
|
model_identifier = "deepseek-ai/DeepSeek-V3.2-Exp"
|
||||||
name = "siliconflow-deepseek-ai/DeepSeek-V3.1-Terminus"
|
name = "siliconflow-deepseek-ai/DeepSeek-V3.2-Exp"
|
||||||
api_provider = "SiliconFlow"
|
api_provider = "SiliconFlow"
|
||||||
price_in = 2.0
|
price_in = 2.0
|
||||||
price_out = 8.0
|
price_out = 8.0
|
||||||
@@ -122,7 +122,7 @@ price_in = 4.0
|
|||||||
price_out = 16.0
|
price_out = 16.0
|
||||||
|
|
||||||
[model_task_config.utils] # 在麦麦的一些组件中使用的模型,例如表情包模块,取名模块,关系模块,是麦麦必须的模型
|
[model_task_config.utils] # 在麦麦的一些组件中使用的模型,例如表情包模块,取名模块,关系模块,是麦麦必须的模型
|
||||||
model_list = ["siliconflow-deepseek-ai/DeepSeek-V3.1-Terminus"] # 使用的模型列表,每个子项对应上面的模型名称(name)
|
model_list = ["siliconflow-deepseek-ai/DeepSeek-V3.2-Exp"] # 使用的模型列表,每个子项对应上面的模型名称(name)
|
||||||
temperature = 0.2 # 模型温度,新V3建议0.1-0.3
|
temperature = 0.2 # 模型温度,新V3建议0.1-0.3
|
||||||
max_tokens = 800 # 最大输出token数
|
max_tokens = 800 # 最大输出token数
|
||||||
#concurrency_count = 2 # 并发请求数量,默认为1(不并发),设置为2或更高启用并发
|
#concurrency_count = 2 # 并发请求数量,默认为1(不并发),设置为2或更高启用并发
|
||||||
@@ -133,28 +133,28 @@ temperature = 0.7
|
|||||||
max_tokens = 800
|
max_tokens = 800
|
||||||
|
|
||||||
[model_task_config.replyer] # 首要回复模型,还用于表达器和表达方式学习
|
[model_task_config.replyer] # 首要回复模型,还用于表达器和表达方式学习
|
||||||
model_list = ["siliconflow-deepseek-ai/DeepSeek-V3.1-Terminus"]
|
model_list = ["siliconflow-deepseek-ai/DeepSeek-V3.2-Exp"]
|
||||||
temperature = 0.2 # 模型温度,新V3建议0.1-0.3
|
temperature = 0.2 # 模型温度,新V3建议0.1-0.3
|
||||||
max_tokens = 800
|
max_tokens = 800
|
||||||
|
|
||||||
[model_task_config.planner] #决策:负责决定麦麦该做什么的模型
|
[model_task_config.planner] #决策:负责决定麦麦该做什么的模型
|
||||||
model_list = ["siliconflow-deepseek-ai/DeepSeek-V3.1-Terminus"]
|
model_list = ["siliconflow-deepseek-ai/DeepSeek-V3.2-Exp"]
|
||||||
temperature = 0.3
|
temperature = 0.3
|
||||||
max_tokens = 800
|
max_tokens = 800
|
||||||
|
|
||||||
|
|
||||||
[model_task_config.emotion] #负责麦麦的情绪变化
|
[model_task_config.emotion] #负责麦麦的情绪变化
|
||||||
model_list = ["siliconflow-deepseek-ai/DeepSeek-V3.1-Terminus"]
|
model_list = ["siliconflow-deepseek-ai/DeepSeek-V3.2-Exp"]
|
||||||
temperature = 0.3
|
temperature = 0.3
|
||||||
max_tokens = 800
|
max_tokens = 800
|
||||||
|
|
||||||
[model_task_config.mood] #负责麦麦的心情变化
|
[model_task_config.mood] #负责麦麦的心情变化
|
||||||
model_list = ["siliconflow-deepseek-ai/DeepSeek-V3.1-Terminus"]
|
model_list = ["siliconflow-deepseek-ai/DeepSeek-V3.2-Exp"]
|
||||||
temperature = 0.3
|
temperature = 0.3
|
||||||
max_tokens = 800
|
max_tokens = 800
|
||||||
|
|
||||||
[model_task_config.maizone] # maizone模型
|
[model_task_config.maizone] # maizone模型
|
||||||
model_list = ["siliconflow-deepseek-ai/DeepSeek-V3.1-Terminus"]
|
model_list = ["siliconflow-deepseek-ai/DeepSeek-V3.2-Exp"]
|
||||||
temperature = 0.7
|
temperature = 0.7
|
||||||
max_tokens = 800
|
max_tokens = 800
|
||||||
|
|
||||||
@@ -181,22 +181,22 @@ temperature = 0.7
|
|||||||
max_tokens = 800
|
max_tokens = 800
|
||||||
|
|
||||||
[model_task_config.schedule_generator]#日程表生成模型
|
[model_task_config.schedule_generator]#日程表生成模型
|
||||||
model_list = ["siliconflow-deepseek-ai/DeepSeek-V3.1-Terminus"]
|
model_list = ["siliconflow-deepseek-ai/DeepSeek-V3.2-Exp"]
|
||||||
temperature = 0.7
|
temperature = 0.7
|
||||||
max_tokens = 1000
|
max_tokens = 1000
|
||||||
|
|
||||||
[model_task_config.anti_injection] # 反注入检测专用模型
|
[model_task_config.anti_injection] # 反注入检测专用模型
|
||||||
model_list = ["moonshotai-Kimi-K2-Instruct"] # 使用快速的小模型进行检测
|
model_list = ["siliconflow-deepseek-ai/DeepSeek-V3.2-Exp"] # 使用快速的小模型进行检测
|
||||||
temperature = 0.1 # 低温度确保检测结果稳定
|
temperature = 0.1 # 低温度确保检测结果稳定
|
||||||
max_tokens = 200 # 检测结果不需要太长的输出
|
max_tokens = 200 # 检测结果不需要太长的输出
|
||||||
|
|
||||||
[model_task_config.monthly_plan_generator] # 月层计划生成模型
|
[model_task_config.monthly_plan_generator] # 月层计划生成模型
|
||||||
model_list = ["siliconflow-deepseek-ai/DeepSeek-V3.1-Terminus"]
|
model_list = ["siliconflow-deepseek-ai/DeepSeek-V3.2-Exp"]
|
||||||
temperature = 0.7
|
temperature = 0.7
|
||||||
max_tokens = 1000
|
max_tokens = 1000
|
||||||
|
|
||||||
[model_task_config.relationship_tracker] # 用户关系追踪模型
|
[model_task_config.relationship_tracker] # 用户关系追踪模型
|
||||||
model_list = ["siliconflow-deepseek-ai/DeepSeek-V3.1-Terminus"]
|
model_list = ["siliconflow-deepseek-ai/DeepSeek-V3.2-Exp"]
|
||||||
temperature = 0.7
|
temperature = 0.7
|
||||||
max_tokens = 1000
|
max_tokens = 1000
|
||||||
|
|
||||||
@@ -210,12 +210,12 @@ embedding_dimension = 1024
|
|||||||
#------------LPMM知识库模型------------
|
#------------LPMM知识库模型------------
|
||||||
|
|
||||||
[model_task_config.lpmm_entity_extract] # 实体提取模型
|
[model_task_config.lpmm_entity_extract] # 实体提取模型
|
||||||
model_list = ["siliconflow-deepseek-ai/DeepSeek-V3.1-Terminus"]
|
model_list = ["siliconflow-deepseek-ai/DeepSeek-V3.2-Exp"]
|
||||||
temperature = 0.2
|
temperature = 0.2
|
||||||
max_tokens = 800
|
max_tokens = 800
|
||||||
|
|
||||||
[model_task_config.lpmm_rdf_build] # RDF构建模型
|
[model_task_config.lpmm_rdf_build] # RDF构建模型
|
||||||
model_list = ["siliconflow-deepseek-ai/DeepSeek-V3.1-Terminus"]
|
model_list = ["siliconflow-deepseek-ai/DeepSeek-V3.2-Exp"]
|
||||||
temperature = 0.2
|
temperature = 0.2
|
||||||
max_tokens = 800
|
max_tokens = 800
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user