[!IMPORTANT] 收藏项目,你的每一个Star⭐都是作者更新的动力~️
📖 介绍
基于Gemini API 的模板绘图插件 前身是 nonebot-plugin-figurine 进行了全面升级
💿 安装
使用 nb-cli 安装
在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装nb plugin install nonebot-plugin-templates-draw
使用包管理器安装
在 nonebot2 项目的插件目录下, 打开命令行, 根据你使用的包管理器, 输入相应的安装命令pip
pip install nonebot-plugin-templates-draw
pdm
pdm add nonebot-plugin-templates-draw
poetry
poetry add nonebot-plugin-templates-draw
conda
conda install nonebot-plugin-templates-draw
打开 nonebot2 项目根目录下的 pyproject.toml 文件, 在 [tool.nonebot] 部分追加写入
plugins = ["nonebot_plugin_templates_draw"]
⚙️ 配置
在 nonebot2 项目的.env文件中添加下表中的必填配置
| 配置项 | 必填 | 默认值 | 说明 |
|---|---|---|---|
| TEMPLATES_DRAW__API_TYPE | 否 | - | api类型,可选 gemini, openai, doubao |
| TEMPLATES_DRAW__GEMINI_API_URL | 是 | - | 看下方注释 |
| TEMPLATES_DRAW__GEMINI_API_KEYS | 是 | ["xxxxxx"] | 需要付费key,填入你的多个API Key,例如 ['key1', 'key2', 'key3'] |
| TEMPLATES_DRAW__GEMINI_MODEL | 否 | gemini-2.5-flash-image-preview | Gemini 绘图模型 |
| TEMPLATES_DRAW__MAX_TOTAL_ATTEMPTS | 否 | 2 | 这一张图的最大尝试次数(包括首次尝试) |
| TEMPLATES_DRAW__SEND_FORWARD_MSG | 否 | True | 使用合并转发来发图,默认开启 |
| TEMPLATES_DRAW__GEMINI_PDF_JAILBREAK | 否 | False | 看下方注释 |
| TEMPLATES_DRAW__DOUBAO_API_URL | 否 | https://ark.cn-beijing.volces.com/api/v3 | 豆包API地址 |
| TEMPLATES_DRAW__GEMINI_MODEL | 否 | doubao-seededit-3-0-i2i-250628 | 豆包绘图模型 |
| TEMPLATES_DRAW__SEQUENTIAL_IMAGE_GENERATION | 否 | False | 是否顺序生成图片(多图分别生成) |
- Gemini API Url 默认为官方完整 Url
https://generativelanguage.googleapis.com/v1beta,可以替换为中转https://xxxxx.xxx/v1beta如果想使用 OpenAI 兼容层(不推荐),可以替换为https://generativelanguage.googleapis.com/v1beta/openai或者中转https://xxxxx.xxx/v1/chat/completions 默认使用了很长的文本破限词,如果破限效果不好或者花费太高可以自定义JAILBREAK_PROMPT放弃了JAILBREAK_PROMPT,使用请求模型JAILBREAK_MODEL上下文破限,默认为gemini-2.0-flash-lite- GEMINI_PDF_JAILBREAK 发送pdf略微绕开限制,默认关闭
推荐API
- https://openrouter.ai/
充值10刀即可每天调用1000次免费模型 - 由于Google改变了价格,不再有免费调用:https://ai.google.dev/gemini-api/docs/pricing?hl=zh-cn#gemini-2.5-flash-image-preview
- 1次调用不到4毛CNY,建议配合 插件管理系统 等设置阻塞、CD、次数
- 自建API:覆盖如下请求参数
{
"modalities": [
"image",
"text"
]
}
- 点击最新API:柏拉图AI(AFF)
🎉 使用
指令表
| 指令 | 权限 | 需要@ | 范围 | 说明 |
|---|---|---|---|---|
| 画图 | 群员 | 否 | 群聊 | 需要带图或回复图片或@某人 |
| 查看模板 | 群员 | 否 | 群聊 | 查看模板 或者 查看模板 <模板标识> |
| 添加/删除模板 | 群员 | 是 | 群聊 | 格式:添加模板 <模板标识> <提示词> |
- 默认提示词已经写入config,不可修改,可以通过用户模板覆盖同名模板
- 参考提示词网站:https://bgp.928100.xyz https://labnana.com/zh/explore
鸣谢
感谢真寻以及真寻群友提供的灵感 感谢大橘以及大橘群友提供的灵感
Metadata
Release files for nonebot-plugin-templates-draw 1.6.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| nonebot_plugin_templates_draw-1.6.1.tar.gz | 5.7 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nonebot_plugin_templates_draw-1.6.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.5 MB
Release files / nonebot_plugin_templates_draw-1.6.1.tar.gz
| Download URL | nonebot_plugin_templates_draw-1.6.1.tar.gz |
|---|---|
| Size | 5.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
34e7db78b773bd94578d9a14b773a37c4c28b695e90bf7fb2e5a04adcdfe440e
|
|
BLAKE2b-256 checksum How to use checksums |
07c89cde682db60243e3e3a50b70dafcf22534a715f15c2f9ef9f313bf2c7876
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / nonebot_plugin_templates_draw-1.6.1-py3-none-any.whl
| Download URL | nonebot_plugin_templates_draw-1.6.1-py3-none-any.whl |
|---|---|
| Size | 5.8 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d39334f0a685b14580187997ac3d7fdf23c54b65361569990b640dc5c771ddc9
|
|
BLAKE2b-256 checksum How to use checksums |
65a3cad080b2f10a86ded403ad6d96da807ccff4da9e1ee828c0368e49356110
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|