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.13.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.13-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nonebot_plugin_memory-0.1.13.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.13.tar.gz
Algorithm Hash digest
SHA256 663c19a0f4d9fcf84104eb074ac525a8a59145f3506486c83f0e7e83e228330a
MD5 ffc2e9a226ed2ce44e77f89c57804503
BLAKE2b-256 6e5c81531f0259f10b862f19e0b8d03124575d523ddbb6309ac96f814aa30298

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nonebot_plugin_memory-0.1.13-py3-none-any.whl
Algorithm Hash digest
SHA256 00bfa2db57456e3185ca8f06ea09cd2b03e6a70cfa426aa1cae4da3040ae0d5d
MD5 d4d97e61dfcf8cc497acb53181d50ec1
BLAKE2b-256 8276ce01e67b25e003325cd72f7b31581b0af3c85b12ddc3ed6e382f71f137ca

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