# prometheus-first/helper architecture

> Architecture diagram of the GitHub repository prometheus-first/helper, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/prometheus-first/helper
- Repository: https://github.com/prometheus-first/helper

## Overview

这是一个面向 Windows 微信客户端的 Python 文本机器人框架，支持插件扩展。主流程是启动并连接已绑定的微信账号，接收、解析文本后分发给插件；插件可读写群成员与聊天记录、调用大模型，再经服务接口发送回复。独立功能包括群聊总结、艾特对话、成语接龙、成员称呼和人格设置，以及账号选择、联系人信息和发送节奏控制。部分关系依据 README 或 SOURCE INDEX；未采样的实现不作细化推断。

Main entry points: [`wxbot_framework/plugins.py`](https://github.com/prometheus-first/helper/blob/main/wxbot_framework/plugins.py) (插件管理与分发), [`native/text_service.py`](https://github.com/prometheus-first/helper/blob/main/native/text_service.py) (文本收发服务), [`wxbot_framework/runtime.py`](https://github.com/prometheus-first/helper/blob/main/wxbot_framework/runtime.py) (运行时协调), [`plugins/chat_summary/__init__.py`](https://github.com/prometheus-first/helper/blob/main/plugins/chat_summary/__init__.py) (群聊总结插件)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["运行与插件"]
  node_main["应用入口<br/>[main.py]"]
  node_config["配置管理<br/>[config.py]"]
  node_runtime_loop["运行时协调<br/>[runtime.py]"]
  node_plugin_manager["插件管理与分发<br/>[plugins.py]"]
  node_sdk["插件服务接口<br/>[sdk.py]"]
end

subgraph group_messaging["消息与微信"]
  node_text_service["文本收发服务<br/>[text_service.py]"]
  node_text_router["会话与消息解析<br/>[text.py]"]
  node_account["账号识别<br/>[account.py]"]
  node_contacts["联系人信息<br/>[contacts.py]"]
  node_mentions["群艾特校验<br/>[mentions.py]"]
  node_backend["微信后端适配<br/>[backend.py]"]
end

subgraph group_features["机器人功能"]
  node_records["聊天记录插件<br/>[__init__.py]"]
  node_summary["群聊总结插件<br/>[__init__.py]"]
  node_mention_chat["艾特对话插件<br/>[__init__.py]"]
  node_idiom["成语接龙插件<br/>[__init__.py]"]
  node_identity["成员称呼插件<br/>[__init__.py]"]
  node_personality_plugin["人格设置插件<br/>[__init__.py]"]
end

subgraph group_state_ai["群状态与模型"]
  node_members[("成员与聊天存储<br/>[members.py]")]
  node_personality["人格提示与状态<br/>[personality.py]"]
  node_dialogue["对话上下文<br/>[dialogue.py]"]
  node_llm["大模型客户端<br/>[llm.py]"]
end

subgraph group_native["原生桥接"]
  node_native_bridge["文本桥接实现<br/>[text_bridge.cpp]"]
  node_bridge_control["桥接加载与校验<br/>[run_selftest.py]"]
  node_filehelper_bridge["文件助手桥接"]
end

node_operator(("机器人运营者"))
node_external_llm(("兼容大模型服务"))

node_operator -->|"启动"| node_main
node_main -->|"读取配置"| node_config
node_main -->|"启动运行"| node_runtime_loop
node_runtime_loop -->|"选择后端"| node_backend
node_runtime_loop -->|"管理插件"| node_plugin_manager
node_plugin_manager -->|"提供上下文"| node_sdk
node_backend -->|"创建服务"| node_text_service
node_backend -.->|"适配文件助手"| node_filehelper_bridge
node_text_service -.->|"收发文本"| node_native_bridge
node_text_service -.->|"调用桥接"| node_bridge_control
node_text_service -->|"解析消息"| node_text_router
node_text_service -->|"核对账号"| node_account
node_text_service -->|"读取联系人"| node_contacts
node_text_service -->|"处理艾特"| node_mentions
node_runtime_loop -->|"分发消息"| node_plugin_manager
node_plugin_manager -.->|"调用插件"| node_records
node_plugin_manager -.->|"调用插件"| node_summary
node_plugin_manager -.->|"调用插件"| node_mention_chat
node_plugin_manager -.->|"调用插件"| node_idiom
node_plugin_manager -.->|"调用插件"| node_identity
node_plugin_manager -.->|"调用插件"| node_personality_plugin
node_summary -->|"读取记录"| node_members
node_summary -->|"生成总结"| node_llm
node_mention_chat -->|"构建上下文"| node_dialogue
node_mention_chat -->|"生成回复"| node_llm
node_idiom -->|"请求点评"| node_llm
node_identity -->|"设置称呼"| node_members
node_personality_plugin -->|"设置人格"| node_personality
node_summary -->|"应用语气"| node_personality
node_mention_chat -->|"应用语气"| node_personality
node_idiom -->|"应用语气"| node_personality
node_llm -->|"发送请求"| node_external_llm
node_sdk -->|"发送文本"| node_backend

click node_main "https://github.com/prometheus-first/helper/blob/main/main.py"
click node_config "https://github.com/prometheus-first/helper/blob/main/wxbot_framework/config.py"
click node_runtime_loop "https://github.com/prometheus-first/helper/blob/main/wxbot_framework/runtime.py"
click node_plugin_manager "https://github.com/prometheus-first/helper/blob/main/wxbot_framework/plugins.py"
click node_sdk "https://github.com/prometheus-first/helper/blob/main/wxbot_framework/sdk.py"
click node_text_service "https://github.com/prometheus-first/helper/blob/main/native/text_service.py"
click node_text_router "https://github.com/prometheus-first/helper/blob/main/wxbot_framework/text.py"
click node_account "https://github.com/prometheus-first/helper/blob/main/wxbot_framework/account.py"
click node_contacts "https://github.com/prometheus-first/helper/blob/main/wxbot_framework/contacts.py"
click node_mentions "https://github.com/prometheus-first/helper/blob/main/wxbot_framework/mentions.py"
click node_backend "https://github.com/prometheus-first/helper/blob/main/wxbot_framework/backend.py"
click node_records "https://github.com/prometheus-first/helper/blob/main/plugins/chat_records/__init__.py"
click node_summary "https://github.com/prometheus-first/helper/blob/main/plugins/chat_summary/__init__.py"
click node_mention_chat "https://github.com/prometheus-first/helper/blob/main/plugins/mention_chat/__init__.py"
click node_idiom "https://github.com/prometheus-first/helper/blob/main/plugins/idiom_chain/__init__.py"
click node_identity "https://github.com/prometheus-first/helper/blob/main/plugins/member_identity/__init__.py"
click node_personality_plugin "https://github.com/prometheus-first/helper/blob/main/plugins/personality/__init__.py"
click node_members "https://github.com/prometheus-first/helper/blob/main/wxbot_framework/members.py"
click node_personality "https://github.com/prometheus-first/helper/blob/main/wxbot_framework/personality.py"
click node_dialogue "https://github.com/prometheus-first/helper/blob/main/wxbot_framework/dialogue.py"
click node_llm "https://github.com/prometheus-first/helper/blob/main/wxbot_framework/llm.py"
click node_native_bridge "https://github.com/prometheus-first/helper/blob/main/native/text_bridge.cpp"
click node_bridge_control "https://github.com/prometheus-first/helper/blob/main/native/run_selftest.py"
click node_filehelper_bridge "https://github.com/prometheus-first/helper/blob/main/native/filehelper_service.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_config,node_runtime_loop,node_plugin_manager,node_sdk toneBlue
class node_text_service,node_text_router,node_account,node_contacts,node_mentions,node_backend toneAmber
class node_records,node_summary,node_mention_chat,node_idiom,node_identity,node_personality_plugin toneMint
class node_members,node_personality,node_dialogue,node_llm toneRose
class node_native_bridge,node_bridge_control,node_filehelper_bridge,node_operator,node_external_llm toneIndigo
```

## Components

### 运行与插件

- [应用入口](https://github.com/prometheus-first/helper/blob/main/main.py): `main.py`
- [配置管理](https://github.com/prometheus-first/helper/blob/main/wxbot_framework/config.py): `wxbot_framework/config.py`
- [运行时协调](https://github.com/prometheus-first/helper/blob/main/wxbot_framework/runtime.py): `wxbot_framework/runtime.py`
- [插件管理与分发](https://github.com/prometheus-first/helper/blob/main/wxbot_framework/plugins.py): `wxbot_framework/plugins.py`
- [插件服务接口](https://github.com/prometheus-first/helper/blob/main/wxbot_framework/sdk.py): `wxbot_framework/sdk.py`

### 消息与微信

- [文本收发服务](https://github.com/prometheus-first/helper/blob/main/native/text_service.py): `native/text_service.py`
- [会话与消息解析](https://github.com/prometheus-first/helper/blob/main/wxbot_framework/text.py): `wxbot_framework/text.py`
- [账号识别](https://github.com/prometheus-first/helper/blob/main/wxbot_framework/account.py): `wxbot_framework/account.py`
- [联系人信息](https://github.com/prometheus-first/helper/blob/main/wxbot_framework/contacts.py): `wxbot_framework/contacts.py`
- [群艾特校验](https://github.com/prometheus-first/helper/blob/main/wxbot_framework/mentions.py): `wxbot_framework/mentions.py`
- [微信后端适配](https://github.com/prometheus-first/helper/blob/main/wxbot_framework/backend.py): `wxbot_framework/backend.py`

### 机器人功能

- [聊天记录插件](https://github.com/prometheus-first/helper/blob/main/plugins/chat_records/__init__.py): `plugins/chat_records/__init__.py`
- [群聊总结插件](https://github.com/prometheus-first/helper/blob/main/plugins/chat_summary/__init__.py): `plugins/chat_summary/__init__.py`
- [艾特对话插件](https://github.com/prometheus-first/helper/blob/main/plugins/mention_chat/__init__.py): `plugins/mention_chat/__init__.py`
- [成语接龙插件](https://github.com/prometheus-first/helper/blob/main/plugins/idiom_chain/__init__.py): `plugins/idiom_chain/__init__.py`
- [成员称呼插件](https://github.com/prometheus-first/helper/blob/main/plugins/member_identity/__init__.py): `plugins/member_identity/__init__.py`
- [人格设置插件](https://github.com/prometheus-first/helper/blob/main/plugins/personality/__init__.py): `plugins/personality/__init__.py`

### 群状态与模型

- [成员与聊天存储](https://github.com/prometheus-first/helper/blob/main/wxbot_framework/members.py): `wxbot_framework/members.py`
- [人格提示与状态](https://github.com/prometheus-first/helper/blob/main/wxbot_framework/personality.py): `wxbot_framework/personality.py`
- [对话上下文](https://github.com/prometheus-first/helper/blob/main/wxbot_framework/dialogue.py): `wxbot_framework/dialogue.py`
- [大模型客户端](https://github.com/prometheus-first/helper/blob/main/wxbot_framework/llm.py): `wxbot_framework/llm.py`

### 原生桥接

- [文本桥接实现](https://github.com/prometheus-first/helper/blob/main/native/text_bridge.cpp): `native/text_bridge.cpp`
- [桥接加载与校验](https://github.com/prometheus-first/helper/blob/main/native/run_selftest.py): `native/run_selftest.py`
- [文件助手桥接](https://github.com/prometheus-first/helper/blob/main/native/filehelper_service.py): `native/filehelper_service.py`

### Other components

- **机器人运营者**
- **兼容大模型服务**

## Connections

- 机器人运营者 → 应用入口: 启动 (evidence: `README.md`)
- 应用入口 → 配置管理: 读取配置 (evidence: `main.py`)
- 应用入口 → 运行时协调: 启动运行 (evidence: `main.py`)
- 运行时协调 → 微信后端适配: 选择后端 (evidence: `wxbot_framework/runtime.py`)
- 运行时协调 → 插件管理与分发: 管理插件 (evidence: `wxbot_framework/runtime.py`)
- 插件管理与分发 → 插件服务接口: 提供上下文 (evidence: `wxbot_framework/plugins.py`)
- 微信后端适配 → 文本收发服务: 创建服务 (evidence: `wxbot_framework/backend.py`)
- 微信后端适配 → 文件助手桥接: 适配文件助手 (evidence: `wxbot_framework/backend.py`)
- 文本收发服务 → 文本桥接实现: 收发文本 (evidence: `README.md`)
- 文本收发服务 → 桥接加载与校验: 调用桥接 (evidence: `native/text_service.py`)
- 文本收发服务 → 会话与消息解析: 解析消息 (evidence: `native/text_service.py`)
- 文本收发服务 → 账号识别: 核对账号 (evidence: `native/text_service.py`)
- 文本收发服务 → 联系人信息: 读取联系人 (evidence: `native/text_service.py`)
- 文本收发服务 → 群艾特校验: 处理艾特 (evidence: `native/text_service.py`)
- 运行时协调 → 插件管理与分发: 分发消息 (evidence: `wxbot_framework/runtime.py`)
- 插件管理与分发 → 聊天记录插件: 调用插件
- 插件管理与分发 → 群聊总结插件: 调用插件
- 插件管理与分发 → 艾特对话插件: 调用插件
- 插件管理与分发 → 成语接龙插件: 调用插件
- 插件管理与分发 → 成员称呼插件: 调用插件
- 插件管理与分发 → 人格设置插件: 调用插件
- 群聊总结插件 → 成员与聊天存储: 读取记录 (evidence: `plugins/chat_summary/__init__.py`)
- 群聊总结插件 → 大模型客户端: 生成总结 (evidence: `plugins/chat_summary/__init__.py`)
- 艾特对话插件 → 对话上下文: 构建上下文 (evidence: `plugins/mention_chat/__init__.py`)
- 艾特对话插件 → 大模型客户端: 生成回复 (evidence: `plugins/mention_chat/__init__.py`)
- 成语接龙插件 → 大模型客户端: 请求点评 (evidence: `plugins/idiom_chain/__init__.py`)
- 成员称呼插件 → 成员与聊天存储: 设置称呼 (evidence: `plugins/member_identity/__init__.py`)
- 人格设置插件 → 人格提示与状态: 设置人格 (evidence: `plugins/personality/__init__.py`)
- 群聊总结插件 → 人格提示与状态: 应用语气 (evidence: `plugins/chat_summary/__init__.py`)
- 艾特对话插件 → 人格提示与状态: 应用语气 (evidence: `plugins/mention_chat/__init__.py`)
- 成语接龙插件 → 人格提示与状态: 应用语气 (evidence: `plugins/idiom_chain/__init__.py`)
- 大模型客户端 → 兼容大模型服务: 发送请求 (evidence: `README.md`)
- 插件服务接口 → 微信后端适配: 发送文本 (evidence: `wxbot_framework/sdk.py`)
