NoneBot2 plugin for AI chat with OpenAI API.
Reason this release was yanked:
Wrong Content
Project description
📖 介绍
通过调用 OpenAI API 进行多轮对话、图像生成等任务,支持 ChatGPT、Genimi、DeepSeek 等多个模型。基于 nonebot-plugin-chatgpt 插件进行修改和扩展,提供更高效的 API 调用和自定义配置。
💿 安装
使用 nb-cli 安装
在 nonebot2 项目的根目录下打开命令行,输入以下指令即可安装:nb plugin install nonebot-plugin-chatgpt-api
使用包管理器安装
在 nonebot2 项目的插件目录下,打开命令行,根据你使用的包管理器,输入相应的安装命令:pip
pip install nonebot-plugin-chatgpt-api
pdm
pdm add nonebot-plugin-chatgpt-api
poetry
poetry add nonebot-plugin-chatgpt-api
conda
conda install nonebot-plugin-chatgpt-api
打开 nonebot2 项目的 bot.py 文件,在其中写入:
nonebot.load_plugin('nonebot_plugin_chatgpt_api')
⚙️ 配置
在 nonebot2 项目的 .env 文件中添加下表中的必填配置:
| 配置项 | 必填 | 默认值 | 说明 |
|---|---|---|---|
| chatgpt_api_key | 是 | OpenAI API 的 API 密钥 | |
| chatgpt_base_url | 否 | None | OpenAI API 基础 URL(如果需要配置反向代理) |
| chatgpt_http_proxy_url | 否 | None | HTTP 代理地址 |
| chatgpt_model | 否 | gpt-4o | 使用的 ChatGPT 模型 |
| chatgpt_bot_name | 否 | ChatGPT | 机器人的名称,在一些特定的回复中会用到 |
| chatgpt_gen_args_json_file | 否 | None | 生成参数的 JSON 文件路径 |
| chatgpt_return_image | 否 | False | 是否将回复以 markdown 格式渲染为图片 |
| chatgpt_cd_time | 否 | 5 | 聊天对话的冷却时间(秒) |
| chatgpt_timeout_time_chat | 否 | 10 | 聊天的超时时间(分钟) |
| chatgpt_timeout_time_setting | 否 | 5 | 与设置相关的命令的超时时间(分钟) |
| chatgpt_timeout_respond | 否 | True | 超时后是否自动回复 |
| chatgpt_log_api_stats | 否 | True | 是否保存 API 调用统计信息 |
| chatgpt_log_system_prompt | 否 | True | 是否保存系统提示词历史 |
| chatgpt_log_chat_history | 否 | True | 是否保存对话历史 |
| chatgpt_log_path | 否 | ~/.cache/chatgpt_api_call_stats | 日志保存路径 |
🎉 使用
默认配置下,@机器人加任意文本即可开始聊天。
| 指令 | 范围 | 说明 |
|---|---|---|
| /帮助 | 群聊/私聊 | 查看插件的使用帮助 |
| @机器人 提示词 | 群聊/私聊 | 修改系统提示词 |
| @机器人 刷新 | 群聊/私聊 | 开启新的对话 |
| @机器人 恢复 | 群聊/私聊 | 恢复上次的对话 |
🤝 贡献
🎉 鸣谢
感谢以下开发者对该项目做出的贡献:
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_chatgpt_api-1.0.2.tar.gz.
File metadata
- Download URL: nonebot_plugin_chatgpt_api-1.0.2.tar.gz
- Upload date:
- Size: 17.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1dded52f86dc06cf86fc4bf814f4003c38f4f6e541b074a8ed530820466560bb
|
|
| MD5 |
0d298ce8e6ed670f8267102a551cc99b
|
|
| BLAKE2b-256 |
3648dd10567c2e6d0bfcbd449c0ca33126ec4a916fd55ba44a6535c6c243d5ca
|
File details
Details for the file nonebot_plugin_chatgpt_api-1.0.2-py3-none-any.whl.
File metadata
- Download URL: nonebot_plugin_chatgpt_api-1.0.2-py3-none-any.whl
- Upload date:
- Size: 23.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff39b6651543b84186d53b2e33898f3f49ae5bdacf86b360af048c58c23260ef
|
|
| MD5 |
561f635e72ee635847d5f630d3678926
|
|
| BLAKE2b-256 |
32b07f8f1ad1003a15c55aa9a8a48fb12f5b3bf264ed52fce61054e2a2dd92d1
|