first commit
This commit is contained in:
111
README.md
Normal file
111
README.md
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
# QQbot(AI 聊天机器人)
|
||||||
|
|
||||||
|
一个基于 `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`)
|
||||||
|
- URL(zip 包)
|
||||||
|
- GitHub 简写(`owner/repo` 或 `owner/repo#branch`)
|
||||||
|
|
||||||
|
### 模型命令
|
||||||
|
|
||||||
|
- `/models`
|
||||||
|
- `/models current`
|
||||||
|
- `/models add <model_name>`
|
||||||
|
- `/models add <key> <provider> <model_name> [api_base]`
|
||||||
|
- `/models switch <key>`
|
||||||
|
- `/models remove <key>`
|
||||||
|
|
||||||
|
说明:
|
||||||
|
- `/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
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user