Files
QQbot/README.md

117 lines
2.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# QQbotAI 聊天机器人)
一个基于 `botpy` 的 QQ 机器人项目,支持多模型切换、长期/短期记忆、人设管理、Skills 插件与 MCP 能力。
## 功能概览
- 多模型配置与运行时切换(`/models`
- 人设增删改切换(`/personality`
- 短期/长期记忆管理(`/clear``/memory`
- Skills 本地与网络安装/卸载/重载(`/skills`
- 自动去除 Markdown 格式后再回复(适配 QQ 聊天)
## 快速开始
1. 安装依赖
```bash
pip install -r requirements.txt
```
2. 配置环境变量
复制 `.env.example``.env`,填写 QQ 机器人和 AI 配置。
3. 启动
```bash
python main.py
```
## 命令说明
### 通用
- `/help`
- `/clear`(默认等价 `/clear short`
- `/clear short`
- `/clear long`
- `/clear all`
### 人设命令
- `/personality`
- `/personality list`
- `/personality set <key>`
- `/personality add <name> <Introduction>`
- `/personality remove <key>`
说明:
- `add` 会新增并切换到该人设
- `Introduction` 会作为人设简介与自定义指令
### Skills 命令
- `/skills`
- `/skills install <source> [skill_name]`
- `/skills uninstall <skill_name>`
- `/skills reload <skill_name>`
`source` 支持:
- 本地技能名(如 `weather`
- URLzip 包)
- GitHub 简写(`owner/repo``owner/repo#branch`
- GitHub 仓库 URL`https://github.com/op7418/Humanizer-zh.git`
兼容说明:
- 若源中包含标准技能结构(`skill.json` + `main.py`),按原方式安装
- 若仅包含 `SKILL.md`,会自动生成适配技能并提供 `read_skill_doc` 工具读取文档内容
### 模型命令
- `/models`
- `/models current`
- `/models add <model_name>`
- `/models add <key> <provider> <model_name> [api_base]`
- `/models switch <key|index>`
- `/models remove <key|index>`
说明:
- `/models add <model_name>` 只替换模型名,沿用当前 API Base 和 API Key
### 长期记忆命令
- `/memory`
- `/memory get <id>`
- `/memory add <content|json>`
- `/memory update <id> <content|json>`
- `/memory delete <id>`
- `/memory search <query> [limit]`
## 目录结构
```text
QQbot/
├─ src/
│ ├─ ai/
│ ├─ handlers/
│ ├─ core/
│ └─ utils/
├─ skills/
├─ config/
├─ docs/
└─ tests/
```
## 测试
```bash
python -m pytest -q
```
如果你使用 conda 环境,请先执行:
```bash
conda activate qqbot
```