remove:无用配置

This commit is contained in:
SengokuCola
2026-04-01 13:06:01 +08:00
parent a7310916e6
commit 503a257d66
14 changed files with 25 additions and 95 deletions

View File

@@ -68,7 +68,6 @@ class DefaultReplyer:
reply_reason: str = "",
available_actions: Optional[Dict[str, ActionInfo]] = None,
chosen_actions: Optional[List[ActionPlannerInfo]] = None,
enable_tool: bool = True,
from_plugin: bool = True,
stream_id: Optional[str] = None,
reply_message: Optional[SessionMessage] = None,
@@ -87,7 +86,6 @@ class DefaultReplyer:
reply_reason: 回复原因
available_actions: 可用的动作信息字典
chosen_actions: 已选动作
enable_tool: 是否启用工具调用
from_plugin: 是否来自插件
Returns:
@@ -112,7 +110,6 @@ class DefaultReplyer:
extra_info=extra_info,
available_actions=available_actions,
chosen_actions=chosen_actions,
enable_tool=enable_tool,
reply_message=reply_message,
reply_reason=reply_reason,
reply_time_point=reply_time_point,
@@ -394,26 +391,20 @@ class DefaultReplyer:
return f"{expression_habits_title}\n{expression_habits_block}", selected_ids
async def build_tool_info(self, chat_history: str, sender: str, target: str, enable_tool: bool = True) -> str:
async def build_tool_info(self, chat_history: str, sender: str, target: str) -> str:
del chat_history
del sender
del target
del enable_tool
return ""
"""构建工具信息块
Args:
chat_history: 聊天历史记录
reply_to: 回复对象,格式为 "发送者:消息内容"
enable_tool: 是否启用工具调用
Returns:
str: 工具信息字符串
"""
if not enable_tool:
return ""
try:
# 使用工具执行器获取信息
tool_results = []
@@ -741,7 +732,6 @@ class DefaultReplyer:
reply_reason: str = "",
available_actions: Optional[Dict[str, ActionInfo]] = None,
chosen_actions: Optional[List[ActionPlannerInfo]] = None,
enable_tool: bool = True,
reply_time_point: float = time.time(),
think_level: int = 1,
unknown_words: Optional[List[str]] = None,
@@ -755,7 +745,6 @@ class DefaultReplyer:
available_actions: 可用动作
chosen_actions: 已选动作
enable_timeout: 是否启用超时处理
enable_tool: 是否启用工具调用
reply_message: 回复的原始消息
Returns:
str: 构建好的上下文
@@ -840,7 +829,7 @@ class DefaultReplyer:
"expression_habits",
),
self._time_and_run_task(
self.build_tool_info(chat_talking_prompt_short, sender, target, enable_tool=enable_tool), "tool_info"
self.build_tool_info(chat_talking_prompt_short, sender, target), "tool_info"
),
self._time_and_run_task(self.get_prompt_info(chat_talking_prompt_short, sender, target), "prompt_info"),
self._time_and_run_task(self.build_actions_prompt(available_actions, chosen_actions), "actions_info"),

View File

@@ -288,7 +288,6 @@ class MaisakaReplyGenerator:
reply_reason: str = "",
available_actions: Optional[Dict[str, ActionInfo]] = None,
chosen_actions: Optional[List[object]] = None,
enable_tool: bool = True,
from_plugin: bool = True,
stream_id: Optional[str] = None,
reply_message: Optional[SessionMessage] = None,
@@ -303,7 +302,6 @@ class MaisakaReplyGenerator:
"""结合上下文生成 Maisaka 的最终可见回复。"""
del available_actions
del chosen_actions
del enable_tool
del extra_info
del from_plugin
del log_reply

View File

