Cosmos01 / aichat-chatGPT

HoshinoBot aichat插件魔改GPT-3.5 API版本
Apache License 2.0
51 stars 7 forks source link

import报错 #30

Closed Fhm-newbie closed 1 year ago

Fhm-newbie commented 1 year ago

[2023-03-28 11:37:10,686 nonebot] ERROR: Failed to import "hoshino.modules.aichat-chatGPT.client", error: module 'openai' has no attribute 'ChatCompletion' [2023-03-28 11:37:10,686 nonebot] ERROR: module 'openai' has no attribute 'ChatCompletion' Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/nonebot/plugin.py", line 253, in load_plugin module = importlib.import_module(module_path) File "/usr/lib/python3.8/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 975, in _find_and_load_unlocked File "", line 671, in _load_unlocked File "", line 848, in exec_module File "", line 219, in _call_with_frames_removed File "/root/HoshinoBot/hoshino/modules/aichat-chatGPT/client.py", line 6, in class Client: File "/root/HoshinoBot/hoshino/modules/aichat-chatGPT/client.py", line 7, in Client chat = openai.ChatCompletion() AttributeError: module 'openai' has no attribute 'ChatCompletion'

根据查询,说是较新版本的openai没有这个,应将 ChatCompletion改为 Completion

Fhm-newbie commented 1 year ago

然后我把client.py的那个调用改了之后确实能import了,但是艾特它只会回复发生错误:acreate

Cosmos01 commented 1 year ago

感谢提醒,我感觉不如直接回退版本吧 pip3 install openai==0.27.0

Fhm-newbie commented 1 year ago

OK,我去退一下版本