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文件中添加下表中的必填配置

配置项 必填 默认值 说明
memory_deepseek_api_key DeepSeek API 密钥,插件需要此密钥来驱动大模型的对话和画像生成功能
memory_redis_host localhost Redis 数据库服务器的主机地址。
memory_redis_port 6379 Redis 数据库服务器的端口。
memory_redis_db 0 Redis 数据库编号。
  • 如果将 Redis 运行在非默认地址或端口,需要在 .env 文件中配置 memory_redis_hostmemory_redis_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.12.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.12-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nonebot_plugin_memory-0.1.12.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.12.tar.gz
Algorithm Hash digest
SHA256 40ca7d3652e143c7e3d169418ff5bb95ed3f697c24fb10e8789c087eb9883eda
MD5 711c707157980ea4f48a6149efc5dd27
BLAKE2b-256 2c3d5d1e02a6d751d625be8ffcc2ab14c3a22574bfbd952bb6399acfd5d24e39

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nonebot_plugin_memory-0.1.12-py3-none-any.whl
Algorithm Hash digest
SHA256 77fe5bef894777f62c8fd1c520054b524fc0ccc3d61768d30caf9e9f6e48afee
MD5 d7f3fed68df1f8ee62987eb7d97714ff
BLAKE2b-256 81e2c12ba7edc7262838361a4b383b76a3ce9f8ddd5199fc57f97ff122897853

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