Ruff Format

This commit is contained in:
DrSmoothl
2026-03-13 11:45:26 +08:00
parent 2a510312bc
commit a576313b22
70 changed files with 956 additions and 731 deletions

View File

@@ -14,8 +14,16 @@ class KnowledgePlugin(MaiBotPlugin):
"lpmm_search_knowledge",
description="从知识库中搜索相关信息,如果你需要知识,就使用这个工具",
parameters=[
ToolParameterInfo(name="query", param_type=ToolParamType.STRING, description="搜索查询关键词", required=True),
ToolParameterInfo(name="limit", param_type=ToolParamType.INTEGER, description="希望返回的相关知识条数默认5", required=False, default=5),
ToolParameterInfo(
name="query", param_type=ToolParamType.STRING, description="搜索查询关键词", required=True
),
ToolParameterInfo(
name="limit",
param_type=ToolParamType.INTEGER,
description="希望返回的相关知识条数默认5",
required=False,
default=5,
),
],
)
async def handle_lpmm_search_knowledge(self, query: str = "", limit: int = 5, **kwargs):

View File

@@ -231,9 +231,7 @@ class PluginManagementPlugin(MaiBotPlugin):
text = ", ".join(f"{c['name']} ({c['type']})" for c in filtered)
await self.ctx.send.text(f"满足条件的{label}{scope_label}组件: {text}", stream_id)
async def _handle_component_toggle(
self, action: str, scope: str, comp_name: str, comp_type: str, stream_id: str
):
async def _handle_component_toggle(self, action: str, scope: str, comp_name: str, comp_type: str, stream_id: str):
if action not in ("enable", "disable"):
await self.ctx.send.text("插件管理命令不合法", stream_id)
return
@@ -245,13 +243,9 @@ class PluginManagementPlugin(MaiBotPlugin):
return
if action == "enable":
result = await self.ctx.component.enable_component(
comp_name, comp_type, scope=scope, stream_id=stream_id
)
result = await self.ctx.component.enable_component(comp_name, comp_type, scope=scope, stream_id=stream_id)
else:
result = await self.ctx.component.disable_component(
comp_name, comp_type, scope=scope, stream_id=stream_id
)
result = await self.ctx.component.disable_component(comp_name, comp_type, scope=scope, stream_id=stream_id)
ok = result.get("success", False) if isinstance(result, dict) else bool(result)
scope_label = "全局" if scope == "global" else "本地"