fix(core): 优化应用关闭流程,确保数据库最后关闭
将数据库服务的停止操作移至所有清理任务执行完毕后,以防止其他组件在关闭时因无法访问数据库而产生异常。 此外,为数据库关闭操作增加了超时处理,增强了系统关闭时的健壮性。 - chore(config): 将模板配置文件中的默认模型由 DeepSeek-V3.1 全面升级至 DeepSeek-V3.2-Exp,以提升默认性能。
This commit is contained in:
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