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.10.tar.gz (10.5 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.10-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nonebot_plugin_memory-0.1.10.tar.gz
  • Upload date:
  • Size: 10.5 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.10.tar.gz
Algorithm Hash digest
SHA256 8b687b4009ca34895063381460597f26141dcc0987279979c54a095a98ed8555
MD5 d60438e1c1895b706cb055000a151815
BLAKE2b-256 23600261f8ed31d2d6db3d67eee7db40edca8584c7c29119202b2cb3fae67956

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nonebot_plugin_memory-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 742ed41b80bc65e109901eed53601407d2f8f7892f9b518a17e45810e56e6b51
MD5 7ecef276e70abf79ee4ba7f657173681
BLAKE2b-256 57aea7fc4637a0f90a70b28a36b6d50a9a5158035cde34156a479341fe0bc427

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