2025-12-30 01:22:29 +00:00
|
|
|
|
# Action 插件
|
|
|
|
|
|
|
|
|
|
|
|
Action 插件会在聊天界面的消息下方添加自定义按钮,让你一键触发特定功能。
|
|
|
|
|
|
|
|
|
|
|
|
## 什么是 Actions?
|
|
|
|
|
|
|
|
|
|
|
|
Actions 是交互式插件,能够:
|
|
|
|
|
|
|
|
|
|
|
|
- :material-gesture-tap: 在消息操作栏添加按钮
|
|
|
|
|
|
- :material-export: 生成并导出内容(思维导图、图表、文件等)
|
|
|
|
|
|
- :material-api: 与外部服务和 API 交互
|
|
|
|
|
|
- :material-animation-play: 创建可视化或交互内容
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
## 可用的 Action 插件
|
|
|
|
|
|
|
|
|
|
|
|
<div class="grid cards" markdown>
|
|
|
|
|
|
|
|
|
|
|
|
- :material-brain:{ .lg .middle } **Smart Mind Map**
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
智能分析文本并生成交互式、精美的思维导图。
|
|
|
|
|
|
|
2025-12-30 18:49:41 +00:00
|
|
|
|
**版本:** 0.8.0
|
2025-12-30 01:22:29 +00:00
|
|
|
|
|
|
|
|
|
|
[:octicons-arrow-right-24: 查看文档](smart-mind-map.md)
|
|
|
|
|
|
|
|
|
|
|
|
- :material-chart-bar:{ .lg .middle } **Smart Infographic**
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
使用 AntV 可视化引擎,将文本转成专业的信息图。
|
|
|
|
|
|
|
2026-01-06 22:35:31 +08:00
|
|
|
|
**版本:** 1.4.0
|
2025-12-30 01:22:29 +00:00
|
|
|
|
|
|
|
|
|
|
[:octicons-arrow-right-24: 查看文档](smart-infographic.md)
|
|
|
|
|
|
|
|
|
|
|
|
- :material-card-text:{ .lg .middle } **Knowledge Card**
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
快速生成精美的学习记忆卡片,适合学习与记忆。
|
|
|
|
|
|
|
2026-01-03 12:22:14 +08:00
|
|
|
|
**版本:** 0.2.2
|
2025-12-30 01:22:29 +00:00
|
|
|
|
|
|
|
|
|
|
[:octicons-arrow-right-24: 查看文档](knowledge-card.md)
|
|
|
|
|
|
|
|
|
|
|
|
- :material-file-excel:{ .lg .middle } **Export to Excel**
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
将聊天记录导出为 Excel 电子表格,方便分析或归档。
|
|
|
|
|
|
|
2026-01-03 18:43:22 +08:00
|
|
|
|
**版本:** 0.3.7
|
2025-12-30 01:22:29 +00:00
|
|
|
|
|
|
|
|
|
|
[:octicons-arrow-right-24: 查看文档](export-to-excel.md)
|
|
|
|
|
|
|
2026-01-04 02:24:46 +08:00
|
|
|
|
- :material-file-word-box:{ .lg .middle } **Word 导出 (格式增强)**
|
2025-12-30 07:25:12 +00:00
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
2026-01-04 02:40:46 +08:00
|
|
|
|
将当前对话导出为完美格式的 Word 文档,支持**代码语法高亮**、**原生数学公式**、**Mermaid 图表**、**引用资料**以及**增强表格**渲染。
|
2025-12-30 07:25:12 +00:00
|
|
|
|
|
2026-01-05 23:37:14 +08:00
|
|
|
|
**版本:** 0.4.1
|
2025-12-30 07:25:12 +00:00
|
|
|
|
|
|
|
|
|
|
[:octicons-arrow-right-24: 查看文档](export-to-word.md)
|
|
|
|
|
|
|
2025-12-30 01:22:29 +00:00
|
|
|
|
- :material-text-box-search:{ .lg .middle } **Summary**
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
对长文本进行精简总结,提取要点。
|
|
|
|
|
|
|
2026-01-03 12:22:14 +08:00
|
|
|
|
**版本:** 0.1.0
|
2025-12-30 01:22:29 +00:00
|
|
|
|
|
|
|
|
|
|
[:octicons-arrow-right-24: 查看文档](summary.md)
|
|
|
|
|
|
|
2026-01-05 17:29:52 +08:00
|
|
|
|
- :material-image-text:{ .lg .middle } **信息图转 Markdown**
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
AI 驱动的信息图生成器,渲染 SVG 并以 Markdown Data URL 图片嵌入。
|
|
|
|
|
|
|
|
|
|
|
|
**版本:** 1.0.0
|
|
|
|
|
|
|
|
|
|
|
|
[:octicons-arrow-right-24: 查看文档](infographic-markdown.zh.md)
|
|
|
|
|
|
|
2025-12-30 01:22:29 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
## 快速安装
|
|
|
|
|
|
|
|
|
|
|
|
1. 下载需要的 `.py` 插件文件
|
|
|
|
|
|
2. 前往 **Admin Panel** → **Settings** → **Functions**
|
|
|
|
|
|
3. 上传文件并完成配置
|
|
|
|
|
|
4. 在聊天消息中使用对应的 Action 按钮
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
## 开发模板
|
|
|
|
|
|
|
|
|
|
|
|
想要自己编写 Action 插件?可以参考下面的模板:
|
|
|
|
|
|
|
|
|
|
|
|
```python
|
|
|
|
|
|
"""
|
|
|
|
|
|
title: My Custom Action
|
|
|
|
|
|
author: Your Name
|
|
|
|
|
|
version: 1.0.0
|
|
|
|
|
|
description: Description of your action plugin
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
from typing import Optional, Dict, Any
|
|
|
|
|
|
|
|
|
|
|
|
class Action:
|
|
|
|
|
|
class Valves(BaseModel):
|
|
|
|
|
|
# 在这里添加你的配置项
|
|
|
|
|
|
show_status: bool = Field(
|
|
|
|
|
|
default=True,
|
|
|
|
|
|
description="Show status updates during processing"
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
|
|
self.valves = self.Valves()
|
|
|
|
|
|
|
|
|
|
|
|
async def action(
|
|
|
|
|
|
self,
|
|
|
|
|
|
body: dict,
|
|
|
|
|
|
__user__: Optional[Dict[str, Any]] = None,
|
|
|
|
|
|
__event_emitter__: Optional[Any] = None,
|
|
|
|
|
|
__request__: Optional[Any] = None,
|
|
|
|
|
|
) -> Optional[dict]:
|
|
|
|
|
|
"""
|
|
|
|
|
|
当用户点击 Action 按钮时触发的主方法。
|
|
|
|
|
|
|
|
|
|
|
|
Args:
|
|
|
|
|
|
body: 包含会话数据的消息体
|
|
|
|
|
|
__user__: 当前用户信息
|
|
|
|
|
|
__event_emitter__: 用于发送通知或状态更新
|
|
|
|
|
|
__request__: FastAPI 请求对象
|
|
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
|
修改后的 body 字典或 None
|
|
|
|
|
|
"""
|
|
|
|
|
|
# 发送状态更新
|
|
|
|
|
|
if __event_emitter__ and self.valves.show_status:
|
|
|
|
|
|
await __event_emitter__({
|
|
|
|
|
|
"type": "status",
|
|
|
|
|
|
"data": {"description": "Processing...", "done": False}
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
# 插件逻辑
|
|
|
|
|
|
messages = body.get("messages", [])
|
|
|
|
|
|
if messages:
|
|
|
|
|
|
last_message = messages[-1].get("content", "")
|
|
|
|
|
|
# 在这里处理消息...
|
|
|
|
|
|
|
|
|
|
|
|
# 完成状态
|
|
|
|
|
|
if __event_emitter__ and self.valves.show_status:
|
|
|
|
|
|
await __event_emitter__({
|
|
|
|
|
|
"type": "status",
|
|
|
|
|
|
"data": {"description": "Done!", "done": True}
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
return body
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
更多详情可查看 [插件开发指南](../../development/plugin-guide.md)。
|