Code Monkey home page Code Monkey logo

nonebot-plugin-gpt3's Introduction

  • 👋 Hi, I’m @chrisyy
  • 👀 I’m interested in crypto/blockchain/minecraft
  • 🌱 I’m currently working in web3

Anurag's GitHub stats

nonebot-plugin-gpt3's People

Contributors

chrisyy2003 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

nonebot-plugin-gpt3's Issues

问个key错误的问题

我这里全部都配置好之后请求聊天,但是chatgpt接口返回提示:

 发生错误: Incorrect API key provided: sk-hZr8S***************************************iYP8. You can find your API key at https://beta.openai.com.

我确认我的key完全正确没有错误,所以这是什么鬼,重新生成了好几次也还是key返回错误
你们有遇见这种怪问题吗
怎么解决的

pydantic.error_wrappers.ValidationError: 1 validation error for Config

02-25 16:12:14 [ERROR] nonebot | Failed to import "nonebot_plugin_gpt3"
Traceback (most recent call last):
File "", line 14, in
File "/opt/openai-bot/.venv/lib/python3.9/site-packages/nonebot/plugin/load.py", line 122, in load_from_toml
return load_all_plugins(plugins, plugin_dirs)
File "/opt/openai-bot/.venv/lib/python3.9/site-packages/nonebot/plugin/load.py", line 59, in load_all_plugins
return manager.load_all_plugins()
File "/opt/openai-bot/.venv/lib/python3.9/site-packages/nonebot/plugin/manager.py", line 168, in load_all_plugins
return set(
File "/opt/openai-bot/.venv/lib/python3.9/site-packages/nonebot/plugin/manager.py", line 169, in
filter(None, (self.load_plugin(name) for name in self.available_plugins))

File "/opt/openai-bot/.venv/lib/python3.9/site-packages/nonebot/plugin/manager.py", line 141, in load_plugin
module = importlib.import_module(name)
File "/usr/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "/opt/openai-bot/.venv/lib/python3.9/site-packages/nonebot/plugin/manager.py", line 233, in exec_module
super().exec_module(module)
File "", line 790, in exec_module
File "", line 228, in _call_with_frames_removed
File "/opt/openai-bot/.venv/lib/python3.9/site-packages/nonebot_plugin_gpt3/init.py", line 10, in
from .config import *
File "/opt/openai-bot/.venv/lib/python3.9/site-packages/nonebot_plugin_gpt3/config.py", line 24, in
config = Config.parse_obj(global_config)
File "pydantic/main.py", line 527, in pydantic.main.BaseModel.parse_obj
return cls(**obj)
File "pydantic/env_settings.py", line 39, in pydantic.env_settings.BaseSettings.init
super().init(
File "pydantic/main.py", line 342, in pydantic.main.BaseModel.init
raise validation_error
pydantic.error_wrappers.ValidationError: 1 validation error for Config
gpt3_api_key_list_from_env
value is not a valid list (type=type_error.list)
image

系统环境&软件版本:Python3.9、Debian11、NoneBot2

bug:部分qq号消息无法响应

03-08 16:43:12 [SUCCESS] nonebot | ONEBOT V11 2545044071 | [message.group.normal]: Message 470695935 from 1270217000@[群:925353737] 'gpt 原神是否有抄袭塞尔达'
03-08 16:43:12 [INFO] nonebot | Event message.group.normal is ignored

请求token长度大于模型最大token长度

  • 插件版本:1.1.3
  • openai版本:0.27.0
  • 模型版本:gpt-3.5-turbo

在聊天开始时,会有概率出现请求token长度大于模型最大token长度的情况,如下图所示。

1678028941763

1678028941756

频率控制需求

建议新增个人维度的每天提问次数CD限制,方便控制频率,不然免费API额度很快会被用完

人格设置没有反应?

向机器人发送设置人格的指令后机器人不处理指令。而重置人格的指令可以正常处理
54E8B03A92CED16A1DC78F1B73FEED23

服务器过载后对话就重置了

服务器过载后会话报错:
发生错误: The server is overloaded or not ready yet.
或者:
V)ZA1IVI@_0}4ARF55J87
之后对话就重置了,请问有解决方法吗,比如多设置几个key

