better:进一步拆分模型配置
This commit is contained in:
@@ -374,7 +374,7 @@ class EmojiManager:
|
|||||||
|
|
||||||
self.vlm = LLMRequest(model=global_config.model.vlm, temperature=0.3, max_tokens=1000, request_type="emoji")
|
self.vlm = LLMRequest(model=global_config.model.vlm, temperature=0.3, max_tokens=1000, request_type="emoji")
|
||||||
self.llm_emotion_judge = LLMRequest(
|
self.llm_emotion_judge = LLMRequest(
|
||||||
model=global_config.model.normal, max_tokens=600, request_type="emoji"
|
model=global_config.model.utils, max_tokens=600, request_type="emoji"
|
||||||
) # 更高的温度,更少的token(后续可以根据情绪来调整温度)
|
) # 更高的温度,更少的token(后续可以根据情绪来调整温度)
|
||||||
|
|
||||||
self.emoji_num = 0
|
self.emoji_num = 0
|
||||||
|
|||||||
@@ -192,9 +192,9 @@ class DefaultExpressor:
|
|||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
# 1. 获取情绪影响因子并调整模型温度
|
# 1. 获取情绪影响因子并调整模型温度
|
||||||
arousal_multiplier = mood_manager.get_arousal_multiplier()
|
# arousal_multiplier = mood_manager.get_arousal_multiplier()
|
||||||
current_temp = float(global_config.model.normal["temp"]) * arousal_multiplier
|
# current_temp = float(global_config.model.normal["temp"]) * arousal_multiplier
|
||||||
self.express_model.params["temperature"] = current_temp # 动态调整温度
|
# self.express_model.params["temperature"] = current_temp # 动态调整温度
|
||||||
|
|
||||||
# 2. 获取信息捕捉器
|
# 2. 获取信息捕捉器
|
||||||
info_catcher = info_catcher_manager.get_info_catcher(thinking_id)
|
info_catcher = info_catcher_manager.get_info_catcher(thinking_id)
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class ChattingInfoProcessor(BaseProcessor):
|
|||||||
super().__init__()
|
super().__init__()
|
||||||
# TODO: API-Adapter修改标记
|
# TODO: API-Adapter修改标记
|
||||||
self.model_summary = LLMRequest(
|
self.model_summary = LLMRequest(
|
||||||
model=global_config.model.observation, temperature=0.7, max_tokens=300, request_type="chat_observation"
|
model=global_config.model.utils_small, temperature=0.7, max_tokens=300, request_type="chat_observation"
|
||||||
)
|
)
|
||||||
|
|
||||||
async def process_info(
|
async def process_info(
|
||||||
|
|||||||
@@ -20,13 +20,13 @@ class NormalChatGenerator:
|
|||||||
model=global_config.model.normal_chat_1,
|
model=global_config.model.normal_chat_1,
|
||||||
temperature=0.7,
|
temperature=0.7,
|
||||||
max_tokens=3000,
|
max_tokens=3000,
|
||||||
request_type="response_reasoning",
|
request_type="normal_chat_1",
|
||||||
)
|
)
|
||||||
self.model_normal = LLMRequest(
|
self.model_normal = LLMRequest(
|
||||||
model=global_config.model.normal,
|
model=global_config.model.normal_chat_2,
|
||||||
temperature=global_config.model.normal["temp"],
|
temperature=global_config.model.normal_chat_2["temp"],
|
||||||
max_tokens=256,
|
max_tokens=256,
|
||||||
request_type="response_reasoning",
|
request_type="normal_chat_2",
|
||||||
)
|
)
|
||||||
|
|
||||||
self.model_sum = LLMRequest(
|
self.model_sum = LLMRequest(
|
||||||
|
|||||||
@@ -378,11 +378,18 @@ class ModelConfig(ConfigBase):
|
|||||||
|
|
||||||
model_max_output_length: int = 800 # 最大回复长度
|
model_max_output_length: int = 800 # 最大回复长度
|
||||||
|
|
||||||
reasoning: dict[str, Any] = field(default_factory=lambda: {})
|
|
||||||
"""推理模型配置"""
|
|
||||||
|
|
||||||
normal: dict[str, Any] = field(default_factory=lambda: {})
|
utils: dict[str, Any] = field(default_factory=lambda: {})
|
||||||
"""普通模型配置"""
|
"""组件模型配置"""
|
||||||
|
|
||||||
|
utils_small: dict[str, Any] = field(default_factory=lambda: {})
|
||||||
|
"""组件小模型配置"""
|
||||||
|
|
||||||
|
normal_chat_1: dict[str, Any] = field(default_factory=lambda: {})
|
||||||
|
"""normal_chat首要回复模型模型配置"""
|
||||||
|
|
||||||
|
normal_chat_2: dict[str, Any] = field(default_factory=lambda: {})
|
||||||
|
"""normal_chat次要回复模型配置"""
|
||||||
|
|
||||||
memory_summary: dict[str, Any] = field(default_factory=lambda: {})
|
memory_summary: dict[str, Any] = field(default_factory=lambda: {})
|
||||||
"""记忆的概括模型配置"""
|
"""记忆的概括模型配置"""
|
||||||
@@ -390,9 +397,6 @@ class ModelConfig(ConfigBase):
|
|||||||
vlm: dict[str, Any] = field(default_factory=lambda: {})
|
vlm: dict[str, Any] = field(default_factory=lambda: {})
|
||||||
"""视觉语言模型配置"""
|
"""视觉语言模型配置"""
|
||||||
|
|
||||||
observation: dict[str, Any] = field(default_factory=lambda: {})
|
|
||||||
"""观察模型配置"""
|
|
||||||
|
|
||||||
focus_working_memory: dict[str, Any] = field(default_factory=lambda: {})
|
focus_working_memory: dict[str, Any] = field(default_factory=lambda: {})
|
||||||
"""专注工作记忆模型配置"""
|
"""专注工作记忆模型配置"""
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class GoalAnalyzer:
|
|||||||
def __init__(self, stream_id: str, private_name: str):
|
def __init__(self, stream_id: str, private_name: str):
|
||||||
# TODO: API-Adapter修改标记
|
# TODO: API-Adapter修改标记
|
||||||
self.llm = LLMRequest(
|
self.llm = LLMRequest(
|
||||||
model=global_config.model.normal, temperature=0.7, max_tokens=1000, request_type="conversation_goal"
|
model=global_config.model.utils, temperature=0.7, max_tokens=1000, request_type="conversation_goal"
|
||||||
)
|
)
|
||||||
|
|
||||||
self.personality_info = individuality.get_prompt(x_person=2, level=3)
|
self.personality_info = individuality.get_prompt(x_person=2, level=3)
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ class KnowledgeFetcher:
|
|||||||
def __init__(self, private_name: str):
|
def __init__(self, private_name: str):
|
||||||
# TODO: API-Adapter修改标记
|
# TODO: API-Adapter修改标记
|
||||||
self.llm = LLMRequest(
|
self.llm = LLMRequest(
|
||||||
model=global_config.model.normal,
|
model=global_config.model.utils,
|
||||||
temperature=global_config.model.normal["temp"],
|
temperature=global_config.model.utils["temp"],
|
||||||
max_tokens=1000,
|
max_tokens=1000,
|
||||||
request_type="knowledge_fetch",
|
request_type="knowledge_fetch",
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -497,8 +497,8 @@ class LLMRequest:
|
|||||||
logger.warning(f"检测到403错误,模型从 {old_model_name} 降级为 {self.model_name}")
|
logger.warning(f"检测到403错误,模型从 {old_model_name} 降级为 {self.model_name}")
|
||||||
|
|
||||||
# 对全局配置进行更新
|
# 对全局配置进行更新
|
||||||
if global_config.model.normal.get("name") == old_model_name:
|
if global_config.model.normal_chat_2.get("name") == old_model_name:
|
||||||
global_config.model.normal["name"] = self.model_name
|
global_config.model.normal_chat_2["name"] = self.model_name
|
||||||
logger.warning(f"将全局配置中的 llm_normal 模型临时降级至{self.model_name}")
|
logger.warning(f"将全局配置中的 llm_normal 模型临时降级至{self.model_name}")
|
||||||
if global_config.model.normal_chat_1.get("name") == old_model_name:
|
if global_config.model.normal_chat_1.get("name") == old_model_name:
|
||||||
global_config.model.normal_chat_1["name"] = self.model_name
|
global_config.model.normal_chat_1["name"] = self.model_name
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ class PersonInfoManager:
|
|||||||
self.person_name_list = {}
|
self.person_name_list = {}
|
||||||
# TODO: API-Adapter修改标记
|
# TODO: API-Adapter修改标记
|
||||||
self.qv_name_llm = LLMRequest(
|
self.qv_name_llm = LLMRequest(
|
||||||
model=global_config.model.normal,
|
model=global_config.model.utils,
|
||||||
max_tokens=256,
|
max_tokens=256,
|
||||||
request_type="qv_name",
|
request_type="qv_name",
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ mood_update_interval = 1.0 # 情绪更新间隔 单位秒
|
|||||||
mood_decay_rate = 0.95 # 情绪衰减率
|
mood_decay_rate = 0.95 # 情绪衰减率
|
||||||
mood_intensity_factor = 1.0 # 情绪强度因子
|
mood_intensity_factor = 1.0 # 情绪强度因子
|
||||||
|
|
||||||
[keyword_reaction] # 针对某个关键词作出反应
|
[keyword_reaction] # 针对某个关键词作出反应,仅在 普通聊天 有效
|
||||||
enable = true # 关键词反应功能的总开关
|
enable = true # 关键词反应功能的总开关
|
||||||
|
|
||||||
[[keyword_reaction.rules]] # 如果想要新增多个关键词,直接复制本条,修改keywords和reaction即可
|
[[keyword_reaction.rules]] # 如果想要新增多个关键词,直接复制本条,修改keywords和reaction即可
|
||||||
@@ -181,10 +181,9 @@ enable = true
|
|||||||
|
|
||||||
[experimental] #实验性功能
|
[experimental] #实验性功能
|
||||||
enable_friend_chat = false # 是否启用好友聊天
|
enable_friend_chat = false # 是否启用好友聊天
|
||||||
pfc_chatting = false # 是否启用PFC聊天,该功能仅作用于私聊,与回复模式独立
|
pfc_chatting = false # 是否启用PFC聊天,该功能仅作用于私聊,与回复模式独立,在0.7.0暂时无效
|
||||||
|
|
||||||
#下面的模型若使用硅基流动则不需要更改,使用ds官方则改成.env自定义的宏,使用自定义模型则选择定位相似的模型自己填写
|
#下面的模型若使用硅基流动则不需要更改,使用ds官方则改成.env自定义的宏,使用自定义模型则选择定位相似的模型自己填写
|
||||||
#推理模型
|
|
||||||
|
|
||||||
# 额外字段
|
# 额外字段
|
||||||
# 下面的模型有以下额外字段可以添加:
|
# 下面的模型有以下额外字段可以添加:
|
||||||
@@ -195,14 +194,9 @@ pfc_chatting = false # 是否启用PFC聊天,该功能仅作用于私聊,与
|
|||||||
[model]
|
[model]
|
||||||
model_max_output_length = 800 # 模型单次返回的最大token数
|
model_max_output_length = 800 # 模型单次返回的最大token数
|
||||||
|
|
||||||
#这个模型必须是推理模型
|
#------------必填:组件模型------------
|
||||||
[model.normal_chat_1] # 一般聊天模式的首要回复模型,推荐使用 推理模型
|
|
||||||
name = "Pro/deepseek-ai/DeepSeek-R1"
|
|
||||||
provider = "SILICONFLOW"
|
|
||||||
pri_in = 1.0 #模型的输入价格(非必填,可以记录消耗)
|
|
||||||
pri_out = 4.0 #模型的输出价格(非必填,可以记录消耗)
|
|
||||||
|
|
||||||
[model.normal] #V3 回复模型 专注和一般聊天模式共用的回复模型
|
[model.utils] # 在麦麦的一些组件中使用的模型,例如表情包模块,取名模块,消耗量不大
|
||||||
name = "Pro/deepseek-ai/DeepSeek-V3"
|
name = "Pro/deepseek-ai/DeepSeek-V3"
|
||||||
provider = "SILICONFLOW"
|
provider = "SILICONFLOW"
|
||||||
pri_in = 2 #模型的输入价格(非必填,可以记录消耗)
|
pri_in = 2 #模型的输入价格(非必填,可以记录消耗)
|
||||||
@@ -210,6 +204,13 @@ pri_out = 8 #模型的输出价格(非必填,可以记录消耗)
|
|||||||
#默认temp 0.2 如果你使用的是老V3或者其他模型,请自己修改temp参数
|
#默认temp 0.2 如果你使用的是老V3或者其他模型,请自己修改temp参数
|
||||||
temp = 0.2 #模型的温度,新V3建议0.1-0.3
|
temp = 0.2 #模型的温度,新V3建议0.1-0.3
|
||||||
|
|
||||||
|
[model.utils_small] # 在麦麦的一些组件中使用的小模型,消耗量较大
|
||||||
|
# 强烈建议使用免费的小模型
|
||||||
|
name = "Qwen/Qwen2.5-7B-Instruct"
|
||||||
|
provider = "SILICONFLOW"
|
||||||
|
pri_in = 0
|
||||||
|
pri_out = 0
|
||||||
|
|
||||||
[model.memory_summary] # 记忆的概括模型,建议使用qwen2.5 32b 及以上
|
[model.memory_summary] # 记忆的概括模型,建议使用qwen2.5 32b 及以上
|
||||||
name = "Qwen/Qwen2.5-32B-Instruct"
|
name = "Qwen/Qwen2.5-32B-Instruct"
|
||||||
provider = "SILICONFLOW"
|
provider = "SILICONFLOW"
|
||||||
@@ -222,15 +223,32 @@ provider = "SILICONFLOW"
|
|||||||
pri_in = 0.35
|
pri_in = 0.35
|
||||||
pri_out = 0.35
|
pri_out = 0.35
|
||||||
|
|
||||||
[model.observation] #观察模型,压缩聊天内容,建议用免费的
|
#嵌入模型
|
||||||
# name = "Pro/Qwen/Qwen2.5-7B-Instruct"
|
[model.embedding]
|
||||||
name = "Qwen/Qwen2.5-7B-Instruct"
|
name = "BAAI/bge-m3"
|
||||||
provider = "SILICONFLOW"
|
provider = "SILICONFLOW"
|
||||||
pri_in = 0
|
pri_in = 0
|
||||||
pri_out = 0
|
pri_out = 0
|
||||||
|
|
||||||
[model.focus_working_memory] #工作记忆模型,建议使用qwen2.5 32b
|
#------------普通聊天必填模型------------
|
||||||
# name = "Pro/Qwen/Qwen2.5-7B-Instruct"
|
|
||||||
|
[model.normal_chat_1] # 一般聊天模式的首要回复模型,推荐使用 推理模型
|
||||||
|
name = "Pro/deepseek-ai/DeepSeek-R1"
|
||||||
|
provider = "SILICONFLOW"
|
||||||
|
pri_in = 1.0 #模型的输入价格(非必填,可以记录消耗)
|
||||||
|
pri_out = 4.0 #模型的输出价格(非必填,可以记录消耗)
|
||||||
|
|
||||||
|
[model.normal_chat_2] # 一般聊天模式的次要回复模型,推荐使用 非推理模型
|
||||||
|
name = "Pro/deepseek-ai/DeepSeek-V3"
|
||||||
|
provider = "SILICONFLOW"
|
||||||
|
pri_in = 2 #模型的输入价格(非必填,可以记录消耗)
|
||||||
|
pri_out = 8 #模型的输出价格(非必填,可以记录消耗)
|
||||||
|
#默认temp 0.2 如果你使用的是老V3或者其他模型,请自己修改temp参数
|
||||||
|
temp = 0.2 #模型的温度,新V3建议0.1-0.3
|
||||||
|
|
||||||
|
#------------专注聊天必填模型------------
|
||||||
|
|
||||||
|
[model.focus_working_memory] #工作记忆模型
|
||||||
name = "Qwen/Qwen2.5-32B-Instruct"
|
name = "Qwen/Qwen2.5-32B-Instruct"
|
||||||
provider = "SILICONFLOW"
|
provider = "SILICONFLOW"
|
||||||
pri_in = 1.26
|
pri_in = 1.26
|
||||||
@@ -243,7 +261,7 @@ pri_in = 2
|
|||||||
pri_out = 8
|
pri_out = 8
|
||||||
temp = 0.3 #模型的温度,新V3建议0.1-0.3
|
temp = 0.3 #模型的温度,新V3建议0.1-0.3
|
||||||
|
|
||||||
[model.focus_tool_use] #工具调用模型,需要使用支持工具调用的模型,建议使用qwen2.5 32b
|
[model.focus_tool_use] #工具调用模型,需要使用支持工具调用的模型
|
||||||
name = "Qwen/Qwen2.5-32B-Instruct"
|
name = "Qwen/Qwen2.5-32B-Instruct"
|
||||||
provider = "SILICONFLOW"
|
provider = "SILICONFLOW"
|
||||||
pri_in = 1.26
|
pri_in = 1.26
|
||||||
@@ -272,16 +290,6 @@ pri_in = 2
|
|||||||
pri_out = 8
|
pri_out = 8
|
||||||
temp = 0.3
|
temp = 0.3
|
||||||
|
|
||||||
#嵌入模型
|
|
||||||
|
|
||||||
[model.embedding] #嵌入
|
|
||||||
name = "BAAI/bge-m3"
|
|
||||||
provider = "SILICONFLOW"
|
|
||||||
pri_in = 0
|
|
||||||
pri_out = 0
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#私聊PFC:需要开启PFC功能,默认三个模型均为硅基流动v3,如果需要支持多人同时私聊或频繁调用,建议把其中的一个或两个换成官方v3或其它模型,以免撞到429
|
#私聊PFC:需要开启PFC功能,默认三个模型均为硅基流动v3,如果需要支持多人同时私聊或频繁调用,建议把其中的一个或两个换成官方v3或其它模型,以免撞到429
|
||||||
|
|||||||
Reference in New Issue
Block a user