chrisyy2003 / nonebot-plugin-gpt3

A nonebot plugin base on OpenAI API (gpt-3.5-turbo)
112 stars 16 forks source link

请求适配gpt-3.5-turbo模型 #30

Open letianpai-lpt opened 1 year ago

letianpai-lpt commented 1 year ago

就在今天,OPENai更新了gpt-3.5-turbo语言模型

chrisyy2003 commented 1 year ago

在配置文件里可以自己指定语言模型的,d4e867c

letianpai-lpt commented 1 year ago

改了,这个在哪里改啊,找不见 发生错误: This is a chat model and not supported in the v1/completions endpoint. Did you mean to use v1/chat/completions?

letianpai-lpt commented 1 year ago

希望你有在适配而不是在摸鱼)

chrisyy2003 commented 1 year ago

letianpai-lpt commented 1 year ago

它这个模型的API地址变了,可能还有一些其他参数也有所调整,简而言之就是直接换模型会报错

chrisyy2003 commented 1 year ago

add gpt-3.5-turbo, 9d562e0

pip install nonebot-plugin-gpt3 -U,安装最新版

letianpai-lpt commented 1 year ago

报错如下 Screenshot_20230303102148 配置文件如下 Screenshot_20230303102316

会话如下 17767f15ab9bd69e

init文件修改过公共模式为true

YipSzeho commented 1 year ago

坏掉力

03-03 13:29:23 [INFO] nonebot | Event will be handled by Matcher(type='message', module=nonebot_plugin_gpt3)
03-03 13:29:23 [INFO] nonebot | Matcher(type='message', module=nonebot_plugin_gpt3) running complete
03-03 13:29:23 [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 361, in handle_chat
    resp = await get_user_session(session_id).get_chat_response(msg, checker(event))
  File "/root/nb/.venv/lib/python3.10/site-packages/nonebot_plugin_gpt3/__init__.py", line 112, in get_chat_response
    logger.debug(res['usage'])
TypeError: string indices must be integers
chrisyy2003 commented 1 year ago

试试1.1.3版 pip3 install nonebot-plugin-gpt3==1.1.3

YipSzeho commented 1 year ago

1.1.3读取不到key了 QH8KI_DX@BQ})P X`XFF275 Z0AM3Y}KLEX4Z_U0_L$6(9P

chrisyy2003 commented 1 year ago

改了,再看看readme,有问题可以及时反馈

hellfancy commented 1 year ago

佬,和机器人聊天出现这个是不是api-key不行了

发生错误: 
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 0x00000223C140AD00>: 
Failed to establish a new connection: [WinError 10060]
 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。'))
chrisyy2003 commented 1 year ago

佬,和机器人聊天出现这个是不是api-key不行了

发生错误: 
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 0x00000223C140AD00>: 
Failed to establish a new connection: [WinError 10060]
 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。'))

网络的问题,可能需要代理

YipSzeho commented 1 year ago

我也这样提示。之前好像直接可以用来着。大佬可以考虑加个代理设置吗・∀・

chrisyy2003 commented 1 year ago

可,不过你可以先配置命令行代理,类似于这种

export https_proxy=http://127.0.0.1:6152;
export http_proxy=http://127.0.0.1:6152;
export all_proxy=socks5://127.0.0.1:6153
YipSzeho commented 1 year ago

okok

hellfancy commented 1 year ago

这个命令行代理要咋配啊佬,目前挂服务器和本地都出问题了,昨天白天还行的,晚上到现在就不行了QAQ

chrisyy2003 commented 1 year ago

https://github.com/chrisyy2003/nonebot-plugin-gpt3/issues/31 增加了代理的配置,请查看最新的readme 56818b762242db8cbb7e0fefcbe8b647