Skip to main content

NoneBot2 plugin for AI chat

Project description

NoneBotPluginLogo

NoneBotPluginText

nonebot-plugin-chatgpt

✨ ChatGPT AI 对话 ✨

license pypi python

📖 介绍

智能对话聊天插件,核心部分参考 acheong08/ChatGPT 实现。

💿 安装

使用 nb-cli 安装 在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装
nb plugin install nonebot-plugin-chatgpt
使用包管理器安装 在 nonebot2 项目的插件目录下, 打开命令行, 根据你使用的包管理器, 输入相应的安装命令
pip
pip install nonebot-plugin-chatgpt
pdm
pdm add nonebot-plugin-chatgpt
poetry
poetry add nonebot-plugin-chatgpt
conda
conda install nonebot-plugin-chatgpt

打开 nonebot2 项目的 bot.py 文件, 在其中写入

nonebot.load_plugin('nonebot_plugin_chatgpt')

⚙️ 配置

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

配置项 必填 默认值 说明
CHATGPT_SESSION_TOKEN ChatGPT 的 session_token
CHATGPT_PROXIES None 代理地址,格式为: http://ip:port

获取 session_token

  1. 登录 https://chat.openai.com/chat
  2. F12 打开控制台
  3. 切换到 Application/应用 选项卡,找到 Cookies
  4. 复制 __Secure-next-auth.session-token 的值,配置到 CHATGPT_SESSION_TOKEN 即可

image

🎉 使用

@机器人加任意文本即可。

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-chatgpt-0.1.0.tar.gz (4.2 kB view hashes)

Uploaded Source

Built Distribution

nonebot_plugin_chatgpt-0.1.0-py3-none-any.whl (5.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page