TheExplainthis / ChatGPT-Discord-Bot

This is a repository that allows you to integrate ChatGPT into Discord.
MIT License
569 stars 1.19k forks source link

module 'openai' has no attribute 'ChatCompletion' #3

Open freefrank opened 1 year ago

freefrank commented 1 year ago
discord-chatgpt-ai-assistant  | [2023-03-09 20:06:50] [ERROR   ] discord.app_commands.tree: Ignoring exception in command 'chat'
discord-chatgpt-ai-assistant  | Traceback (most recent call last):
discord-chatgpt-ai-assistant  |   File "/usr/local/lib/python3.9/site-packages/discord/app_commands/commands.py", line 862, in _do_call
discord-chatgpt-ai-assistant  |     return await self._callback(interaction, **params)  # type: ignore
discord-chatgpt-ai-assistant  |   File "/DiscordBot/main.py", line 33, in chat
discord-chatgpt-ai-assistant  |     receive = chatgpt.get_response(user_id, message)
discord-chatgpt-ai-assistant  |   File "/DiscordBot/src/chatgpt.py", line 12, in get_response
discord-chatgpt-ai-assistant  |     response = self.model.chat_completion(self.memory.get(user_id))
discord-chatgpt-ai-assistant  |   File "/DiscordBot/src/models.py", line 20, in chat_completion
discord-chatgpt-ai-assistant  |     response = openai.ChatCompletion.create(
discord-chatgpt-ai-assistant  | AttributeError: module 'openai' has no attribute 'ChatCompletion'
discord-chatgpt-ai-assistant  |
discord-chatgpt-ai-assistant  | The above exception was the direct cause of the following exception:
discord-chatgpt-ai-assistant  |
discord-chatgpt-ai-assistant  | Traceback (most recent call last):
discord-chatgpt-ai-assistant  |   File "/usr/local/lib/python3.9/site-packages/discord/app_commands/tree.py", line 1242, in _call
discord-chatgpt-ai-assistant  |     await command._invoke_with_namespace(interaction, namespace)
discord-chatgpt-ai-assistant  |   File "/usr/local/lib/python3.9/site-packages/discord/app_commands/commands.py", line 887, in _invoke_with_namespace
discord-chatgpt-ai-assistant  |     return await self._do_call(interaction, transformed_values)
discord-chatgpt-ai-assistant  |   File "/usr/local/lib/python3.9/site-packages/discord/app_commands/commands.py", line 880, in _do_call
discord-chatgpt-ai-assistant  |     raise CommandInvokeError(self, e) from e
discord-chatgpt-ai-assistant  | discord.app_commands.errors.CommandInvokeError: Command 'chat' raised an exception: AttributeError: module 'openai' has no attribute 'ChatCompletion'

在本地使用docker运行的,烦请指正。