lss233 / chatgpt-mirai-qq-bot

🚀 一键部署!真正的 AI 聊天机器人!支持ChatGPT、文心一言、讯飞星火、Bing、Bard、ChatGLM、POE,多账号,人设调教,虚拟女仆、图片渲染、语音发送 | 支持 QQ、Telegram、Discord、微信 等平台
GNU Affero General Public License v3.0
13.33k stars 1.56k forks source link

[BUG] 2.2版本新加的画图功能触发时报错 #296

Closed wch352136 closed 1 year ago

wch352136 commented 1 year ago

表现
1.使用的api-key来连接的openai(不过是同一个账户的不同key) 2.当说画xxx的命令时,就会报错,报错日志在下面 3.看报错好像是连接方面的问题,可我在账户配置里都配置了代理,而且chat是可以连接的,证明代理是生效的

运行环境:

**日志**
` 2023-03-07 11:20:11.367 | INFO | graia.ariadne.model:log:82 - 2327335631: [RECV]xxxxxxxxx -> @xxxxx 画一条狗 2023-03-07 11:20:11.372 | DEBUG | middlewares.timeout:create_timeout_task:14 - [Timeout] 开始计时…… 2023-03-07 11:20:11.374 | DEBUG | adapter.openai.api:image_creation:40 - [OpenAI Image] Prompt: 一条狗 2023-03-07 11:20:12.371 | ERROR | main:request:210 - Error communicating with OpenAI Traceback (most recent call last):

File "D:\testtools\bot_chatGPT\Windows-quickstart-refs.tags.v2.2.0\chatgpt\python3.9\lib\site-packages\aiohttp\connector.py", line 1091, in _start_tls_connection tls_transport = await self._loop.start_tls( │ │ └ <function BaseEventLoop.start_tls at 0x0000019BA2C38040> │ └ └ <aiohttp.connector.TCPConnector object at 0x0000019BCB4F3C40>

File "asyncio\base_events.py", line 1240, in start_tls

File "asyncio\sslproto.py", line 534, in data_received return

File "asyncio\sslproto.py", line 188, in feed_ssldata appdata = []

File "ssl.py", line 945, in do_handshake

ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1129)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

File "D:\testtools\bot_chatGPT\Windows-quickstart-refs.tags.v2.2.0\chatgpt\python3.9\lib\site-packages\openai\api_requestor.py", line 587, in arequest_raw result = await session.request(**request_kwargs) │ │ └ {'method': 'post', 'url': 'https://api.openai.com/v1/images/generations', 'headers': {'X-OpenAI-Client-User-Agent': '{"bindin... │ └ <function ClientSession.request at 0x0000019BA36831F0> └ <aiohttp.client.ClientSession object at 0x0000019BCB4F16D0>

File "D:\testtools\bot_chatGPT\Windows-quickstart-refs.tags.v2.2.0\chatgpt\python3.9\lib\site-packages\aiohttp\client.py", line 536, in _request conn = await self._connector.connect( │ └ None └ <aiohttp.client.ClientSession object at 0x0000019BCB4F16D0>

File "D:\testtools\bot_chatGPT\Windows-quickstart-refs.tags.v2.2.0\chatgpt\python3.9\lib\site-packages\aiohttp\connector.py", line 540, in connect proto = await self._create_connection(req, traces, timeout) │ │ │ │ └ ClientTimeout(total=600, connect=None, sock_read=None, sock_connect=None) │ │ │ └ [] │ │ └ <aiohttp.client_reqrep.ClientRequest object at 0x0000019BCB4F3CD0> │ └ <function TCPConnector._create_connection at 0x0000019BA35FA0D0> └ <aiohttp.connector.TCPConnector object at 0x0000019BCB4F3C40>

File "D:\testtools\bot_chatGPT\Windows-quickstart-refs.tags.v2.2.0\chatgpt\python3.9\lib\site-packages\aiohttp\connector.py", line 899, in _createconnection , proto = await self._create_proxy_connection(req, traces, timeout) │ │ │ │ └ ClientTimeout(total=600, connect=None, sock_read=None, sock_connect=None) │ │ │ └ [] │ │ └ <aiohttp.client_reqrep.ClientRequest object at 0x0000019BCB4F3CD0> │ └ <function TCPConnector._create_proxy_connection at 0x0000019BA35FA790> └ <aiohttp.connector.TCPConnector object at 0x0000019BCB4F3C40>

File "D:\testtools\bot_chatGPT\Windows-quickstart-refs.tags.v2.2.0\chatgpt\python3.9\lib\site-packages\aiohttp\connector.py", line 1325, in _create_proxy_connection return await self._start_tls_connection( │ └ <function TCPConnector._start_tls_connection at 0x0000019BA35FA670> └ <aiohttp.connector.TCPConnector object at 0x0000019BCB4F3C40>

File "D:\testtools\bot_chatGPT\Windows-quickstart-refs.tags.v2.2.0\chatgpt\python3.9\lib\site-packages\aiohttp\connector.py", line 1105, in _start_tls_connection raise ClientConnectorCertificateError(req.connection_key, exc) from exc │ │ └ <property object at 0x0000019BA35C89F0> │ └ <aiohttp.client_reqrep.ClientRequest object at 0x0000019BCB4F3CD0> └ <class 'aiohttp.client_exceptions.ClientConnectorCertificateError'>

aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host api.openai.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1129)')]

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

File "D:\testtools\bot_chatGPT\Windows-quickstart-refs.tags.v2.2.0\chatgpt\bot.py", line 324, in app.launch_blocking() │ └ <classmethod object at 0x0000019BCA78EAF0> └ <graia.ariadne.app.Ariadne object at 0x0000019BA0E502B0>

File "D:\testtools\bot_chatGPT\Windows-quickstart-refs.tags.v2.2.0\chatgpt\python3.9\lib\site-packages\graia\ariadne\app.py", line 312, in launch_blocking cls.launch_manager.launch_blocking(loop=cls.service.loop, stop_signal=stop_signals) │ │ │ │ │ │ └ (<Signals.SIGINT: 2>,) │ │ │ │ │ └ <property object at 0x0000019BCA792360> │ │ │ │ └ <graia.ariadne.service.ElizabethService object at 0x0000019BA0E25F70> │ │ │ └ <class 'graia.ariadne.app.Ariadne'> │ │ └ <function Launart.launch_blocking at 0x0000019BCA479C10> │ └ <launart.manager.Launart object at 0x0000019BCBB6AE50> └ <class 'graia.ariadne.app.Ariadne'>

File "D:\testtools\bot_chatGPT\Windows-quickstart-refs.tags.v2.2.0\chatgpt\python3.9\lib\site-packages\launart\manager.py", line 494, in launch_blocking loop.run_until_complete(launch_task) │ │ └ <Task pending name='amnesia-launch' coro=<Launart.launch() running at D:\testtools\bot_chatGPT\Windows-quickstart-refs.tags.v... │ └ <function BaseEventLoop.run_until_complete at 0x0000019BA2C35F70> └

File "asyncio\base_events.py", line 634, in run_until_complete ', '.join(str(exc) for exc in exceptions))) └ <module 'asyncio.exceptions' from 'D:\testtools\bot_chatGPT\Windows-quickstart-refs.tags.v2.2.0\chatgpt\python3.9\pytho...

File "asyncio\windows_events.py", line 321, in run_forever

File "asyncio\base_events.py", line 601, in run_forever exc.errno, 'error while '

File "asyncio\base_events.py", line 1905, in _run_once

File "asyncio\events.py", line 80, in _run self._loop = loop │ └ <member '_loop' of 'Handle' objects> └ <Handle <TaskStepMethWrapper object at 0x0000019BCB50BF40>()>

File "D:\testtools\bot_chatGPT\Windows-quickstart-refs.tags.v2.2.0\chatgpt\bot.py", line 177, in request async for rendered in task: └ <async_generator object ConversationContext.ask at 0x0000019BCB503EE0>

File "D:\testtools\bot_chatGPT\Windows-quickstart-refs.tags.v2.2.0\chatgpt\conversation.py", line 78, in ask image_data = await self.openai_api.image_creation(prompt) │ │ │ └ '一条狗' │ │ └ <function OpenAIAPIAdapter.image_creation at 0x0000019BCBBA3B80> │ └ <adapter.openai.api.OpenAIAPIAdapter object at 0x0000019BCD133490> └ <conversation.ConversationContext object at 0x0000019BCD133130>

File "D:\testtools\bot_chatGPT\Windows-quickstart-refs.tags.v2.2.0\chatgpt\adapter\openai\api.py", line 41, in image_creation response = await openai.Image.acreate( │ │ └ <classmethod object at 0x0000019BA39E82E0> │ └ <class 'openai.api_resources.image.Image'> └ <module 'openai' from 'D:\testtools\bot_chatGPT\Windows-quickstart-refs.tags.v2.2.0\chatgpt\python3.9\lib\site-package...

File "D:\testtools\bot_chatGPT\Windows-quickstart-refs.tags.v2.2.0\chatgpt\python3.9\lib\site-packages\openai\apiresources\image.py", line 65, in acreate response, , api_key = await requestor.arequest( │ │ └ <function APIRequestor.arequest at 0x0000019BA3825F70> │ └ <openai.api_requestor.APIRequestor object at 0x0000019BCB4FA670> └ <ApiType.OPEN_AI: 2>

File "D:\testtools\bot_chatGPT\Windows-quickstart-refs.tags.v2.2.0\chatgpt\python3.9\lib\site-packages\openai\api_requestor.py", line 300, in arequest result = await self.arequest_raw( │ └ <function APIRequestor.arequest_raw at 0x0000019BA382D310> └ <openai.api_requestor.APIRequestor object at 0x0000019BCB4FA670>

File "D:\testtools\bot_chatGPT\Windows-quickstart-refs.tags.v2.2.0\chatgpt\python3.9\lib\site-packages\openai\api_requestor.py", line 604, in arequest_raw raise error.APIConnectionError("Error communicating with OpenAI") from e │ └ <class 'openai.error.APIConnectionError'> └ <module 'openai.error' from 'D:\testtools\bot_chatGPT\Windows-quickstart-refs.tags.v2.2.0\chatgpt\python3.9\lib\site-p...

openai.error.APIConnectionError: Error communicating with OpenAI 2023-03-07 11:20:12.933 | INFO | graia.ariadne.model:log:82 - xxxxxxxxxxxxx <- 出现故障!如果这个问题持续出现,请和我说“ 重置会话” 来开启一段新的会话,或者发送 “回滚会话” 来回溯到上一条对话,你上一条说的我 就当作没看见。\nError communicating with OpenAI `

其他内容
此处填写其他内容,没有可跳过

lss233 commented 1 year ago

这是网络不好,记得给你的api_key设置proxy

wch352136 commented 1 year ago

这是网络不好,记得给你的api_key设置proxy

可我已经设置代理了 image