Gemini avatar/image and chat plugin with skills and context cache for NoneBot2
Project description
nonebot-plugin-skills
基于 Google Gemini 的头像/图片处理与聊天插件,内置上下文缓存、群/私聊隔离,并支持从聊天记录中自动获取最近头像/图片。
功能
- 处理头像/图片:命令内带图、@某人头像、或使用最近聊天图片
- 聊天对话:带上下文的自然语言聊天
- 天气查询:输入城市/地区即可查询当前天气
- 上下文缓存:按群/私聊隔离,定时过期
安装
在 NoneBot2 项目中安装依赖:
pip install nonebot2 nonebot-adapter-onebot httpx google-genai
将插件加入 pyproject.toml:
[tool.nonebot]
plugins = ["nonebot_plugin_skills"]
当前仓库包目录已改为
nonebot_plugin_skills,可直接作为可导入插件使用。
配置
在 .env 中配置:
GOOGLE_API_KEY=你的GoogleAPIKey
GEMINI_TEXT_MODEL=gemini-2.5-flash
GEMINI_IMAGE_MODEL=gemini-2.5-flash-image
HISTORY_TTL_SEC=600
HISTORY_MAX_MESSAGES=20
GEMINI_LOG_RESPONSE=false
IMAGE_TIMEOUT=120
NLP_ENABLE=true
BOT_KEYWORDS=["Diana","diana","嘉然"]
NLP_CONTEXT_HISTORY_MESSAGES=2
NLP_CONTEXT_FUTURE_MESSAGES=2
NLP_CONTEXT_FUTURE_WAIT_SEC=1.0
使用
指令
| 指令 | 说明 |
|---|---|
| 处理头像 <指令> | 处理头像/最近图片/@用户头像 |
| 聊天 <内容> | 上下文聊天 |
| 技能 <内容> | 上下文聊天 |
| 天气 <城市> | 查询当前天气 |
示例
Diana帮忙把@向晚头像变成黑白处理头像 变成赛博朋克风处理头像 @小明 变成油画风聊天 你还记得刚才的头像吗?天气 上海
若图片模型仅返回文本结果,插件会直接把文本回复出来(便于你确认模型是否支持图像输出)。
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nonebot_plugin_skills-0.1.1.tar.gz.
File metadata
- Download URL: nonebot_plugin_skills-0.1.1.tar.gz
- Upload date:
- Size: 19.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b5f28c0d64e6d672edd90d1df37146e74ac4b99bdde8136f5b4d95eeef46031
|
|
| MD5 |
eae5ecd0a327f1888ae158ff5038618d
|
|
| BLAKE2b-256 |
3b6d919f74010068939120fe1c24a19ff0a064c8136f3a1722d52ac6456b6a85
|
Provenance
The following attestation bundles were made for nonebot_plugin_skills-0.1.1.tar.gz:
Publisher:
pypi-publish.yml on SuInk/nonebot-plugin-skills
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nonebot_plugin_skills-0.1.1.tar.gz -
Subject digest:
7b5f28c0d64e6d672edd90d1df37146e74ac4b99bdde8136f5b4d95eeef46031 - Sigstore transparency entry: 883306998
- Sigstore integration time:
-
Permalink:
SuInk/nonebot-plugin-skills@4fe1f2ad4727699fa9fb2a6afe6b7eb353b26ec3 -
Branch / Tag:
refs/tags/0.0.7 - Owner: https://github.com/SuInk
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@4fe1f2ad4727699fa9fb2a6afe6b7eb353b26ec3 -
Trigger Event:
push
-
Statement type:
File details
Details for the file nonebot_plugin_skills-0.1.1-py3-none-any.whl.
File metadata
- Download URL: nonebot_plugin_skills-0.1.1-py3-none-any.whl
- Upload date:
- Size: 20.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3c7f82bc96d34adee245b3ce52f8d0aa138cbe8607d447fe64d9fa0e1699aba
|
|
| MD5 |
741e54c34929a6315bc6f4ee88cc1d05
|
|
| BLAKE2b-256 |
63f29c6e3fcaccd5773b323fde7886c6fc46c4c00a29e7b066dca181da370a27
|
Provenance
The following attestation bundles were made for nonebot_plugin_skills-0.1.1-py3-none-any.whl:
Publisher:
pypi-publish.yml on SuInk/nonebot-plugin-skills
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nonebot_plugin_skills-0.1.1-py3-none-any.whl -
Subject digest:
e3c7f82bc96d34adee245b3ce52f8d0aa138cbe8607d447fe64d9fa0e1699aba - Sigstore transparency entry: 883307050
- Sigstore integration time:
-
Permalink:
SuInk/nonebot-plugin-skills@4fe1f2ad4727699fa9fb2a6afe6b7eb353b26ec3 -
Branch / Tag:
refs/tags/0.0.7 - Owner: https://github.com/SuInk
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@4fe1f2ad4727699fa9fb2a6afe6b7eb353b26ec3 -
Trigger Event:
push
-
Statement type: