nonebot-plugin-chatgpt-turbo


Namenonebot-plugin-chatgpt-turbo JSON
Version 0.3.0 PyPI version JSON
download
home_page
SummaryA nonebot plugin for openai gpt3.5-turbo
upload_time2023-03-27 02:13:00
maintainer
docs_urlNone
authorAlpaca
requires_python>=3.8,<4.0
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="center">
  <a href="https://v2.nonebot.dev/store"><img src="https://github.com/A-kirami/nonebot-plugin-template/blob/resources/nbp_logo.png" width="180" height="180" alt="NoneBotPluginLogo"></a>
  <br>
  <p><img src="https://github.com/A-kirami/nonebot-plugin-template/blob/resources/NoneBotPlugin.svg" width="240" alt="NoneBotPluginText"></p>
</div>

<div align="center">

# nonebot-plugin-chatgpt-turbo
</div>

# 介绍
- 本插件适配OpenAI在2023年3月1日发布的最新版API,可以在nonebot中调用OpenAI的ChatGPT生产环境下的模型(GPT3.5-turbo)进行回复。
- 接口调用速度与网络环境有关,经过测试,大陆外的服务器的OpenAI API响应时间能在十秒之内。
- 免费版OpenAI的调用速度限制为20次/min
- 本插件具有上下文回复功能(可选),根据每个成员与机器人最近30条(可修改)的聊天记录进行响应回复,该功能消耗服务器资源较大
# 安装

* 手动安装
  ```
  git clone https://github.com/Alpaca4610/nonebot_plugin_chatgpt_turbo.git
  ```

  下载完成后在bot项目的pyproject.toml文件手动添加插件:

  ```
  plugin_dirs = ["xxxxxx","xxxxxx",......,"下载完成的插件路径/nonebot-plugin-gpt3.5-turbo"]
  ```
* 使用 pip
  ```
  pip install nonebot-plugin-chatgpt-turbo
  ```

# 配置文件

在Bot根目录下的.env文件中追加如下内容:

```
OPENAI_API_KEY = key
OPENAI_MODEL_NAME = "gpt-3.5-turbo"
OPENAI_HTTP_PROXY = "http://127.0.0.1:8001"    # 请使用代理访问api,中国大陆/香港IP调用API有几率会被封禁
```

可选内容:
```
OPENAI_MAX_HISTORY_LIMIT = 30   # 保留与每个用户的聊天记录条数
ENABLE_PRIVATE_CHAT = True   # 私聊开关,默认开启,改为False关闭
```


# 使用方法

- @机器人发送问题时机器人不具有上下文回复的能力
- chat 使用该命令进行问答时,机器人具有上下文回复的能力
- clear 清除当前用户的聊天记录

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "nonebot-plugin-chatgpt-turbo",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Alpaca",
    "author_email": "alpaca@bupt.edu.cn",
    "download_url": "https://files.pythonhosted.org/packages/4e/3d/844484209853658b3f031528c4977aee12c6510bbf9fedd45b97d971e8ef/nonebot_plugin_chatgpt_turbo-0.3.0.tar.gz",
    "platform": null,
    "description": "<div align=\"center\">\n  <a href=\"https://v2.nonebot.dev/store\"><img src=\"https://github.com/A-kirami/nonebot-plugin-template/blob/resources/nbp_logo.png\" width=\"180\" height=\"180\" alt=\"NoneBotPluginLogo\"></a>\n  <br>\n  <p><img src=\"https://github.com/A-kirami/nonebot-plugin-template/blob/resources/NoneBotPlugin.svg\" width=\"240\" alt=\"NoneBotPluginText\"></p>\n</div>\n\n<div align=\"center\">\n\n# nonebot-plugin-chatgpt-turbo\n</div>\n\n# \u4ecb\u7ecd\n- \u672c\u63d2\u4ef6\u9002\u914dOpenAI\u57282023\u5e743\u67081\u65e5\u53d1\u5e03\u7684\u6700\u65b0\u7248API\uff0c\u53ef\u4ee5\u5728nonebot\u4e2d\u8c03\u7528OpenAI\u7684ChatGPT\u751f\u4ea7\u73af\u5883\u4e0b\u7684\u6a21\u578b\uff08GPT3.5-turbo\uff09\u8fdb\u884c\u56de\u590d\u3002\n- \u63a5\u53e3\u8c03\u7528\u901f\u5ea6\u4e0e\u7f51\u7edc\u73af\u5883\u6709\u5173\uff0c\u7ecf\u8fc7\u6d4b\u8bd5\uff0c\u5927\u9646\u5916\u7684\u670d\u52a1\u5668\u7684OpenAI API\u54cd\u5e94\u65f6\u95f4\u80fd\u5728\u5341\u79d2\u4e4b\u5185\u3002\n- \u514d\u8d39\u7248OpenAI\u7684\u8c03\u7528\u901f\u5ea6\u9650\u5236\u4e3a20\u6b21/min\n- \u672c\u63d2\u4ef6\u5177\u6709\u4e0a\u4e0b\u6587\u56de\u590d\u529f\u80fd(\u53ef\u9009)\uff0c\u6839\u636e\u6bcf\u4e2a\u6210\u5458\u4e0e\u673a\u5668\u4eba\u6700\u8fd130\u6761\uff08\u53ef\u4fee\u6539\uff09\u7684\u804a\u5929\u8bb0\u5f55\u8fdb\u884c\u54cd\u5e94\u56de\u590d,\u8be5\u529f\u80fd\u6d88\u8017\u670d\u52a1\u5668\u8d44\u6e90\u8f83\u5927\n# \u5b89\u88c5\n\n* \u624b\u52a8\u5b89\u88c5\n  ```\n  git clone https://github.com/Alpaca4610/nonebot_plugin_chatgpt_turbo.git\n  ```\n\n  \u4e0b\u8f7d\u5b8c\u6210\u540e\u5728bot\u9879\u76ee\u7684pyproject.toml\u6587\u4ef6\u624b\u52a8\u6dfb\u52a0\u63d2\u4ef6\uff1a\n\n  ```\n  plugin_dirs = [\"xxxxxx\",\"xxxxxx\",......,\"\u4e0b\u8f7d\u5b8c\u6210\u7684\u63d2\u4ef6\u8def\u5f84/nonebot-plugin-gpt3.5-turbo\"]\n  ```\n* \u4f7f\u7528 pip\n  ```\n  pip install nonebot-plugin-chatgpt-turbo\n  ```\n\n# \u914d\u7f6e\u6587\u4ef6\n\n\u5728Bot\u6839\u76ee\u5f55\u4e0b\u7684.env\u6587\u4ef6\u4e2d\u8ffd\u52a0\u5982\u4e0b\u5185\u5bb9\uff1a\n\n```\nOPENAI_API_KEY = key\nOPENAI_MODEL_NAME = \"gpt-3.5-turbo\"\nOPENAI_HTTP_PROXY = \"http://127.0.0.1:8001\"    # \u8bf7\u4f7f\u7528\u4ee3\u7406\u8bbf\u95eeapi\uff0c\u4e2d\u56fd\u5927\u9646/\u9999\u6e2fIP\u8c03\u7528API\u6709\u51e0\u7387\u4f1a\u88ab\u5c01\u7981\n```\n\n\u53ef\u9009\u5185\u5bb9\uff1a\n```\nOPENAI_MAX_HISTORY_LIMIT = 30   # \u4fdd\u7559\u4e0e\u6bcf\u4e2a\u7528\u6237\u7684\u804a\u5929\u8bb0\u5f55\u6761\u6570\nENABLE_PRIVATE_CHAT = True   # \u79c1\u804a\u5f00\u5173\uff0c\u9ed8\u8ba4\u5f00\u542f\uff0c\u6539\u4e3aFalse\u5173\u95ed\n```\n\n\n# \u4f7f\u7528\u65b9\u6cd5\n\n- @\u673a\u5668\u4eba\u53d1\u9001\u95ee\u9898\u65f6\u673a\u5668\u4eba\u4e0d\u5177\u6709\u4e0a\u4e0b\u6587\u56de\u590d\u7684\u80fd\u529b\n- chat \u4f7f\u7528\u8be5\u547d\u4ee4\u8fdb\u884c\u95ee\u7b54\u65f6\uff0c\u673a\u5668\u4eba\u5177\u6709\u4e0a\u4e0b\u6587\u56de\u590d\u7684\u80fd\u529b\n- clear \u6e05\u9664\u5f53\u524d\u7528\u6237\u7684\u804a\u5929\u8bb0\u5f55\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A nonebot plugin for openai gpt3.5-turbo",
    "version": "0.3.0",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0c3e7c4b6ecd66575ca4e1633d331327b3d7dbd16f7c9c79ebf9cf1753092c18",
                "md5": "5f07488a9dbc29b140143d79de709b49",
                "sha256": "8e93a86dd85ba2f79a519b04c3eb950435005d19a255a93f433c63469f396d8a"
            },
            "downloads": -1,
            "filename": "nonebot_plugin_chatgpt_turbo-0.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5f07488a9dbc29b140143d79de709b49",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4.0",
            "size": 8770,
            "upload_time": "2023-03-27T02:12:58",
            "upload_time_iso_8601": "2023-03-27T02:12:58.838396Z",
            "url": "https://files.pythonhosted.org/packages/0c/3e/7c4b6ecd66575ca4e1633d331327b3d7dbd16f7c9c79ebf9cf1753092c18/nonebot_plugin_chatgpt_turbo-0.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4e3d844484209853658b3f031528c4977aee12c6510bbf9fedd45b97d971e8ef",
                "md5": "c648338a6731c86dd52d63624bc2cb89",
                "sha256": "64fd84ec235ac04d2bac310eee2b0a4c3585f0b156dde7049b6e27d40220a588"
            },
            "downloads": -1,
            "filename": "nonebot_plugin_chatgpt_turbo-0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "c648338a6731c86dd52d63624bc2cb89",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4.0",
            "size": 7238,
            "upload_time": "2023-03-27T02:13:00",
            "upload_time_iso_8601": "2023-03-27T02:13:00.580511Z",
            "url": "https://files.pythonhosted.org/packages/4e/3d/844484209853658b3f031528c4977aee12c6510bbf9fedd45b97d971e8ef/nonebot_plugin_chatgpt_turbo-0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-27 02:13:00",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "nonebot-plugin-chatgpt-turbo"
}
        
Elapsed time: 0.05758s