移除部分内置插件
This commit is contained in:
@@ -1,33 +0,0 @@
|
|||||||
{
|
|
||||||
"manifest_version": 1,
|
|
||||||
"name": "LPMM 知识库插件 (Knowledge Search)",
|
|
||||||
"version": "2.0.0",
|
|
||||||
"description": "从 LPMM 知识库中搜索相关信息,供 LLM 工具调用",
|
|
||||||
"author": {
|
|
||||||
"name": "MaiBot团队",
|
|
||||||
"url": "https://github.com/MaiM-with-u"
|
|
||||||
},
|
|
||||||
"license": "GPL-v3.0-or-later",
|
|
||||||
"host_application": {
|
|
||||||
"min_version": "1.0.0"
|
|
||||||
},
|
|
||||||
"homepage_url": "https://github.com/MaiM-with-u/maibot",
|
|
||||||
"repository_url": "https://github.com/MaiM-with-u/maibot",
|
|
||||||
"keywords": ["knowledge", "lpmm", "search", "tool", "built-in"],
|
|
||||||
"categories": ["Knowledge", "Tools"],
|
|
||||||
"default_locale": "zh-CN",
|
|
||||||
"plugin_info": {
|
|
||||||
"is_built_in": true,
|
|
||||||
"plugin_type": "tool_provider",
|
|
||||||
"components": [
|
|
||||||
{
|
|
||||||
"type": "tool",
|
|
||||||
"name": "lpmm_search_knowledge",
|
|
||||||
"description": "从知识库中搜索相关信息"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"capabilities": [
|
|
||||||
"knowledge.search"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
"""LPMM 知识库搜索插件 — 新 SDK 版本
|
|
||||||
|
|
||||||
提供 LLM 可调用的知识库搜索工具。
|
|
||||||
"""
|
|
||||||
|
|
||||||
from maibot_sdk import MaiBotPlugin, Tool
|
|
||||||
from maibot_sdk.types import ToolParameterInfo, ToolParamType
|
|
||||||
|
|
||||||
|
|
||||||
class KnowledgePlugin(MaiBotPlugin):
|
|
||||||
"""LPMM 知识库插件"""
|
|
||||||
|
|
||||||
@Tool(
|
|
||||||
"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,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
async def handle_lpmm_search_knowledge(self, query: str = "", limit: int = 5, **kwargs):
|
|
||||||
"""执行知识库搜索"""
|
|
||||||
if not query:
|
|
||||||
return {"type": "info", "id": "", "content": "未提供搜索关键词"}
|
|
||||||
|
|
||||||
try:
|
|
||||||
limit_value = max(1, int(limit))
|
|
||||||
except (TypeError, ValueError):
|
|
||||||
limit_value = 5
|
|
||||||
|
|
||||||
result = await self.ctx.knowledge.search(query=query, limit=limit_value)
|
|
||||||
if result and result.get("success"):
|
|
||||||
content = result.get("content", f"你不太了解有关{query}的知识")
|
|
||||||
return {"type": "lpmm_knowledge", "id": query, "content": content}
|
|
||||||
return {"type": "info", "id": query, "content": f"知识库搜索失败: {result}"}
|
|
||||||
|
|
||||||
|
|
||||||
def create_plugin():
|
|
||||||
return KnowledgePlugin()
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
{
|
|
||||||
"manifest_version": 1,
|
|
||||||
"name": "文本转语音插件 (Text-to-Speech)",
|
|
||||||
"version": "2.0.0",
|
|
||||||
"description": "将文本转换为语音进行播放的插件,支持多种语音模式和智能语音输出场景判断。",
|
|
||||||
"author": {
|
|
||||||
"name": "MaiBot团队",
|
|
||||||
"url": "https://github.com/MaiM-with-u"
|
|
||||||
},
|
|
||||||
"license": "GPL-v3.0-or-later",
|
|
||||||
|
|
||||||
"host_application": {
|
|
||||||
"min_version": "1.0.0"
|
|
||||||
},
|
|
||||||
"homepage_url": "https://github.com/MaiM-with-u/maibot",
|
|
||||||
"repository_url": "https://github.com/MaiM-with-u/maibot",
|
|
||||||
"keywords": ["tts", "voice", "audio", "speech", "accessibility"],
|
|
||||||
"categories": ["Audio Tools", "Accessibility", "Voice Assistant"],
|
|
||||||
|
|
||||||
"default_locale": "zh-CN",
|
|
||||||
"locales_path": "_locales",
|
|
||||||
|
|
||||||
"plugin_info": {
|
|
||||||
"is_built_in": true,
|
|
||||||
"plugin_type": "audio_processor",
|
|
||||||
"components": [
|
|
||||||
{
|
|
||||||
"type": "action",
|
|
||||||
"name": "tts_action",
|
|
||||||
"description": "将文本转换为语音进行播放",
|
|
||||||
"activation_modes": ["keyword"],
|
|
||||||
"keywords": ["语音", "tts", "播报", "读出来", "语音播放", "听", "朗读"]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"features": [
|
|
||||||
"文本转语音播放",
|
|
||||||
"智能场景判断",
|
|
||||||
"关键词触发",
|
|
||||||
"支持多种语音模式"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
"""TTS 插件 — 新 SDK 版本
|
|
||||||
|
|
||||||
将文本转换为语音进行播放。
|
|
||||||
"""
|
|
||||||
|
|
||||||
import re
|
|
||||||
|
|
||||||
from maibot_sdk import Action, MaiBotPlugin
|
|
||||||
from maibot_sdk.types import ActivationType
|
|
||||||
|
|
||||||
|
|
||||||
class TTSPlugin(MaiBotPlugin):
|
|
||||||
"""文本转语音插件"""
|
|
||||||
|
|
||||||
@Action(
|
|
||||||
"tts_action",
|
|
||||||
description="将文本转换为语音进行播放,适用于需要语音输出的场景",
|
|
||||||
activation_type=ActivationType.KEYWORD,
|
|
||||||
activation_keywords=["语音", "tts", "播报", "读出来", "语音播放", "听", "朗读"],
|
|
||||||
parallel_action=False,
|
|
||||||
action_parameters={"voice_text": "你想用语音表达的内容,这段内容将会以语音形式发出"},
|
|
||||||
action_require=[
|
|
||||||
"当需要发送语音信息时使用",
|
|
||||||
"当用户明确要求使用语音功能时使用",
|
|
||||||
"当表达内容更适合用语音而不是文字传达时使用",
|
|
||||||
"当用户想听到语音回答而非阅读文本时使用",
|
|
||||||
],
|
|
||||||
associated_types=["tts_text"],
|
|
||||||
)
|
|
||||||
async def handle_tts_action(self, stream_id: str = "", action_data: dict = None, reasoning: str = "", **kwargs):
|
|
||||||
"""处理 TTS 文本转语音动作"""
|
|
||||||
action_data = action_data or {}
|
|
||||||
text = action_data.get("voice_text", "")
|
|
||||||
if not text:
|
|
||||||
return False, "执行TTS动作失败:未提供文本内容"
|
|
||||||
|
|
||||||
# 文本预处理
|
|
||||||
processed_text = re.sub(r"([!?,.;:。!?,、;:])\1+", r"\1", text)
|
|
||||||
if not any(processed_text.endswith(end) for end in [".", "?", "!", "。", "!", "?"]):
|
|
||||||
processed_text = f"{processed_text}。"
|
|
||||||
|
|
||||||
# 发送自定义 tts 消息
|
|
||||||
send_ok = await self.ctx.send.custom(
|
|
||||||
custom_type="tts_text",
|
|
||||||
data=processed_text,
|
|
||||||
stream_id=stream_id,
|
|
||||||
)
|
|
||||||
if send_ok:
|
|
||||||
return True, "TTS动作执行成功"
|
|
||||||
return False, "TTS动作执行失败"
|
|
||||||
|
|
||||||
|
|
||||||
def create_plugin():
|
|
||||||
return TTSPlugin()
|
|
||||||
Reference in New Issue
Block a user