词元之母TOK.MOM - 平台充值汇率 1:1 即 1 人民币充值到账 1 美元,支持一个 Key 调用近 600+ 海内外模型,限时特价模型低至 1 折,欢迎上岸!

用户 ↔ 消息平台 ↔ 平台适配器 ↔ Gateway Runner ↔ AIAgentgateway/platforms/base.py 中的 BasePlatformAdapter,并实现以下方法:connect() — 建立连接(WebSocket、长轮询、HTTP 服务器等)(抽象方法)disconnect() — 清理关闭 (抽象方法)send() — 向聊天发送文本消息 (抽象方法)send_typing() — 显示正在输入指示器(可选覆盖)get_chat_info() — 返回聊天元数据(可选覆盖)self.handle_message(event) 转发,基类将其路由到 gateway runner。~/.hermes/plugins/my-platform/
PLUGIN.yaml # Plugin 元数据
adapter.py # 适配器类 + register() 入口点requires_env 和 optional_env 块会自动填充 hermes config UI 条目(参见下方在 hermes config 中暴露环境变量)。config.yaml 中配置平台:__init__ 中读取)。ctx.register_platform() 时,以下集成点将自动处理 — 无需修改核心代码:| 集成点 | 工作方式 |
|---|---|
| Gateway 适配器创建 | 在内置 if/elif 链之前检查注册表 |
| 配置解析 | Platform._missing_() 接受任意平台名称 |
| 已连接平台验证 | 调用注册表中的 validate_config() |
| 用户授权 | 检查 allowed_users_env / allow_all_env |
| 仅环境变量自动启用 | env_enablement_fn 填充 PlatformConfig.extra + home_channel |
| YAML 配置桥接 | apply_yaml_config_fn 将 config.yaml 键转换为环境变量/extras |
| Cron 投递 | cron_deliver_env_var 使 deliver=<name> 生效 |
hermes config UI 条目 | plugin.yaml 中的 requires_env / optional_env 自动填充 |
| send_message 工具 | 通过实时 gateway 适配器路由 |
| Webhook 跨平台投递 | 检查注册表中的已知平台 |
/update 命令访问 | allow_update_command 标志 |
| 频道目录 | Plugin 平台包含在枚举中 |
| 系统 prompt 提示 | platform_hint 注入 LLM 上下文 |
| 消息分块 | max_message_length 用于智能分割 |
| PII 脱敏 | pii_safe 标志 |
hermes status | 显示带 (plugin) 标签的 plugin 平台 |
hermes gateway setup | Plugin 平台出现在设置菜单中 |
hermes tools / hermes skills | Plugin 平台出现在每平台配置中 |
| Token 锁(多配置文件) | 在 connect() 中使用 acquire_scoped_lock() |
| 孤立配置警告 | Plugin 缺失时输出描述性日志 |