@@ -65,7 +65,6 @@ class PrivateReplyer:
reply_reason: str = "",
available_actions: Optional[Dict[str, ActionInfo]] = None,
chosen_actions: Optional[List[ActionPlannerInfo]] = None,
enable_tool: bool = True,
from_plugin: bool = True,
think_level: int = 1,
stream_id: Optional[str] = None,
@@ -84,7 +83,6 @@ class PrivateReplyer:
reply_reason: 回复原因
available_actions: 可用的动作信息字典
chosen_actions: 已选动作
enable_tool: 是否启用工具调用
from_plugin: 是否来自插件
Returns:
@@ -103,7 +101,6 @@ class PrivateReplyer:
extra_info=extra_info,
available_actions=available_actions,
chosen_actions=chosen_actions,
enable_tool=enable_tool,
reply_message=reply_message,
reply_reason=reply_reason,
unknown_words=unknown_words,
@@ -287,26 +284,20 @@ class PrivateReplyer:
return f"{expression_habits_title}\n{expression_habits_block}", selected_ids
async def build_tool_info(self, chat_history: str, sender: str, target: str, enable_tool: bool = True) -> str:
async def build_tool_info(self, chat_history: str, sender: str, target: str) -> str:
del chat_history
del sender
del target
del enable_tool
return ""
"""构建工具信息块
Args:
chat_history: 聊天历史记录
reply_to: 回复对象,格式为 "发送者:消息内容"
enable_tool: 是否启用工具调用
Returns:
str: 工具信息字符串
"""
if not enable_tool:
return ""
try:
# 使用工具执行器获取信息
tool_results = []
@@ -612,7 +603,6 @@ class PrivateReplyer:
reply_reason: str = "",
available_actions: Optional[Dict[str, ActionInfo]] = None,
chosen_actions: Optional[List[ActionPlannerInfo]] = None,
enable_tool: bool = True,
unknown_words: Optional[List[str]] = None,
) -> Tuple[str, List[int]]:
"""
@@ -624,7 +614,6 @@ class PrivateReplyer:
available_actions: 可用动作
chosen_actions: 已选动作
enable_timeout: 是否启用超时处理
enable_tool: 是否启用工具调用
reply_message: 回复的原始消息
Returns:
str: 构建好的上下文
@@ -719,7 +708,7 @@ class PrivateReplyer:
),
# self._time_and_run_task(self.build_relation_info(chat_talking_prompt_short, sender), "relation_info"),
self._time_and_run_task(
self.build_tool_info(chat_talking_prompt_short, sender, target, enable_tool=enable_tool), "tool_info"
self.build_tool_info(chat_talking_prompt_short, sender, target), "tool_info"
),
self._time_and_run_task(self.get_prompt_info(chat_talking_prompt_short, sender, target), "prompt_info"),
self._time_and_run_task(self.build_actions_prompt(available_actions, chosen_actions), "actions_info"),

View File

@@ -36,7 +36,6 @@ from .official_configs import (
ResponsePostProcessConfig,
ResponseSplitterConfig,
TelemetryConfig,
ToolConfig,
VoiceConfig,
WebUIConfig,
)
@@ -90,9 +89,6 @@ class Config(ConfigBase):
message_receive: MessageReceiveConfig = Field(default_factory=MessageReceiveConfig)
"""消息接收配置类"""
tool: ToolConfig = Field(default_factory=ToolConfig)
"""工具配置类"""
voice: VoiceConfig = Field(default_factory=VoiceConfig)
"""语音配置类"""

View File

@@ -265,6 +265,18 @@ def try_migrate_legacy_bot_config_dict(data: dict[str, Any]) -> MigrationResult:
migrated_any = True
reasons.append("experimental.chat_prompts")
chat = _as_dict(data.get("chat"))
if chat is not None and "think_mode" in chat:
chat.pop("think_mode", None)
migrated_any = True
reasons.append("chat.think_mode_removed")
tool = _as_dict(data.get("tool"))
if tool is not None:
data.pop("tool", None)
migrated_any = True
reasons.append("tool_section_removed")
# ExpressionConfig 中的 manual_reflect_operator_id:
# 旧版本可能是 ""(字符串),新版本期望 Optional[TargetItem]。
# 空字符串视为未配置,转换为 None/删除键以避免校验错误。

View File

@@ -236,20 +236,6 @@ class ChatConfig(ConfigBase):
)
"""上下文长度"""
think_mode: Literal["classic", "deep", "dynamic"] = Field(
default="dynamic",
json_schema_extra={
"x-widget": "select",
"x-icon": "brain",
},
)
"""
思考模式配置
- classic: 默认think_level为0轻量回复不需要思考和回忆
- deep: 默认think_level为1深度回复需要进行回忆和思考
- dynamic: think_level由planner动态给出根据planner返回的think_level决定
"""
plan_reply_log_max_per_chat: int = Field(
default=1024,
json_schema_extra={
@@ -651,21 +637,6 @@ class ExpressionConfig(ConfigBase):
"""是否在回复前尝试对上下文中的黑话进行解释关闭可减少一次LLM调用仅影响回复前的黑话匹配与解释不影响黑话学习"""
class ToolConfig(ConfigBase):
"""工具配置类"""
__ui_parent__ = "emoji"
enable_tool: bool = Field(
default=False,
json_schema_extra={
"x-widget": "switch",
"x-icon": "wrench",
},
)
"""是否在聊天中启用工具"""
class VoiceConfig(ConfigBase):
"""语音识别配置类"""

View File

@@ -343,11 +343,6 @@ class LLMOrchestrator:
)
response = execution_result.api_response
model_info = execution_result.model_info
if self.request_type.startswith("maisaka_"):
logger.info(
f"LLMOrchestrator[{self.request_type}] generate_response_with_message_async 执行完成 "
f"(model={model_info.name}, time_cost={time.time() - start_time:.2f}s)"
)
time_cost = time.time() - start_time
logger.debug(f"LLM请求总耗时: {time_cost}")
@@ -833,14 +828,7 @@ class LLMOrchestrator:
message_list = []
if message_factory:
if self.request_type.startswith("maisaka_"):
logger.info(f"LLMOrchestrator[{self.request_type}] 正在通过 message_factory 构建消息列表")
message_list = message_factory(client)
if self.request_type.startswith("maisaka_"):
logger.info(
f"LLMOrchestrator[{self.request_type}] message_factory 返回了 {len(message_list)} 条消息"
)
try:
request = self._build_client_request(
request_type=request_type,

View File

@@ -121,11 +121,7 @@ def create_builtin_tool_specs() -> List[ToolSpec]:
),
_build_tool_spec(
name="no_reply",
brief_description="本轮不发送可见回复,继续下一步思考",
),
_build_tool_spec(
name="stop",
brief_description="暂停当前内部循环,等待新的外部消息。",
brief_description="本轮不进行回复,等待其他用户的新消息",
),
_build_tool_spec(
name="send_emoji",

View File

@@ -1282,7 +1282,7 @@ class MaisakaReasoningEngine:
self._runtime._chat_history.append(history_message)
return self._build_tool_success_result(
tool_call.func_name,
"可见回复已生成并发送。",
"回复已生成并发送。",
structured_content={
"msg_id": target_message_id,
"quote": quote_reply,

View File

@@ -103,7 +103,6 @@ async def generate_reply(
available_actions: Optional[Dict[str, ActionInfo]] = None,
chosen_actions: Optional[List["ActionPlannerInfo"]] = None,
unknown_words: Optional[List[str]] = None,
enable_tool: bool = False,
enable_splitter: bool = True,
enable_chinese_typo: bool = True,
request_type: str = "generator_api",
@@ -133,7 +132,6 @@ async def generate_reply(
extra_info=extra_info,
available_actions=available_actions,
chosen_actions=chosen_actions,
enable_tool=enable_tool,
reply_message=reply_message,
reply_reason=reply_reason,
unknown_words=unknown_words,

View File

@@ -36,7 +36,6 @@ from src.config.official_configs import (
ResponsePostProcessConfig,
ResponseSplitterConfig,
TelemetryConfig,
ToolConfig,
VoiceConfig,
)
from src.webui.config_schema import ConfigSchemaGenerator
@@ -113,7 +112,6 @@ async def get_config_section_schema(section_name: str):
- experimental: ExperimentalConfig
- maim_message: MaimMessageConfig
- lpmm_knowledge: LPMMKnowledgeConfig
- tool: ToolConfig
- memory: MemoryConfig
- debug: DebugConfig
- voice: VoiceConfig
@@ -138,7 +136,6 @@ async def get_config_section_schema(section_name: str):
"experimental": ExperimentalConfig,
"maim_message": MaimMessageConfig,
"lpmm_knowledge": LPMMKnowledgeConfig,
"tool": ToolConfig,
"memory": MemoryConfig,
"debug": DebugConfig,
"voice": VoiceConfig,