插件正常启动,但触发对话后报错

03-01 14:22:27 [INFO] nonebot | Event will be handled by Matcher(type='message', module=nonebot_plugin_gpt3)
03-01 14:22:27 [INFO] nonebot | Matcher(type='message', module=nonebot_plugin_gpt3) running complete
03-01 14:22:27 [ERROR] nonebot | Running Matcher(type='message', module=nonebot_plugin_gpt3) failed.
Traceback (most recent call last):
  File "<string>", line 17, in <module>
  File "/root/nb/.venv/lib/python3.10/site-packages/nonebot/__init__.py", line 273, in run
    get_driver().run(*args, **kwargs)
  File "/root/nb/.venv/lib/python3.10/site-packages/nonebot/drivers/fastapi.py", line 187, in run
    uvicorn.run(
  File "/root/nb/.venv/lib/python3.10/site-packages/uvicorn/main.py", line 569, in run
    server.run()
  File "/root/nb/.venv/lib/python3.10/site-packages/uvicorn/server.py", line 60, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/root/nb/.venv/lib/python3.10/site-packages/nonebot/message.py", line 141, in _check_matcher
    await _run_matcher(Matcher, bot, event, state, stack, dependency_cache)
> File "/root/nb/.venv/lib/python3.10/site-packages/nonebot/message.py", line 187, in _run_matcher
    await matcher.run(bot, event, state, stack, dependency_cache)
  File "/root/nb/.venv/lib/python3.10/site-packages/nonebot/internal/matcher/matcher.py", line 732, in run
    await self.simple_run(bot, event, state, stack, dependency_cache)
  File "/root/nb/.venv/lib/python3.10/site-packages/nonebot/internal/matcher/matcher.py", line 707, in simple_run
    await handler(
  File "/root/nb/.venv/lib/python3.10/site-packages/nonebot/dependencies/__init__.py", line 108, in __call__
    return await cast(Callable[..., Awaitable[R]], self.call)(**values)
  File "/root/nb/.venv/lib/python3.10/site-packages/nonebot_plugin_gpt3/__init__.py", line 335, in handle_chat
    resp = await get_user_session(session_id).get_chat_response(msg)
TypeError: Session.get_chat_response() missing 1 required positional argument: 'is_admin'

回复error

发送消息,机器人回复error,是哪里出错了。日志如下

06-27 15:22:48 [SUCCESS] nonebot | OneBot V11 3568483338 | [message.private.friend]: Message 971437277 from '.xxx'
06-27 15:22:48 [DEBUG] nonebot | Checking for matchers in priority 10...
06-27 15:22:48 [DEBUG] nonebot | Checking for matchers in priority 100...
06-27 15:22:48 [INFO] nonebot | Event will be handled by Matcher(type='message', module=nonebot_plugin_gpt3)
06-27 15:22:48 [DEBUG] nonebot | Running Matcher(type='message', module=nonebot_plugin_gpt3)
06-27 15:22:48 [DEBUG] nonebot | Running handler Dependent(call=_)
06-27 15:22:49 [DEBUG] nonebot | OneBot V11 | Calling API send_msg
06-27 15:22:49 [INFO] nonebot | Matcher(type='message', module=nonebot_plugin_gpt3) running complete
06-27 15:22:49 [DEBUG] nonebot | Stop event propagation
06-27 15:22:49 [DEBUG] nonebot | Checking for matchers completed

人格设置问题

关于人格设置 我输入了人格设置 猫娘 机器人给的反应是全局人格设置成功 但是其实人格还是AI助手 而且有时候设置还会出现双重人格
我是AI猫娘这种情况... 不知道是我的问题还是此插件的bug 我已经重新卸载安装后依然如此 而且不知道该插件是否支持自定义人格保存呢

机器人不会在群里回信息,但服务器捕获到了

02-22 18:49:15 [INFO] nonebot_plugin_gocqhttp | [机器人QQ] 收到群 群名(群号) 内 群友(群友QQ号) 的消息: /gpt3 (-562778938)
02-22 18:49:15 [SUCCESS] nonebot | OneBot V11 3463402239 | [message.group.normal]: Message -562778938 from 群友QQ号@[群:群号] '/gpt3'
02-22 18:49:15 [INFO] nonebot | Event will be handled by Matcher(type='message', module=nonebot_plugin_gpt3)
02-22 18:49:15 [INFO] nonebot | Matcher(type='message', module=nonebot_plugin_gpt3) running complete

加载插件后无法启动机器人

使用pip install nonebot-plugin-gpt3 playwright -U安装插件并在bot.py里加上nonebot.load_plugin('nonebot_plugin_gpt3')后,bot无法启动,发生如下报错
image

已经下载了README.md里的rustup-steup.exe并安装,但是没有手动配置环境变量,在cmd中输入rustup -V后有以下输出:
rustup 1.25.1 (bb60b1e89 2022-07-12)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active rustc version is rustc 1.66.0 (69f9c33d7 2022-12-12)

链接超时错误

发生错误: Request timed out: HTTPSConnectionPool(host='api.openai.com', port=443): Max retries exceeded with url: /v1/chat/completions (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x000002406F0B8C10>, 'Connection to api.openai.com timed out. (connect timeout=600)'))
QQ图片20230306152959

显示未配置APIKEY

自己配置好所有的文件之后跑起来报错未配置apikey,检查之后apikey是已经填写并保存的状态,劳烦大佬看看是什么问题
以下是运行时控制台的显示内容
(kugel) D:\kugelblyat\mai-bot-main>python bot.py
04-13 08:45:54 [SUCCESS] nonebot | NoneBot is initializing...
04-13 08:45:54 [INFO] nonebot | Current Env: dev
04-13 08:45:55 [WARNING] nonebot_plugin_gpt3 | 没有配置api key
04-13 08:45:55 [INFO] nonebot_plugin_gpt3 | 加载代理: 无
04-13 08:45:55 [INFO] nonebot_plugin_gpt3 | 加载默认人格:
04-13 08:45:55 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_gpt3"
04-13 08:45:57 [SUCCESS] nonebot | Succeeded to load plugin "maimaidx" from "src.plugins.maimaidx"
04-13 08:45:57 [SUCCESS] nonebot | Succeeded to load plugin "public" from "src.plugins.public"
04-13 08:45:57 [SUCCESS] nonebot | Running NoneBot...
04-13 08:45:57 [INFO] uvicorn | Started server process [2588]
04-13 08:45:57 [INFO] uvicorn | Waiting for application startup.
04-13 08:45:57 [INFO] uvicorn | Application startup complete.
04-13 08:45:57 [INFO] uvicorn | Uvicorn running on http://127.0.0.1:10219 (Press CTRL+C to quit)
04-13 08:46:00 [INFO] uvicorn | ('127.0.0.1', 60610) - "WebSocket /onebot/v11/ws" [accepted]
04-13 08:46:02 [INFO] nonebot | OneBot V11 | Bot 1976405702 connected
04-13 08:46:02 [INFO] websockets | connection open
apikey文件位置正确里面的api也是自己填写好了的

nonebot | Running Matcher(type='message', module=nonebot_plugin_gpt3) failed. Traceback (most recent call last):

01-11 12:56:36 [SUCCESS] nonebot | OneBot V11 738386129 | [message.private.friend]: Message 1516341372 from 3258447421 "/gpt3 你好"
01-11 12:56:36 [INFO] nonebot | Event will be handled by Matcher(type='message', module=nonebot_plugin_gpt3)
01-11 12:56:36 [INFO] nonebot | Matcher(type='message', module=nonebot_plugin_gpt3) running complete
01-11 12:56:36 [ERROR] nonebot | Running Matcher(type='message', module=nonebot_plugin_gpt3) failed.
Traceback (most recent call last):
File "c:\Zsy_files\Zsy_bot\ghcp\Zsybot\bot.py", line 59, in
nonebot.run(app="mp_main:app")
File "C:\Zsy_files\Python\lib\site-packages\nonebot_init_.py", line 273, in run
get_driver().run(*args, **kwargs)
File "C:\Zsy_files\Python\lib\site-packages\nonebot\drivers\fastapi.py", line 172,
in run
uvicorn.run(
File "C:\Zsy_files\Python\lib\site-packages\uvicorn\main.py", line 569, in run
server.run()
File "C:\Zsy_files\Python\lib\site-packages\uvicorn\server.py", line 60, in run
return asyncio.run(self.serve(sockets=sockets))
File "C:\Zsy_files\Python\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Zsy_files\Python\lib\asyncio\base_events.py", line 636, in run_until_complete
self.run_forever()
File "C:\Zsy_files\Python\lib\asyncio\windows_events.py", line 321, in run_forever
super().run_forever()
File "C:\Zsy_files\Python\lib\asyncio\base_events.py", line 603, in run_forever
self._run_once()
File "C:\Zsy_files\Python\lib\asyncio\base_events.py", line 1899, in _run_once
handle._run()
File "C:\Zsy_files\Python\lib\asyncio\events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "C:\Zsy_files\Python\lib\site-packages\nonebot\message.py", line 142, in _check_matcher
await _run_matcher(Matcher, bot, event, state, stack, dependency_cache)

File "C:\Zsy_files\Python\lib\site-packages\nonebot\message.py", line 188, in run_matcher
await matcher.run(bot, event, state, stack, dependency_cache)
File "C:\Zsy_files\Python\lib\site-packages\nonebot\internal\matcher\matcher.py", line 727, in run
await self.simple_run(bot, event, state, stack, dependency_cache)
File "C:\Zsy_files\Python\lib\site-packages\nonebot\internal\matcher\matcher.py", line 702, in simple_run
await handler(
File "C:\Zsy_files\Python\lib\site-packages\nonebot\dependencies_init
.py", line 108, in call
return await cast(Callable[..., Awaitable[R]], self.call)(**values)
File "C:\Zsy_files\Python\lib\site-packages\nonebot_plugin_gpt3_init_.py", line
169, in _
resp = await get_user_session(session_id).get_chat_response(msg)
File "C:\Zsy_files\Python\lib\site-packages\nonebot_plugin_gpt3_init_.py", line
81, in get_chat_response
if ok:
UnboundLocalError: local variable 'ok' referenced before assignment

发生请求错误

image
配置文件:
GPT3_API_KEY_LIST_FROM_ENV=["sk-****rMrwn"]
gpt3_model = 'gpt-3.5-turbo' # 语言模型
gpt3_command_prefix = "c" # 基本触发命令
gpt3_need_at = False # 是否需要@才触发命令
gpt3_image_render = True # 是否需要将回答渲染为图片
gpt3_image_limit = 100 # 长度超过多少才会渲染成图片
gpt3_max_tokens = 400 # 返回回答的最大长度

image
这样之后就没动静了

是网络问题吗?

多线程访问,多API Keys报错, 全ban账号出错。

 之前询问过作者关于“You requested a model that is not compatible with this engine.”的报错,后来发现是单IP使用多个API同时遍历访问时速度过快会导致openai官方ban掉所有的api, 作者能否考虑重写逻辑? 在不使用proxy的情况下,比如说重复使用单个账号(可能出现速度报错)一直到余额耗尽,换下一个账号。

插件未运行

插件已经加载了,key已经输入了,切换人格的什么都能用,但是那个对话消息就是触发不了,后台好像也显示没有反应
Uploading Screenshot_20230112_173721 Screenshot_20230113_100027_mark via .jpg…

Error communicating with OpenAI

发生错误: Error communicating with OpenAI: HTTPSConnectionPool(host='api.openai.com', port=443): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x0000029AA7BEEB20>: Failed to establish a new connection: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。'))

大佬你好,请问一下这个报错是因为API被墙的缘故吗,配置文件里可以支持写代理吗

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.