zhayujie / chatgpt-on-wechat

基于大模型搭建的聊天机器人,同时支持 微信公众号、企业微信应用、飞书、钉钉 等接入,可选择GPT3.5/GPT-4o/GPT4.0/ Claude/文心一言/讯飞星火/通义千问/ Gemini/GLM-4/Claude/Kimi/LinkAI,能处理文本、语音和图片,访问操作系统和互联网,支持基于自有知识库进行定制企业智能客服。
https://docs.link-ai.tech/cow
MIT License
29.71k stars 7.85k forks source link

公众号运行app.py一直显示openai.error #1631

Closed shebing5 closed 1 month ago

shebing5 commented 8 months ago

前置确认

⚠️ 搜索issues中是否已存在类似问题

操作系统类型?

Linux

运行的python版本是?

python 3.8

使用的chatgpt-on-wechat版本是?

Latest Release

运行的channel类型是?

wechatmp(公众号, 订阅号)

复现步骤 🕹

是不是程序有问题啊,微信公众号每次卡在bot 你好 [INFO][2023-12-27 16:33:07][bridge.py:49] - create bot chatGPT for chat [ERROR][2023-12-27 16:33:07][wechatmp_channel.py:233] - [wechatmp] Fail to generate reply to user, msgId=24391045656748517, exception=No module named 'openai.error' Traceback (most recent call last): File "/usr/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, *self.kwargs) File "/home/ubuntu/chatgpt-on-wechat/channel/chat_channel.py", line 168, in _handle reply = self._generate_reply(context) File "/home/ubuntu/chatgpt-on-wechat/channel/chat_channel.py", line 178, in _generate_reply e_context = PluginManager().emit_event( File "/home/ubuntu/chatgpt-on-wechat/plugins/plugin_manager.py", line 189, in emit_event instance.handlers[e_context.event](e_context, args, **kwargs) File "/home/ubuntu/chatgpt-on-wechat/plugins/role/role.py", line 104, in on_handle_context bot = Bridge().get_bot("chat") File "/home/ubuntu/chatgpt-on-wechat/bridge/bridge.py", line 55, in get_bot self.bots[typename] = create_bot(self.btype[typename]) File "/home/ubuntu/chatgpt-on-wechat/bot/bot_factory.py", line 22, in create_bot from bot.chatgpt.chat_gpt_bot import ChatGPTBot File "/home/ubuntu/chatgpt-on-wechat/bot/chatgpt/chat_gpt_bot.py", line 6, in import openai.error ModuleNotFoundError: No module named 'openai.error'

问题描述 😯

微信公众号openai3.5模型调用,出现问题,一直卡在ModuleNotFoundError: No module named 'openai.error',

终端日志 📒


