Skip to main content

ai 群友

Project description

logo

✨ nonebot-plugin-ai-groupmate ✨

LICENSE pypi python uv
ruff pre-commit codecov

📖 介绍

2.0 版本更新,轻量化依赖,全部使用 API 进行调用,基本上任何设备都能运行。

本插件主体使用 langchain 的 agent 进行决策,由 langchain 调用 tools 进行一系列任务。

  • 群体认知档案:每 6 小时自动归纳群内话题、活跃成员特征、内部梗等,让 bot 对群文化有持续感知。
  • 长记忆(需配置 Qdrant):RAG 自动存储聊天历史,学习群友发言习惯,使 bot 更像真人。
  • 表情包学习(需配置 Qdrant):使用 qwen-vl-max 理解图片内容,自动从群内偷学表情包并存入向量库,回复时按语义匹配发出。

对于主模型选择:推荐使用支持 Function Calling 的通义千问系列模型(如 qwen-plusqwen-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 的概率主动发言。

内置了好感度系统,增加了趣味性。 Screenshot_20251201_134157

以下功能需要配置 Qdrant

配置 Qdrant 后,ai 会自动偷群内使用的表情包并存入向量库,回复时通过 VLM 语义匹配发出,准确率非常高。 Screenshot_20251201_134203 发送群内偷学到的表情包 Screenshot_20251201_132723 利用 RAG 对聊天历史进行语义检索,可进行总结、查询等功能。 Screenshot_20251201_133320

指令表

由于 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

nonebot_plugin_ai_groupmate-2.0.1.tar.gz (7.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nonebot_plugin_ai_groupmate-2.0.1-py3-none-any.whl (7.3 MB view details)

Uploaded Python 3

File details

Details for the file nonebot_plugin_ai_groupmate-2.0.1.tar.gz.

File metadata

File hashes

Hashes for nonebot_plugin_ai_groupmate-2.0.1.tar.gz
Algorithm Hash digest
SHA256 e3d836557e7fdd51c9ea8e942248352c50b45cf9719c89ce521da931d29ac2a6
MD5 15444ae4a30b24667af2604ef70d155a
BLAKE2b-256 2fd38a253efbb4cfad599b99e41b3851f5ea20a82dc8dd067dbe6d510ceb6721

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nonebot_plugin_ai_groupmate-2.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for nonebot_plugin_ai_groupmate-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 16d10afd910540c7a497922333a262a79ec609e328610ad0959c6360c8c22f65
MD5 a30b2e7d56cc7a464aaab6284687e906
BLAKE2b-256 f4dd375b8adcab021c47edff5ee3a0bec349bdc4f82e5a49126c73e2f5c0d907

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page