Skip to main content

对跟bot对话的每个人形成记忆,生成有趣的用户档案,用于下次生成回复,也可以通过指令查看已有的用户档案。

Project description

logo

可塑性记忆

✨ nonebot-plugin-memory ✨

LICENSE pypi python uv
ruff pre-commit

📖 介绍

为每位用户生成独立画像的记忆插件。对跟bot对话的每个人形成记忆,生成有趣的用户档案,用于下次生成回复,也可以通过指令查看已有的用户档案。

功能

  • 自动保存用户发言
  • 每日生成或更新用户画像
  • 指令查看印象

💿 安装

pip install nonebot-plugin-memory
使用 nb-cli 安装 在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装
nb plugin install nonebot-plugin-memory --upgrade

使用 pypi 源安装

nb plugin install nonebot-plugin-memory --upgrade -i "https://pypi.org/simple"

使用清华源安装

nb plugin install nonebot-plugin-memory --upgrade -i "https://pypi.tuna.tsinghua.edu.cn/simple"

💾 持久化存储

本插件依赖 Redis 数据库来实现用户档案和聊天记忆的持久化存储,需自行安装和启动 Redis 服务。

使用 Docker (推荐)

# 启动 Redis 服务器,并将其映射到主机的 6379 端口
docker run --name nonebot-redis -p 6379:6379 -d redis

在 Linux 上安装 (以 Ubuntu/Debian 为例)

# 安装 Redis 服务器
sudo apt update
sudo apt install redis-server

# 检查服务状态
sudo systemctl status redis-server
#确保服务状态显示为 active (running),插件即可通过默认配置(localhost:6379)连接。

⚙️ 配置

在 nonebot2 项目的.env文件中添加下表中的必填配置

配置项 必填 默认值 说明
DEEPSEEK_API_KEY DeepSeek API 密钥,插件需要此密钥来驱动大模型的对话和画像生成功能
REDIS_HOST localhost Redis 数据库服务器的主机地址。
REDIS_PORT 6379 Redis 数据库服务器的端口。
REDIS_DB 0 Redis 数据库编号。
  • 如果将 Redis 运行在非默认地址或端口,需要在 .env 文件中配置 REDIS_HOSTREDIS_PORT 来覆盖插件代码中的默认值

🎉 使用

指令表

指令 权限 需要@ 范围 说明
/可塑性记忆 所有 需要 所有 输入用户id查看档案

提示词

  • 系统提示词 SYSTEM_PROMPT 设定为千恋万花中的常陆茉子,可以自行更换为其他设定。

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_memory-0.1.11.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

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

nonebot_plugin_memory-0.1.11-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file nonebot_plugin_memory-0.1.11.tar.gz.

File metadata

  • Download URL: nonebot_plugin_memory-0.1.11.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for nonebot_plugin_memory-0.1.11.tar.gz
Algorithm Hash digest
SHA256 99f4fd2306c4883ae5a5ddf87b3f0df9f2c7b0676616ae3318435a9d1774eeca
MD5 f4f47ce61c9c1f6fba79041612b33ec8
BLAKE2b-256 81672093664bb786bc954ff21667d16600eeb12dc083a6c0ffa47a1b1a750e63

See more details on using hashes here.

File details

Details for the file nonebot_plugin_memory-0.1.11-py3-none-any.whl.

File metadata

File hashes

Hashes for nonebot_plugin_memory-0.1.11-py3-none-any.whl
Algorithm Hash digest
SHA256 e59ce24f32560f1080a3bed0e7498f7920502b3e29a0216f1db48b6f62e1cf09
MD5 cc3d8ee7509c6ca82981cb7c67727e76
BLAKE2b-256 3880e2bd5286dabe2f3bc4381bde070e63b1bb696e6642e3decf191493280146

See more details on using hashes here.

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