<此处粘贴终端日志>
```[INFO][2023-12-27 16:32:00][app.py:17] - signal 2 received, exiting...
[INFO][2023-12-27 16:32:00][config.py:208] - [Config] User datas saved.
[INFO][2023-12-27 16:33:01][config.py:249] - [INIT] load config: {'channel_type': 'wechatmp', 'model': 'gpt-3.5-turbo',>[INFO][2023-12-27 16:33:01][config.py:197] - [Config] User datas loaded.
[WARNING][2023-12-27 16:33:01][audio_convert.py:9] - import pysilk failed, wechaty voice message will not be supported.
[INFO][2023-12-27 16:33:01][plugin_manager.py:50] - Loading plugins config...
[INFO][2023-12-27 16:33:01][plugin_manager.py:88] - Scaning plugins ...
[INFO][2023-12-27 16:33:01][plugin_manager.py:41] - Plugin Keyword_v0.1 registered, path=./plugins/keyword
[INFO][2023-12-27 16:33:01][plugin_manager.py:41] - Plugin Role_v1.0 registered, path=./plugins/role
[INFO][2023-12-27 16:33:01][plugin_manager.py:41] - Plugin Finish_v1.0 registered, path=./plugins/finish
[WARNING][2023-12-27 16:33:01][plugin_manager.py:113] - Failed to import plugin tool: No module named 'chatgpt_tool_hub'[INFO][2023-12-27 16:33:01][plugin_manager.py:41] - Plugin Banwords_v1.0 registered, path=./plugins/banwords
[INFO][2023-12-27 16:33:01][plugin_manager.py:41] - Plugin Hello_v0.1 registered, path=./plugins/hello
[INFO][2023-12-27 16:33:01][plugin_manager.py:41] - Plugin BDunit_v0.1 registered, path=./plugins/bdunit
[INFO][2023-12-27 16:33:01][plugin_manager.py:41] - Plugin Dungeon_v1.0 registered, path=./plugins/dungeon
[INFO][2023-12-27 16:33:01][plugin_manager.py:41] - Plugin Godcmd_v1.0 registered, path=./plugins/godcmd
[INFO][2023-12-27 16:33:01][plugin_manager.py:41] - Plugin linkai_v0.1.0 registered, path=./plugins/linkai
[INFO][2023-12-27 16:33:01][godcmd.py:194] - [Godcmd] 因未设置口令,本次的临时口令为7289。
[INFO][2023-12-27 16:33:01][godcmd.py:210] - [Godcmd] inited
[INFO][2023-12-27 16:33:01][keyword.py:40] - [keyword] {}
[INFO][2023-12-27 16:33:01][keyword.py:42] - [keyword] inited.
[INFO][2023-12-27 16:33:01][linkai.py:33] - [LinkAI] inited, config={'group_app_map': {'测试群名1': 'default', '测试群[>[INFO][2023-12-27 16:33:01][role.py:69] - [Role] inited
[INFO][2023-12-27 16:33:01][dungeon.py:56] - [Dungeon] inited
[INFO][2023-12-27 16:33:01][hello.py:24] - [Hello] inited
[INFO][2023-12-27 16:33:01][finish.py:23] - [Finish] inited
[INFO][2023-12-27 16:33:07][passive_reply.py:97] - [wechatmp] Request 1 from o9kwx52DsD8ljpY2_8BkbO6AoXP4 2439104565674>bot 你好
[INFO][2023-12-27 16:33:07][bridge.py:49] - create bot chatGPT for chat
[ERROR][2023-12-27 16:33:07][wechatmp_channel.py:233] - [wechatmp] Fail to generate reply to user, msgId=24391045656748>Traceback (most recent call last):
  File "/usr/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/ubuntu/chatgpt-on-wechat/channel/chat_channel.py", line 168, in _handle
    reply = self._generate_reply(context)
  File "/home/ubuntu/chatgpt-on-wechat/channel/chat_channel.py", line 178, in _generate_reply
    e_context = PluginManager().emit_event(
  File "/home/ubuntu/chatgpt-on-wechat/plugins/plugin_manager.py", line 189, in emit_event
    instance.handlers[e_context.event](e_context, *args, **kwargs)
  File "/home/ubuntu/chatgpt-on-wechat/plugins/role/role.py", line 104, in on_handle_context
    bot = Bridge().get_bot("chat")
  File "/home/ubuntu/chatgpt-on-wechat/bridge/bridge.py", line 55, in get_bot
    self.bots[typename] = create_bot(self.btype[typename])
  File "/home/ubuntu/chatgpt-on-wechat/bot/bot_factory.py", line 22, in create_bot
    from bot.chatgpt.chat_gpt_bot import ChatGPTBot
  File "/home/ubuntu/chatgpt-on-wechat/bot/chatgpt/chat_gpt_bot.py", line 6, in <module>
    import openai.error
ModuleNotFoundError: No module named 'openai.error'
[INFO][2023-12-27 16:33:53][app.py:17] - signal 2 received, exiting...
[INFO][2023-12-27 16:33:53][config.py:208] - [Config] User datas saved.
huajianxiaowanzi commented 8 months ago

openai版本要和作者的一致,新版本移除了openai.error

haohaode11 commented 7 months ago

openai版本要和作者的一致,新版本移除了openai.error

请问这里的openai版本是指的哪个版本呢 我是直接从git克隆的作者的项目到本地部署的 错误提示跟上面这位大哥一样 也是显示没有openai.error模块

haohaode11 commented 7 months ago

我也是这个错误提示 微信扫码登陆后 个微群聊艾特时出现日志 ModuleNotFoundError: No module named 'openai.error'

huajianxiaowanzi commented 7 months ago

openai版本要和作者的一致,新版本移除了openai.error

请问这里的openai版本是指的哪个版本呢 我是直接从git克隆的作者的项目到本地部署的 错误提示跟上面这位大哥一样 也是显示没有openai.error模块

要和作者的版本一致,你看一下你的版本,应该不是作者那个版本

LoveClears commented 1 month ago

openai版本要和作者的一致,新版本移除了openai.error

请问这里的openai版本是指的哪个版本呢 我是直接从git克隆的作者的项目到本地部署的 错误提示跟上面这位大哥一样 也是显示没有openai.error模块

要和作者的版本一致,你看一下你的版本,应该不是作者那个版本

大佬如何查看作者版本的openai啊?

LoveClears commented 1 month ago

我也是这个错误提示 微信扫码登陆后 个微群聊艾特时出现日志 ModuleNotFoundError: No module named 'openai.error'

请问解决了吗!!!

huajianxiaowanzi commented 1 month ago

openai版本要和作者的一致,新版本移除了openai.error

请问这里的openai版本是指的哪个版本呢 我是直接从git克隆的作者的项目到本地部署的 错误提示跟上面这位大哥一样 也是显示没有openai.error模块

要和作者的版本一致,你看一下你的版本,应该不是作者那个版本

大佬如何查看作者版本的openai啊?

pip show openai

huajianxiaowanzi commented 1 month ago

openai版本要和作者的一致,新版本移除了openai.error

请问这里的openai版本是指的哪个版本呢 我是直接从git克隆的作者的项目到本地部署的 错误提示跟上面这位大哥一样 也是显示没有openai.error模块

要和作者的版本一致,你看一下你的版本,应该不是作者那个版本

大佬如何查看作者版本的openai啊?

pip show openai

作者是openai==0.27.8,你的版本应该更新,先卸载pip uninstall openai,再重装pip install openai==0.27.8

LoveClears commented 1 month ago

openai 版本要和作者的一致,新版本删除了 openai.error

请问这里的openai版本是指哪个版本呢 我是直接从git克隆作者的项目到本地部署的错误提示跟上面没有这位大哥一样也显示openai.error模块

要和作者的版本一致,你看一下你的版本,应该不是作者那个版本

大佬如何查看作者版本的openai啊?

pip 显示 openai

作者是openai==0.27.8,你的版本应该更新,先卸载pip uninstall openai,再重装pip install openai==0.27.8

非常感谢回复!!!再请教一下,有遇到过吗 钉钉调用以后,出现这个[WARNING][2024-07-22 08:47:14][session_manager.py:72] - Exception when counting tokens precisely for prompt: No module named 'tiktoken'

module 是gpt-4 我每次看openapi的官网,发现也是有调用过的