Skip to main content

支持生成图片、编辑图片、理解图片的gemini插件

Project description

✨ nonebot-plugin-gemini-vision ✨

license pypi python ruff uv

[!IMPORTANT] 收藏项目 ~⭐️

starify

📖 介绍

支持图像分析、生成、编辑的 Gemini 对话插件,并且带有连续上下文,消息回复功能。

💿 安装

使用 nb-cli 安装 在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装
nb plugin install nonebot-plugin-gemini-vision --upgrade

使用 pypi 源安装

nb plugin install nonebot-plugin-gemini-vision --upgrade -i "https://pypi.org/simple"

使用清华源安装

nb plugin install nonebot-plugin-gemini-vision --upgrade -i "https://pypi.tuna.tsinghua.edu.cn/simple"
使用包管理器安装 在 nonebot2 项目的插件目录下, 打开命令行, 根据你使用的包管理器, 输入相应的安装命令
uv
uv add nonebot-plugin-gemini-vision

安装仓库 master 分支

uv add git+https://github.com/X-Zero-L/nonebot-plugin-gemini-vision@master
pdm
pdm add nonebot-plugin-gemini-vision

安装仓库 master 分支

pdm add git+https://github.com/X-Zero-L/nonebot-plugin-gemini-vision@master
poetry
poetry add nonebot-plugin-gemini-vision

安装仓库 master 分支

poetry add git+https://github.com/X-Zero-L/nonebot-plugin-gemini-vision@master

打开 nonebot2 项目根目录下的 pyproject.toml 文件, 在 [tool.nonebot] 部分追加写入

plugins = ["nonebot_plugin_gemini_vision"]

⚙️ 配置

在 nonebot2 项目的.env文件中添加下表中的必填配置

配置项 必填 默认值 说明
gemini_api_key Gemini API 密钥,必须提供
gemini_model "gemini-2.0-flash-exp-image-generation" Gemini 模型名称,默认使用支持图像生成的模型
http_proxy HTTP 代理,如需代理访问 API 请配置
https_proxy HTTPS 代理,如需代理访问 API 请配置

🎉 使用

指令表

指令 权限 需要@ 范围 说明
/gemini <问题> 所有人 私聊/群聊 与 Gemini 对话,可包含图片分析、编辑等功能
@gemini <问题> 所有人 私聊/群聊 同上,别名形式
/g <问题> 所有人 私聊/群聊 简短命令形式
gemini <问题> 所有人 私聊/群聊 无斜杠的简便形式
/gemini 清除历史 所有人 私聊/群聊 清除当前用户的对话历史
/gemini_help 所有人 私聊/群聊 查看帮助信息
/ghelp 所有人 私聊/群聊 查看帮助信息的简短形式

特殊功能

  • 图片分析:回复一张或多张图片发送问题,Gemini 将分析图片内容
  • 图片生成:模型支持生成图片,直接提问即可生成相关图片,也支持上传图片进行编辑
  • 连续对话:支持上下文连续对话,保持 10 分钟的会话状态
  • 清除历史:使用"清除历史"、"clear"或"exit"命令可清除会话记录

使用示例

  1. 文本对话: /gemini 介绍一下自己的功能
  2. 图片分析: 回复一张图片 + /gemini 这张图片里有什么?
  3. 图片生成: /gemini 画一幅夕阳下的海滩风景画
  4. 清除对话历史: /gemini 清除历史
  5. 查看帮助: /gemini_help

注意:图像生成功能需要使用支持该功能的 Gemini 模型,默认配置已选择支持图像生成的模型。

🎨 效果图

效果图1 效果图2 效果图3 效果图4

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_gemini_vision-1.0.1.tar.gz (9.1 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_gemini_vision-1.0.1-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file nonebot_plugin_gemini_vision-1.0.1.tar.gz.

File metadata

File hashes

Hashes for nonebot_plugin_gemini_vision-1.0.1.tar.gz
Algorithm Hash digest
SHA256 d08526b3e0cb48515d9bf9e3ee2c43ba32e5e802f96d1b19755b4d3dab4d3d96
MD5 32d72a139807b0fd953c70d81c06890d
BLAKE2b-256 a83c693b493872c3050f199518c526fcac8441c8f17d7d2d40bbb90baf9ded8c

See more details on using hashes here.

File details

Details for the file nonebot_plugin_gemini_vision-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for nonebot_plugin_gemini_vision-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 83be3884fc94434f2359798a46465e0f3d9c68942ea1a76183b6c713056aa408
MD5 d7ae1bb3cd97d74fe2f152f7ad214b83
BLAKE2b-256 f759c3f956dddd549d03de4749391e736506f500b383dbad22f356e701db17c7

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