ai 群友
Project description
📖 介绍
2.0 版本更新,轻量化依赖,全部使用 API 进行调用,基本上任何设备都能运行。
本插件主体使用 langchain 的 agent 进行决策,由 langchain 调用 tools 进行一系列任务。
- 群体认知档案:每 6 小时自动归纳群内话题、活跃成员特征、内部梗等,让 bot 对群文化有持续感知。
- 长记忆(需配置 Qdrant):RAG 自动存储聊天历史,学习群友发言习惯,使 bot 更像真人。
- 表情包学习(需配置 Qdrant):使用
qwen-vl-max理解图片内容,自动从群内偷学表情包并存入向量库,回复时按语义匹配发出。
对于主模型选择:推荐使用支持 Function Calling 的通义千问系列模型(如 qwen-plus、qwen-max)。图片理解固定使用 qwen-vl-max,群档案摘要固定使用 qwen-flash。
💿 安装
使用 nb-cli 安装
在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装nb plugin install nonebot-plugin-ai-groupmate --upgrade
使用 pypi 源安装
nb plugin install nonebot-plugin-ai-groupmate --upgrade -i "https://pypi.org/simple"
使用清华源安装
nb plugin install nonebot-plugin-ai-groupmate --upgrade -i "https://pypi.tuna.tsinghua.edu.cn/simple"
使用包管理器安装
在 nonebot2 项目的插件目录下, 打开命令行, 根据你使用的包管理器, 输入相应的安装命令uv
uv add nonebot-plugin-ai-groupmate
安装仓库 master 分支
uv add git+https://github.com/yaowan233/nonebot-plugin-ai-groupmate@master
pdm
pdm add nonebot-plugin-ai-groupmate
安装仓库 master 分支
pdm add git+https://github.com/yaowan233/nonebot-plugin-ai-groupmate@master
poetry
poetry add nonebot-plugin-ai-groupmate
安装仓库 master 分支
poetry add git+https://github.com/yaowan233/nonebot-plugin-ai-groupmate@master
打开 nonebot2 项目根目录下的 pyproject.toml 文件, 在 [tool.nonebot] 部分追加写入
plugins = ["nonebot-plugin-ai-groupmate"]
使用 nbr 安装(使用 uv 管理依赖可用)
nbr 是一个基于 uv 的 nb-cli,可以方便地管理 nonebot2
nbr plugin install nonebot-plugin-ai-groupmate
使用 pypi 源安装
nbr plugin install nonebot-plugin-ai-groupmate -i "https://pypi.org/simple"
使用清华源安装
nbr plugin install nonebot-plugin-ai-groupmate -i "https://pypi.tuna.tsinghua.edu.cn/simple"
⚙️ 配置
配置说明
| 配置项 | 必填 | 默认值 | 说明 |
|---|---|---|---|
| ai_groupmate__bot_name | 是 | "bot" |
bot 名 |
| ai_groupmate__qwen_token | 是 | 无 | 阿里云 DashScope API Key |
| ai_groupmate__base_model | 是 | 无 | 主模型名,推荐 qwen-plus / qwen-max |
| ai_groupmate__reply_probability | 否 | 0.01 |
群内主动发言概率 |
| ai_groupmate__personality_setting | 否 | 无 | 自定义人设 prompt |
| ai_groupmate__tavily_api_key | 否 | 无 | Tavily 搜索 API 密钥(联网搜索功能) |
| ai_groupmate__qdrant_uri | 否 | 无 | Qdrant 地址,不填则禁用表情包、RAG 等向量功能 |
| ai_groupmate__qdrant_api_key | 否 | 无 | Qdrant API Key(使用 Qdrant Cloud 时需要) |
| ai_groupmate__embedding_api_key | 否 | 无 | Embedding API Key,启用 Qdrant 时必填(推荐硅基流动,免费) |
| ai_groupmate__embedding_base_url | 否 | 无 | Embedding Base URL,启用 Qdrant 时必填(推荐硅基流动,免费) |
| ai_groupmate__rerank_api_url | 否 | 无 | Rerank API URL,启用 Qdrant 时使用(推荐硅基流动,免费) |
| ai_groupmate__rerank_api_key | 否 | 无 | Rerank API Key,启用 Qdrant 时使用(推荐硅基流动,免费) |
🎉 使用
@bot 即可触发回复,也会以 reply_probability 的概率主动发言。
内置了好感度系统,增加了趣味性。
以下功能需要配置 Qdrant
配置 Qdrant 后,ai 会自动偷群内使用的表情包并存入向量库,回复时通过 VLM 语义匹配发出,准确率非常高。
发送群内偷学到的表情包
利用 RAG 对聊天历史进行语义检索,可进行总结、查询等功能。
指令表
由于 AI 功能需要记录聊天记录,基于已记录的聊天记录,可以很轻松的做到词频统计,所以顺带加上了。
| 指令 | 说明 |
|---|---|
| /词频 <统计天数> | 生成个人词频词云 |
| /群词频 <统计天数> | 生成群词频词云 |
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nonebot_plugin_ai_groupmate-2.0.1.tar.gz.
File metadata
- Download URL: nonebot_plugin_ai_groupmate-2.0.1.tar.gz
- Upload date:
- Size: 7.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3d836557e7fdd51c9ea8e942248352c50b45cf9719c89ce521da931d29ac2a6
|
|
| MD5 |
15444ae4a30b24667af2604ef70d155a
|
|
| BLAKE2b-256 |
2fd38a253efbb4cfad599b99e41b3851f5ea20a82dc8dd067dbe6d510ceb6721
|
Provenance
The following attestation bundles were made for nonebot_plugin_ai_groupmate-2.0.1.tar.gz:
Publisher:
release.yml on yaowan233/nonebot-plugin-ai-groupmate
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nonebot_plugin_ai_groupmate-2.0.1.tar.gz -
Subject digest:
e3d836557e7fdd51c9ea8e942248352c50b45cf9719c89ce521da931d29ac2a6 - Sigstore transparency entry: 1223497144
- Sigstore integration time:
-
Permalink:
yaowan233/nonebot-plugin-ai-groupmate@894c698c8ada011c0350b3dc5cf5c9d54538c16c -
Branch / Tag:
refs/tags/v2.0.1 - Owner: https://github.com/yaowan233
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@894c698c8ada011c0350b3dc5cf5c9d54538c16c -
Trigger Event:
push
-
Statement type:
File details
Details for the file nonebot_plugin_ai_groupmate-2.0.1-py3-none-any.whl.
File metadata
- Download URL: nonebot_plugin_ai_groupmate-2.0.1-py3-none-any.whl
- Upload date:
- Size: 7.3 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
16d10afd910540c7a497922333a262a79ec609e328610ad0959c6360c8c22f65
|
|
| MD5 |
a30b2e7d56cc7a464aaab6284687e906
|
|
| BLAKE2b-256 |
f4dd375b8adcab021c47edff5ee3a0bec349bdc4f82e5a49126c73e2f5c0d907
|
Provenance
The following attestation bundles were made for nonebot_plugin_ai_groupmate-2.0.1-py3-none-any.whl:
Publisher:
release.yml on yaowan233/nonebot-plugin-ai-groupmate
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nonebot_plugin_ai_groupmate-2.0.1-py3-none-any.whl -
Subject digest:
16d10afd910540c7a497922333a262a79ec609e328610ad0959c6360c8c22f65 - Sigstore transparency entry: 1223497228
- Sigstore integration time:
-
Permalink:
yaowan233/nonebot-plugin-ai-groupmate@894c698c8ada011c0350b3dc5cf5c9d54538c16c -
Branch / Tag:
refs/tags/v2.0.1 - Owner: https://github.com/yaowan233
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@894c698c8ada011c0350b3dc5cf5c9d54538c16c -
Trigger Event:
push
-
Statement type: