feat:支持qwen3模型的enable_thinking参数和thinking_budget参数
This commit is contained in:
@@ -32,7 +32,7 @@ def init_prompt():
|
|||||||
{chat_observe_info}
|
{chat_observe_info}
|
||||||
|
|
||||||
现在请你根据现有的信息,思考自我认同:请严格遵守以下规则
|
现在请你根据现有的信息,思考自我认同:请严格遵守以下规则
|
||||||
1. 请严格参考最上方的人设,适当参考记忆和当前聊天内容
|
1. 请严格参考最上方的人设,适当参考记忆和当前聊天内容,不要被记忆和当前聊天内容中相反的内容误导
|
||||||
2. 你是一个什么样的人,你和群里的人关系如何
|
2. 你是一个什么样的人,你和群里的人关系如何
|
||||||
3. 你的形象是什么
|
3. 你的形象是什么
|
||||||
4. 思考有没有人提到你,或者图片与你有关
|
4. 思考有没有人提到你,或者图片与你有关
|
||||||
|
|||||||
@@ -180,8 +180,9 @@ class ActionPlanner:
|
|||||||
# --- 调用 LLM (普通文本生成) ---
|
# --- 调用 LLM (普通文本生成) ---
|
||||||
llm_content = None
|
llm_content = None
|
||||||
try:
|
try:
|
||||||
llm_content, _, _ = await self.planner_llm.generate_response(prompt=prompt)
|
llm_content, reasoning_content, _ = await self.planner_llm.generate_response(prompt=prompt)
|
||||||
logger.debug(f"{self.log_prefix}[Planner] LLM 原始 JSON 响应 (预期): {llm_content}")
|
logger.debug(f"{self.log_prefix}[Planner] LLM 原始 JSON 响应 (预期): {llm_content}")
|
||||||
|
logger.debug(f"{self.log_prefix}[Planner] LLM 原始理由 响应 (预期): {reasoning_content}")
|
||||||
except Exception as req_e:
|
except Exception as req_e:
|
||||||
logger.error(f"{self.log_prefix}[Planner] LLM 请求执行失败: {req_e}")
|
logger.error(f"{self.log_prefix}[Planner] LLM 请求执行失败: {req_e}")
|
||||||
reasoning = f"LLM 请求失败,你的模型出现问题: {req_e}"
|
reasoning = f"LLM 请求失败,你的模型出现问题: {req_e}"
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class StructureObservation:
|
|||||||
for structured_info in self.structured_info:
|
for structured_info in self.structured_info:
|
||||||
if structured_info.get("ttl") > 0:
|
if structured_info.get("ttl") > 0:
|
||||||
structured_info["ttl"] -= 1
|
structured_info["ttl"] -= 1
|
||||||
observed_structured_infos.append(structured_info)
|
observed_structured_infos.append(structured_info)
|
||||||
logger.debug(f"观察到结构化信息仍旧在: {structured_info}")
|
logger.debug(f"观察到结构化信息仍旧在: {structured_info}")
|
||||||
|
|
||||||
self.structured_info = observed_structured_infos
|
self.structured_info = observed_structured_infos
|
||||||
|
|||||||
@@ -117,6 +117,9 @@ class LLMRequest:
|
|||||||
self.model_name: str = model["name"]
|
self.model_name: str = model["name"]
|
||||||
self.params = kwargs
|
self.params = kwargs
|
||||||
|
|
||||||
|
self.enable_thinking = model.get("enable_thinking", False)
|
||||||
|
self.temp = model.get("temp", 0.7)
|
||||||
|
self.thinking_budget = model.get("thinking_budget", 4096)
|
||||||
self.stream = model.get("stream", False)
|
self.stream = model.get("stream", False)
|
||||||
self.pri_in = model.get("pri_in", 0)
|
self.pri_in = model.get("pri_in", 0)
|
||||||
self.pri_out = model.get("pri_out", 0)
|
self.pri_out = model.get("pri_out", 0)
|
||||||
@@ -601,8 +604,9 @@ class LLMRequest:
|
|||||||
new_params = dict(params)
|
new_params = dict(params)
|
||||||
|
|
||||||
if self.model_name.lower() in self.MODELS_NEEDING_TRANSFORMATION:
|
if self.model_name.lower() in self.MODELS_NEEDING_TRANSFORMATION:
|
||||||
# 删除 'temperature' 参数(如果存在)
|
# 删除 'temperature' 参数(如果存在),但避免删除我们在_build_payload中添加的自定义温度
|
||||||
new_params.pop("temperature", None)
|
if "temperature" in new_params and new_params["temperature"] == 0.7:
|
||||||
|
new_params.pop("temperature")
|
||||||
# 如果存在 'max_tokens',则重命名为 'max_completion_tokens'
|
# 如果存在 'max_tokens',则重命名为 'max_completion_tokens'
|
||||||
if "max_tokens" in new_params:
|
if "max_tokens" in new_params:
|
||||||
new_params["max_completion_tokens"] = new_params.pop("max_tokens")
|
new_params["max_completion_tokens"] = new_params.pop("max_tokens")
|
||||||
@@ -632,6 +636,18 @@ class LLMRequest:
|
|||||||
"messages": messages,
|
"messages": messages,
|
||||||
**params_copy,
|
**params_copy,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# 添加temp参数(如果不是默认值0.7)
|
||||||
|
if self.temp != 0.7:
|
||||||
|
payload["temperature"] = self.temp
|
||||||
|
|
||||||
|
# 添加enable_thinking参数(如果不是默认值False)
|
||||||
|
if not self.enable_thinking:
|
||||||
|
payload["enable_thinking"] = False
|
||||||
|
|
||||||
|
if self.thinking_budget != 4096:
|
||||||
|
payload["thinking_budget"] = self.thinking_budget
|
||||||
|
|
||||||
if "max_tokens" not in payload and "max_completion_tokens" not in payload:
|
if "max_tokens" not in payload and "max_completion_tokens" not in payload:
|
||||||
payload["max_tokens"] = global_config.model.model_max_output_length
|
payload["max_tokens"] = global_config.model.model_max_output_length
|
||||||
# 如果 payload 中依然存在 max_tokens 且需要转换,在这里进行再次检查
|
# 如果 payload 中依然存在 max_tokens 且需要转换,在这里进行再次检查
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class MuteAction(PluginAction):
|
|||||||
|
|
||||||
action_name = "mute_action"
|
action_name = "mute_action"
|
||||||
action_description = (
|
action_description = (
|
||||||
"如果某人违反了公序良俗,或者别人戳你太多,或者某人刷屏,一定要禁言某人,如果你很生气,可以禁言某人,可以自选禁言时长,视严重程度而定"
|
"如果某人违反了公序良俗,或者别人戳你太多,或者某人刷屏,一定要禁言某人,如果你很生气,可以禁言某人,可以自选禁言时长,视严重程度而定。"
|
||||||
)
|
)
|
||||||
action_parameters = {
|
action_parameters = {
|
||||||
"target": "禁言对象,输入你要禁言的对象的名字,必填",
|
"target": "禁言对象,输入你要禁言的对象的名字,必填",
|
||||||
|
|||||||
@@ -206,16 +206,18 @@ temp = 0.2 #模型的温度,新V3建议0.1-0.3
|
|||||||
|
|
||||||
[model.utils_small] # 在麦麦的一些组件中使用的小模型,消耗量较大
|
[model.utils_small] # 在麦麦的一些组件中使用的小模型,消耗量较大
|
||||||
# 强烈建议使用免费的小模型
|
# 强烈建议使用免费的小模型
|
||||||
name = "Qwen/Qwen2.5-7B-Instruct"
|
name = "Qwen/Qwen3-8B"
|
||||||
provider = "SILICONFLOW"
|
provider = "SILICONFLOW"
|
||||||
|
enable_thinking = false # 是否启用思考
|
||||||
pri_in = 0
|
pri_in = 0
|
||||||
pri_out = 0
|
pri_out = 0
|
||||||
|
|
||||||
[model.memory_summary] # 记忆的概括模型,建议使用qwen2.5 32b 及以上
|
[model.memory_summary] # 记忆的概括模型
|
||||||
name = "Qwen/Qwen2.5-32B-Instruct"
|
name = "Qwen/Qwen3-30B-A3B"
|
||||||
provider = "SILICONFLOW"
|
provider = "SILICONFLOW"
|
||||||
pri_in = 1.26
|
enable_thinking = false # 是否启用思考
|
||||||
pri_out = 1.26
|
pri_in = 0.7
|
||||||
|
pri_out = 2.8
|
||||||
|
|
||||||
[model.vlm] # 图像识别模型
|
[model.vlm] # 图像识别模型
|
||||||
name = "Pro/Qwen/Qwen2.5-VL-7B-Instruct"
|
name = "Pro/Qwen/Qwen2.5-VL-7B-Instruct"
|
||||||
@@ -226,7 +228,7 @@ pri_out = 0.35
|
|||||||
#嵌入模型
|
#嵌入模型
|
||||||
[model.embedding]
|
[model.embedding]
|
||||||
name = "BAAI/bge-m3"
|
name = "BAAI/bge-m3"
|
||||||
provider = "SILICONFLOW"
|
provider = "DEV"
|
||||||
pri_in = 0
|
pri_in = 0
|
||||||
pri_out = 0
|
pri_out = 0
|
||||||
|
|
||||||
@@ -235,8 +237,8 @@ pri_out = 0
|
|||||||
[model.normal_chat_1] # 一般聊天模式的首要回复模型,推荐使用 推理模型
|
[model.normal_chat_1] # 一般聊天模式的首要回复模型,推荐使用 推理模型
|
||||||
name = "Pro/deepseek-ai/DeepSeek-R1"
|
name = "Pro/deepseek-ai/DeepSeek-R1"
|
||||||
provider = "SILICONFLOW"
|
provider = "SILICONFLOW"
|
||||||
pri_in = 1.0 #模型的输入价格(非必填,可以记录消耗)
|
pri_in = 4.0 #模型的输入价格(非必填,可以记录消耗)
|
||||||
pri_out = 4.0 #模型的输出价格(非必填,可以记录消耗)
|
pri_out = 16.0 #模型的输出价格(非必填,可以记录消耗)
|
||||||
|
|
||||||
[model.normal_chat_2] # 一般聊天模式的次要回复模型,推荐使用 非推理模型
|
[model.normal_chat_2] # 一般聊天模式的次要回复模型,推荐使用 非推理模型
|
||||||
name = "Pro/deepseek-ai/DeepSeek-V3"
|
name = "Pro/deepseek-ai/DeepSeek-V3"
|
||||||
@@ -249,46 +251,57 @@ temp = 0.2 #模型的温度,新V3建议0.1-0.3
|
|||||||
#------------专注聊天必填模型------------
|
#------------专注聊天必填模型------------
|
||||||
|
|
||||||
[model.focus_working_memory] #工作记忆模型
|
[model.focus_working_memory] #工作记忆模型
|
||||||
name = "Qwen/Qwen2.5-32B-Instruct"
|
name = "Qwen/Qwen3-30B-A3B"
|
||||||
provider = "SILICONFLOW"
|
provider = "SILICONFLOW"
|
||||||
pri_in = 1.26
|
enable_thinking = false # 是否启用思考
|
||||||
pri_out = 1.26
|
pri_in = 0.7
|
||||||
|
pri_out = 2.8
|
||||||
|
|
||||||
[model.focus_chat_mind] #聊天规划:认真聊天时,生成麦麦对聊天的规划想法
|
[model.focus_chat_mind] #聊天规划:认真聊天时,生成麦麦对聊天的规划想法
|
||||||
name = "Pro/deepseek-ai/DeepSeek-V3"
|
name = "Pro/deepseek-ai/DeepSeek-V3"
|
||||||
|
# name = "Qwen/Qwen3-30B-A3B"
|
||||||
provider = "SILICONFLOW"
|
provider = "SILICONFLOW"
|
||||||
|
# enable_thinking = false # 是否启用思考
|
||||||
pri_in = 2
|
pri_in = 2
|
||||||
pri_out = 8
|
pri_out = 8
|
||||||
temp = 0.3 #模型的温度,新V3建议0.1-0.3
|
temp = 0.3
|
||||||
|
|
||||||
[model.focus_tool_use] #工具调用模型,需要使用支持工具调用的模型
|
[model.focus_tool_use] #工具调用模型,需要使用支持工具调用的模型
|
||||||
name = "Qwen/Qwen2.5-32B-Instruct"
|
name = "Qwen/Qwen3-14B"
|
||||||
provider = "SILICONFLOW"
|
provider = "SILICONFLOW"
|
||||||
pri_in = 1.26
|
enable_thinking = false # 是否启用思考
|
||||||
pri_out = 1.26
|
pri_in = 0.5
|
||||||
|
pri_out = 2
|
||||||
|
|
||||||
[model.focus_planner] #决策:认真聊天时,负责决定麦麦该做什么
|
[model.focus_planner] #决策:认真聊天时,负责决定麦麦该做什么
|
||||||
name = "Pro/deepseek-ai/DeepSeek-V3"
|
name = "Pro/deepseek-ai/DeepSeek-V3"
|
||||||
|
# name = "Qwen/Qwen3-30B-A3B"
|
||||||
provider = "SILICONFLOW"
|
provider = "SILICONFLOW"
|
||||||
|
# enable_thinking = false # 是否启用思考
|
||||||
pri_in = 2
|
pri_in = 2
|
||||||
pri_out = 8
|
pri_out = 8
|
||||||
|
temp = 0.3
|
||||||
|
|
||||||
#表达器模型,用于表达麦麦的想法,生成最终回复,对语言风格影响极大
|
#表达器模型,用于表达麦麦的想法,生成最终回复,对语言风格影响极大
|
||||||
#也用于表达方式学习
|
#也用于表达方式学习
|
||||||
[model.focus_expressor]
|
[model.focus_expressor]
|
||||||
name = "Pro/deepseek-ai/DeepSeek-V3"
|
name = "Pro/deepseek-ai/DeepSeek-V3"
|
||||||
|
# name = "Qwen/Qwen3-30B-A3B"
|
||||||
provider = "SILICONFLOW"
|
provider = "SILICONFLOW"
|
||||||
|
# enable_thinking = false # 是否启用思考
|
||||||
pri_in = 2
|
pri_in = 2
|
||||||
pri_out = 8
|
pri_out = 8
|
||||||
temp = 0.3
|
temp = 0.3
|
||||||
|
|
||||||
#自我识别模型,用于自我认知和身份识别
|
#自我识别模型,用于自我认知和身份识别
|
||||||
[model.focus_self_recognize]
|
[model.focus_self_recognize]
|
||||||
name = "Pro/deepseek-ai/DeepSeek-V3"
|
# name = "Pro/deepseek-ai/DeepSeek-V3"
|
||||||
|
name = "Qwen/Qwen3-30B-A3B"
|
||||||
provider = "SILICONFLOW"
|
provider = "SILICONFLOW"
|
||||||
pri_in = 2
|
enable_thinking = false # 是否启用思考
|
||||||
pri_out = 8
|
pri_in = 0.7
|
||||||
temp = 0.3
|
pri_out = 2.8
|
||||||
|
temp = 0.7
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user