docs: add web channel and agent plugin docs

This commit is contained in:
zhayujie
2025-05-23 11:56:41 +08:00
parent 5f7ade20dc
commit 8bf1aef801
4 changed files with 47 additions and 55 deletions

View File

@@ -1,7 +1,10 @@
# Web channel
使用SSEServer-Sent Events服务器推送事件实现提供了一个默认的网页。也可以自己实现加入api
# Web Channel
#使用方法
- 在配置文件中channel_type填入web即可
- 访问地址 http://localhost:9899/chat
- port可以在配置项 web_port中设置
提供了一个默认的AI对话页面可展示文本、图片等消息交互支持markdown语法渲染兼容插件执行。
# 使用说明
-`config.json` 配置文件中的 `channel_type` 字段填入 `web`
- 程序运行后将监听9899端口浏览器访问 http://localhost:9899/chat 即可使用
- 监听端口可以在配置文件 `web_port` 中自定义
- 对于Docker运行方式如果需要外部访问需要在 `docker-compose.yml` 中通过 ports配置将端口监听映射到宿主机

View File

@@ -1,21 +1,18 @@
# AgentMesh Plugin
# Agent插件
这个插件集成了 AgentMesh 多智能体框架,允许用户通过简单的命令使用多智能体团队来完成各种任务。
## 插件说明
## 功能介绍
基于 [AgentMesh](https://github.com/MinimalFuture/AgentMesh) 多智能体框架实现的Agent插件可以让机器人快速获得Agent能力通过自然语言对话来访问 **终端、浏览器、文件系统、搜索引擎** 等各类工具。
同时还支持通过 **多智能体协作** 来完成复杂任务,例如多智能体任务分发、多智能体问题讨论、协同处理等。
AgentMesh 是一个开源的多智能体平台,提供开箱即用的 Agent 开发框架、多 Agent 间的协同策略、任务规划和自主决策能力。通过这个插件,你可以:
- 使用预配置的智能体团队处理复杂任务
- 利用多智能体协作能力解决问题
- 访问各种工具,如搜索引擎、浏览器、文件系统等
AgentMesh项目地址https://github.com/MinimalFuture/AgentMesh
## 安装
1. 确保已安装 AgentMesh SDK
1. 确保已安装依赖
```bash
pip install agentmesh-sdk>=0.1.0
pip install agentmesh-sdk>=0.1.2
```
2. 如需使用浏览器工具,还需安装:
@@ -27,51 +24,43 @@ playwright install
## 配置
插件从项目根目录的 `config.yaml` 文件中读取配置。请确保该文件包含正确的团队配置
插件配置文件是 `plugins/agent`目录`config.yaml`,包含智能体团队配置以及工具的配置,可以从模板文件 `config-template.yaml`中复制:
配置示例:
```yaml
teams:
general_team:
description: "通用智能体团队,擅长于搜索、研究和执行各种任务"
model: "gpt-4o"
max_steps: 20
agents:
- name: "通用助手"
description: "全能的通用智能体"
system_prompt: "你是全能的通用智能体,可以帮助用户解决工作、生活、学习上的任何问题,以及使用工具解决各类复杂问题"
tools: ["google_search", "calculator", "current_time"]
```bash
cp config-template.yaml config.yaml
```
说明:
- `team`配置是默认选中的 agent team
- `teams` 下是Agent团队配置团队的model默认为`gpt-4.1-mini`,可根据需要进行修改,模型对应的 `api_key` 需要在项目根目录的 `config.json` 全局配置中进行配置。例如openai模型需要配置 `open_ai_api_key`
- 支持为 `agents` 下面的每个agent添加model字段来设置不同的模型
## 使用方法
使用 `$agent` 前缀触发插件,支持以下命令:
在对机器人发送的消息中使用 `$agent` 前缀触发插件,支持以下命令:
- `$agent [task]`: 使用默认团队执行任务 (默认团队可通 config.yaml 中的team配置修改)
- `$agent teams`: 列出可用的团队
- `$agent use [team_name] [task]`: 使用指定的团队执行任务
- `$agent teams` - 列出可用的团队
- `$agent use [team_name] [task]` - 使用特定团队执行任务
- `$agent [task]` - 使用默认团队执行任务
### 示例
```
```bash
$agent 帮我查看当前目录下有哪些文件夹
$agent teams
$agent use general_team 帮我分析多智能体技术发展趋势
$agent 帮我查看当前文件夹路径
$agent use software_team 帮我写一个产品预约体验的表单页面
```
## 工具支持
AgentMesh 支持多种工具,包括但不限于:
目前支持多种内置工具,包括但不限于:
- `calculator`: 数学计算工具
- `current_time`: 获取当前时间
- `browser`: 浏览器操作工具
- `google_search`: 搜索引擎
- `browser`: 浏览器操作工具,注意需安装额外依赖
- `google_search`: 搜索引擎,注意需在`config.yaml`中配置api_key
- `file_save`: 文件保存工具
- `terminal`: 终端命令执行工具
## 注意事项
1. 确保 `config.yaml` 文件中包含正确的团队配置
2. 如果需要使用浏览器工具,请确保安装了相关依赖

View File

@@ -46,7 +46,7 @@ class AgentPlugin(Plugin):
def get_help_text(self, verbose=False, **kwargs):
"""Return help message for the agent plugin."""
help_text = "AgentMesh插件: 使用多智能体团队处理任务和回答问题,支持多种工具和智能体协作能力"
help_text = "通过AgentMesh实现对终端、浏览器、文件系统、搜索引擎等工具的执行,并支持多智能体协作。"
trigger_prefix = conf().get("plugin_trigger_prefix", "$")
if not verbose:
@@ -56,14 +56,13 @@ class AgentPlugin(Plugin):
teams_str = ", ".join(teams) if teams else "未配置任何团队"
help_text += "\n\n使用说明:\n"
help_text += f"{trigger_prefix}agent [task] - 使用默认团队执行任务\n"
help_text += f"{trigger_prefix}agent teams - 列出可用的团队\n"
help_text += f"{trigger_prefix}agent use [team_name] [task] - 使用特定团队执行任务\n"
help_text += f"{trigger_prefix}agent [task] - 使用默认团队执行任务\n\n"
help_text += f"可用团队: {teams_str}\n\n"
help_text += f"{trigger_prefix}agent use [team_name] [task] - 使用特定团队执行任务\n\n"
help_text += f"可用团队: \n{teams_str}\n\n"
help_text += f"示例:\n"
help_text += f"{trigger_prefix}agent use general_team 帮我分析多智能体技术发展趋势\n"
help_text += f"{trigger_prefix}agent 帮我查看当前文件夹路径"
help_text += f"{trigger_prefix}agent 帮我查看当前文件夹路径\n"
help_text += f"{trigger_prefix}agent use software_team 帮我写一个产品预约体验的表单页面"
return help_text
def get_available_teams(self) -> List[str]:

View File

@@ -1,21 +1,22 @@
# 选中的Agent Team
# 默认选中的Agent Team名称
team: general_team
tools:
google_search:
# get your apikey from https://serper.dev/
api_key: "e7a21d840d6bb0ba832d850bb5aa4dee337415c4"
api_key: "YOUR API KEY"
# Team config
teams:
general_team:
model: "qwen-plus"
model: "gpt-4.1-mini" # 团队使用的模型
description: "A versatile research and information agent team"
max_steps: 5
agents:
- name: "通用智能助手"
description: "Universal assistant specializing in research, information synthesis, and task execution"
system_prompt: "You are a versatile assistant who answers questions and completes tasks using available tools. Reply in a clearly structured, attractive and easy to read format."
# Agent 支持使用的工具
tools:
- time
- calculator