插件系统

三类插件

类别定义位置源码形式
内置插件(编译进 App)src/utils/plugins.tsTypeScript Plugin 对象字面量
常驻内置模块(单独文件发货)src/utils/web-search-plugin.tsdoc-parse-plugin.tsartifacts-plugin.tscode-exec-plugin.tsfile-ops-plugin.tslocal-fs-native-plugin.ts导出默认 Plugin 的 TypeScript 模块
用户安装插件db.installedPluginsV2LobeChat JSON / Gradio manifest / MCP server config

内置插件(编译进 App)

插件 id用途默认是否启用
aiaw-time返回当前时间否(被认为没什么用)
aiaw-calculator通过 expr-eval 做数学计算
aiaw-whisper音频转写
aiaw-video-transcript提取视频字幕
aiaw-flux图片生成(Gradio)
aiaw-emotions音频情绪识别
aiaw-mermaidMermaid 图表渲染

常驻内置模块

这些模块各自放在 src/utils/ 的独立文件中:

模块能力关键细节
web-search-plugin.tsSearXNG 元搜索 + Jina Reader 抓取需要配置 SEARXNG_BASE_URL 环境变量;否则插件第一次调用就会抛异常。支持 google/bing/baidu/duckduckgo/npm/pypi/github/arxiv/google_scholar/z-library/reddit/imdb/brave/wikipedia/pinterest/unsplash/vimeo/youtube/bilibili 等引擎
doc-parse-plugin.ts把 PDF/Word/Excel 解析成文本需要 DOC_PARSE_BASE_URL;没有这个地址就无法解析
code-exec-plugin.ts在浏览器里通过 Pyodide 0.26.4 执行 Python第一次调用时会从 https://cdn.jsdelivr.net/pyodide/v0.26.4/full/pyodide.js 加载。可用 matplotlib/numpy/pandas 等 Pyodide 包,不需要单独后端
file-ops-plugin.ts在设备文件系统上执行读/写/列目录/mkdir/copy/move/delete原生侧依赖 capacitor-plugin-shell-exec。沙箱索引存放在 localStorage 键 aiaw_file_index_v2
local-fs-native-plugin.ts仅桌面端可用的文件系统访问(通过 Tauri shell)只会在 Tauri 环境加载;在移动端或纯 Web 环境会直接抛错
artifacts-plugin.ts把助手回复转换成可编辑的 Artifact 文档默认关闭;需要在 Settings → Artifacts Settings 中手动打开

用户安装插件(第三方)

插件系统 页面顶部工具栏点击 + 就能添加:

插件类型来源格式添加方式
LobeChatLobeChat 插件 JSON(manifest 含 identifierapiversion直接粘贴 JSON 或导入 .json 文件
GradioGradio 应用 URL 或 manifest填写 URL,客户端会自动探测 manifest
HuggingFaceHF Space URL内部会先转换成 Gradio manifest
MCP服务器配置(见下文)点击 “+” → Add MCP Plugin

MCP(Model Context Protocol)详解

MCP 客户端(src/utils/mcp-client.ts)支持 3 种传输方式:

传输方式所需配置可运行的平台
stdio通过 shell 命令启动一个子进程仅桌面端(Tauri)。在 Web/Capacitor 上会直接抛错
http可流式传输的 HTTP URL,并可附带请求头所有平台
sseServer-Sent Events URL所有平台

对于 stdio,平台层会通过 Tauri shell 执行 sh -c "<command>"(Windows 上是 cmd /c)。每个 MCP 客户端连接池会保活 5 分钟(空闲超时),并可通过 Plugins 页面上的 Refresh 按钮刷新。

一个 MCP 插件条目看起来像这样:

{
  "id": "mcp-searxng",
  "title": "SearXNG MCP",
  "transport": {
    "type": "http",
    "url": "https://mcp.example.com/searxng",
    "headers": { "Authorization": "Bearer ..." }
  }
}

发现流程是:应用先拉取这个 URL,然后调用 MCP 的 tools/listprompts/listresources/list 端点,把这些结果转成助手可调用的工具。

如何把插件启用到某个助手

  1. 打开目标助手(Settings → Assistants 里选一个,或者在 workspace 的 Assistants 区域进入)
  2. 点击插件 chip 区域,下拉框会显示当前可用插件
  3. 选择你要启用的插件,并为每个插件填写配置(例如给 web-search 填 SearXNG URL)
  4. 保存助手。从这之后,模型在对话过程中就能调用这些插件提供的工具