lss233 / chatgpt-mirai-qq-bot

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

[BUG] bing绘画功能报错 #658

Open Qboy-1214 opened 1 year ago

Qboy-1214 commented 1 year ago

提交 issue 前,请先确认:

表现
bing画画报错:

universal:request:239 - Cannot connect to host www.bing.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:992)')]
Traceback (most recent call last):

运行环境:

复现步骤
描述你是如何触发这个 BUG 的

  1. 发送“bing 画 catgirl”
  2. 查看程序后台

预期行为
bing画一幅画

截图

2023-04-17 12:37:33.534 | DEBUG    | platforms.onebot_bot:_:121 - 私聊消息:bing 画 a catgirl
2023-04-17 12:37:35.881 | DEBUG    | middlewares.concurrentlock:handle_request:40 - [Concurrent] 排队中,前面还有 0 个人!
2023-04-17 12:37:35.881 | DEBUG    | middlewares.concurrentlock:handle_request:42 - [Concurrent] 排到了!
2023-04-17 12:37:35.882 | DEBUG    | middlewares.timeout:create_timeout_task:55 - [Timeout] 开始计时……
2023-04-17 12:37:35.883 | DEBUG    | adapter.ms.bing:text_to_img:98 - [Bing Image] Prompt:  a catgirl
Sending request...
2023-04-17 12:37:36.271 | ERROR    | universal:request:239 - Cannot connect to host www.bing.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:992)')]
Traceback (most recent call last):

  File "/usr/local/python3.11/lib/python3.11/site-packages/aiohttp/connector.py", line 980, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)  # type: ignore[return-value]  # noqa
                 │    │     │                  │       └ {'ssl': <ssl.SSLContext object at 0x7fdc4fb03410>, 'family': <AddressFamily.AF_INET: 2>, 'proto': 6, 'flags': <AddressInfo.AI...
                 │    │     │                  └ (functools.partial(<class 'aiohttp.client_proto.ResponseHandler'>, loop=<_UnixSelectorEventLoop running=True closed=False deb...
                 │    │     └ <function BaseEventLoop.create_connection at 0x7fdc55a7e3e0>
                 │    └ <_UnixSelectorEventLoop running=True closed=False debug=False>
                 └ <aiohttp.connector.TCPConnector object at 0x7fdc4e612990>
  File "/usr/local/python3.11/lib/python3.11/asyncio/base_events.py", line 1112, in create_connection
    transport, protocol = await self._create_connection_transport(
                                │    └ <function BaseEventLoop._create_connection_transport at 0x7fdc55a7e480>
                                └ <_UnixSelectorEventLoop running=True closed=False debug=False>
  File "/usr/local/python3.11/lib/python3.11/asyncio/base_events.py", line 1145, in _create_connection_transport
    await waiter
          └ <Future finished exception=SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to...
  File "/usr/local/python3.11/lib/python3.11/asyncio/sslproto.py", line 574, in _on_handshake_complete
    raise handshake_exc
          └ SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certifica...
  File "/usr/local/python3.11/lib/python3.11/asyncio/sslproto.py", line 556, in _do_handshake
    self._sslobj.do_handshake()
    │    │       └ <function SSLObject.do_handshake at 0x7fdc570391c0>
    │    └ <ssl.SSLObject object at 0x7fdc4e5ed490>
    └ <asyncio.sslproto.SSLProtocol object at 0x7fdc4e5eee50>
  File "/usr/local/python3.11/lib/python3.11/ssl.py", line 979, in do_handshake
    self._sslobj.do_handshake()
    │    │       └ <method 'do_handshake' of '_ssl._SSLSocket' objects>
    │    └ <_ssl._SSLSocket object at 0x7fdc4e56fb50>
    └ <ssl.SSLObject object at 0x7fdc4e5ed490>

ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:992)

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

Traceback (most recent call last):

  File "/docker/chatgpt-mirai-qq-bot/bot.py", line 41, in <module>
    loop.run_until_complete(asyncio.gather(*bots))
    │    │                  │       │       └ [<Task pending name='Task-3' coro=<start_task() running at /docker/chatgpt-mirai-qq-bot/platforms/onebot_bot.py:286> wait_for...
    │    │                  │       └ <function gather at 0x7fdc55a78680>
    │    │                  └ <module 'asyncio' from '/usr/local/python3.11/lib/python3.11/asyncio/__init__.py'>
    │    └ <function BaseEventLoop.run_until_complete at 0x7fdc55a7d4e0>
    └ <_UnixSelectorEventLoop running=True closed=False debug=False>

  File "/usr/local/python3.11/lib/python3.11/asyncio/base_events.py", line 640, in run_until_complete
    self.run_forever()
    │    └ <function BaseEventLoop.run_forever at 0x7fdc55a7d440>
    └ <_UnixSelectorEventLoop running=True closed=False debug=False>
  File "/usr/local/python3.11/lib/python3.11/asyncio/base_events.py", line 607, in run_forever
    self._run_once()
    │    └ <function BaseEventLoop._run_once at 0x7fdc55a7f240>
    └ <_UnixSelectorEventLoop running=True closed=False debug=False>
  File "/usr/local/python3.11/lib/python3.11/asyncio/base_events.py", line 1922, in _run_once
    handle._run()
    │      └ <function Handle._run at 0x7fdc570580e0>
    └ <Handle <TaskStepMethWrapper object at 0x7fdc4e5dce50>()>
  File "/usr/local/python3.11/lib/python3.11/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
    │    │            │    │           │    └ <member '_args' of 'Handle' objects>
    │    │            │    │           └ <Handle <TaskStepMethWrapper object at 0x7fdc4e5dce50>()>
    │    │            │    └ <member '_callback' of 'Handle' objects>
    │    │            └ <Handle <TaskStepMethWrapper object at 0x7fdc4e5dce50>()>
    │    └ <member '_context' of 'Handle' objects>
    └ <Handle <TaskStepMethWrapper object at 0x7fdc4e5dce50>()>

> File "/docker/chatgpt-mirai-qq-bot/universal.py", line 205, in request
    async for rendered in task:
                          └ <async_generator object retry.<locals>.decorator.<locals>.wrapper at 0x7fdc4e5816c0>

  File "/docker/chatgpt-mirai-qq-bot/utils/retry.py", line 21, in wrapper
    async for result in func(*args, **kwargs):
                        │     │       └ {'prompt': '画 a catgirl', 'chain': MessageChain([Plain(text='bing 画 a catgirl')]), 'name': '非典型废言'}
                        │     └ (<conversation.ConversationContext object at 0x7fdc50667150>,)
                        └ <function ConversationContext.ask at 0x7fdc504a1440>

  File "/docker/chatgpt-mirai-qq-bot/conversation.py", line 148, in ask
    images = await self.drawing_adapter.text_to_img(prompt)
                   │    │               │           └ ' a catgirl'
                   │    │               └ <function BingAdapter.text_to_img at 0x7fdc505363e0>
                   │    └ <adapter.ms.bing.BingAdapter object at 0x7fdc51ec0410>
                   └ <conversation.ConversationContext object at 0x7fdc50667150>

  File "/docker/chatgpt-mirai-qq-bot/adapter/ms/bing.py", line 104, in text_to_img
    images = await image_generator.get_images(prompt)
                   │               │          └ ' a catgirl'
                   │               └ <function ImageGenAsync.get_images at 0x7fdc505365c0>
                   └ <BingImageCreator.ImageGenAsync object at 0x7fdc4e612090>

  File "/usr/local/python3.11/lib/python3.11/site-packages/BingImageCreator.py", line 219, in get_images
    async with self.session.post(url, allow_redirects=False) as response:
               │    │       │    └ 'https://www.bing.com/images/create?q=%20a%20catgirl&rt=4&FORM=GENCRE'
               │    │       └ <function ClientSession.post at 0x7fdc53d63880>
               │    └ <aiohttp.client.ClientSession object at 0x7fdc4e612310>
               └ <BingImageCreator.ImageGenAsync object at 0x7fdc4e612090>
  File "/usr/local/python3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1141, in __aenter__
    self._resp = await self._coro
    │    │             │    └ <member '_coro' of '_BaseRequestContextManager' objects>
    │    │             └ <aiohttp.client._RequestContextManager object at 0x7fdc4e5df3a0>
    │    └ <member '_resp' of '_BaseRequestContextManager' objects>
    └ <aiohttp.client._RequestContextManager object at 0x7fdc4e5df3a0>
  File "/usr/local/python3.11/lib/python3.11/site-packages/aiohttp/client.py", line 536, in _request
    conn = await self._connector.connect(
                 │    └ None
                 └ <aiohttp.client.ClientSession object at 0x7fdc4e612310>
  File "/usr/local/python3.11/lib/python3.11/site-packages/aiohttp/connector.py", line 540, in connect
    proto = await self._create_connection(req, traces, timeout)
                  │    │                  │    │       └ ClientTimeout(total=300, connect=None, sock_read=None, sock_connect=None)
                  │    │                  │    └ []
                  │    │                  └ <aiohttp.client_reqrep.ClientRequest object at 0x7fdc504924d0>
                  │    └ <function TCPConnector._create_connection at 0x7fdc53d1ad40>
                  └ <aiohttp.connector.TCPConnector object at 0x7fdc4e612990>
  File "/usr/local/python3.11/lib/python3.11/site-packages/aiohttp/connector.py", line 901, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
                     │    │                         │    │       └ ClientTimeout(total=300, connect=None, sock_read=None, sock_connect=None)
                     │    │                         │    └ []
                     │    │                         └ <aiohttp.client_reqrep.ClientRequest object at 0x7fdc504924d0>
                     │    └ <function TCPConnector._create_direct_connection at 0x7fdc53d1b420>
                     └ <aiohttp.connector.TCPConnector object at 0x7fdc4e612990>
  File "/usr/local/python3.11/lib/python3.11/site-packages/aiohttp/connector.py", line 1206, in _create_direct_connection
    raise last_exc
          └ ClientConnectorCertificateError(ConnectionKey(host='www.bing.com', port=443, is_ssl=True, ssl=None, proxy=None, proxy_auth=No...
  File "/usr/local/python3.11/lib/python3.11/site-packages/aiohttp/connector.py", line 1175, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
                          │    └ <function TCPConnector._wrap_create_connection at 0x7fdc53d1afc0>
                          └ <aiohttp.connector.TCPConnector object at 0x7fdc4e612990>
  File "/usr/local/python3.11/lib/python3.11/site-packages/aiohttp/connector.py", line 982, in _wrap_create_connection
    raise ClientConnectorCertificateError(req.connection_key, exc) from exc
          │                               │   └ <property object at 0x7fdc53ce8a90>
          │                               └ <aiohttp.client_reqrep.ClientRequest object at 0x7fdc504924d0>
          └ <class 'aiohttp.client_exceptions.ClientConnectorCertificateError'>

aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host www.bing.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:992)')]
2023-04-17 12:37:36.288 | DEBUG    | platforms.onebot_bot:respond:85 - [OneBot] 尝试发送消息:出现故障!如果这个问题持续出现,请和我说“重置会话” 来开启一段新的会 话,或者发送 “回滚会话” 来回溯到上一条对话,你上一条说的我就当作没看见。
Cannot connect to host www.bing.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:992)')]
2023-04-17 12:37:36.291 | DEBUG    | middlewares.timeout:on_respond:40 - [Timeout] 取消计时……

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

FuryMartin commented 1 year ago

看起来像是因为没配置 proxy。你是使用接入点连接的 bing 吗?

根据 adapter/ms/bing.py 中的

async def __download_image(self, url):
    async with aiohttp.ClientSession() as session:
        async with session.get(url, proxy=self.bot.proxy) as resp:
            if resp.status == 200:
                return GraiaImage(data_bytes=await resp.read())

可以看出,当且仅当 bing bot 在配置文件中了 proxy 时才可用。

如果你是通过接入点访问的,那么就会出现这个错误。

目前 接入点 仅配置了与 bing 的聊天,没有配置画图的API,我也不懂如何配置,需要其他人来解决这个问题

临时解决办法

使用proxy连接bing而不是使用接入点连接bing。

在你的 config.cfg 中的添加下面的配置,并删除接入点的配置,应该就可以了

[[bing.accounts]]
proxy="http://127.0.0.1:1080"  #你的代理地址
ghost commented 1 year ago

同无法画画,为什么地址会变成www.bing.comhttps:443

2023-04-20 09:23:03.996 | INFO     | graia.ariadne.model:log:82 - 1852637873: [RECV][司南(xxx)] -> #画一个鸽子
2023-04-20 09:23:05.905 | DEBUG    | middlewares.concurrentlock:handle_request:40 - [Concurrent] 排队中,前面还有 0 个人!
2023-04-20 09:23:05.907 | DEBUG    | middlewares.concurrentlock:handle_request:42 - [Concurrent] 排到了!
2023-04-20 09:23:05.908 | DEBUG    | middlewares.timeout:create_timeout_task:55 - [Timeout] 开始计时……
2023-04-20 09:23:05.910 | DEBUG    | adapter.ms.bing:text_to_img:98 - [Bing Image] Prompt: 一个鸽子
2023-04-20 09:23:06.482 | ERROR    | universal:request:240 - Cannot connect to host www.bing.comhttps:443 ssl:default [Name or service not known]
Traceback (most recent call last):

  File "/home/xc9/.local/lib/python3.11/site-packages/aiohttp/connector.py", line 1152, in _create_direct_connection
    hosts = await asyncio.shield(host_resolved)
                  │       │      └ <Task finished name='Task-33' coro=<TCPConnector._resolve_host() done, defined at /home/xc9/.local/lib/python3.11/site-packag...
                  │       └ <function shield at 0x7f6ec0f20a40>
                  └ <module 'asyncio' from '/usr/lib/python3.11/asyncio/__init__.py'>
  File "/home/xc9/.local/lib/python3.11/site-packages/aiohttp/connector.py", line 874, in _resolve_host
    addrs = await self._resolver.resolve(host, port, family=self._family)
                  │    │         │       │     │            │    └ 0
                  │    │         │       │     │            └ <aiohttp.connector.TCPConnector object at 0x7f6ebbb55590>
                  │    │         │       │     └ 443
                  │    │         │       └ 'www.bing.comhttps'
                  │    │         └ <function ThreadedResolver.resolve at 0x7f6ebfc44540>
                  │    └ <aiohttp.resolver.ThreadedResolver object at 0x7f6ebbb57550>
                  └ <aiohttp.connector.TCPConnector object at 0x7f6ebbb55590>
  File "/home/xc9/.local/lib/python3.11/site-packages/aiohttp/resolver.py", line 33, in resolve
    infos = await self._loop.getaddrinfo(
                  │    │     └ <function BaseEventLoop.getaddrinfo at 0x7f6ec0f2e200>
                  │    └ <_UnixSelectorEventLoop running=True closed=False debug=False>
                  └ <aiohttp.resolver.ThreadedResolver object at 0x7f6ebbb57550>
  File "/usr/lib/python3.11/asyncio/base_events.py", line 867, in getaddrinfo
    return await self.run_in_executor(
                 │    └ <function BaseEventLoop.run_in_executor at 0x7f6ec0f2e020>
                 └ <_UnixSelectorEventLoop running=True closed=False debug=False>
  File "/usr/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             │        │            └ None
             │        └ None
             └ None
  File "/usr/lib/python3.11/socket.py", line 962, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
               │       │           │     │     │       │     │      └ <AddressInfo.AI_ADDRCONFIG: 32>
               │       │           │     │     │       │     └ 0
               │       │           │     │     │       └ <SocketKind.SOCK_STREAM: 1>
               │       │           │     │     └ 0
               │       │           │     └ 443
               │       │           └ 'www.bing.comhttps'
               │       └ <built-in function getaddrinfo>
               └ <module '_socket' (built-in)>

socket.gaierror: [Errno -2] Name or service not known

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

Traceback (most recent call last):

  File "/home/xc9/act/bot2/chatgpt-mirai-qq-bot/bot.py", line 41, in <module>
    loop.run_until_complete(asyncio.gather(*bots))
    │    │                  │       │       └ [<Task pending name='Task-2' coro=<start_task() running at /home/xc9/act/bot2/chatgpt-mirai-qq-bot/platforms/ariadne_bot.py:3...
    │    │                  │       └ <function gather at 0x7f6ec0f20860>
    │    │                  └ <module 'asyncio' from '/usr/lib/python3.11/asyncio/__init__.py'>
    │    └ <function BaseEventLoop.run_until_complete at 0x7f6ec0f2d760>
    └ <_UnixSelectorEventLoop running=True closed=False debug=False>

  File "/usr/lib/python3.11/asyncio/base_events.py", line 640, in run_until_complete
    self.run_forever()
    │    └ <function BaseEventLoop.run_forever at 0x7f6ec0f2d6c0>
    └ <_UnixSelectorEventLoop running=True closed=False debug=False>
  File "/usr/lib/python3.11/asyncio/base_events.py", line 607, in run_forever
    self._run_once()
    │    └ <function BaseEventLoop._run_once at 0x7f6ec0f2f4c0>
    └ <_UnixSelectorEventLoop running=True closed=False debug=False>
  File "/usr/lib/python3.11/asyncio/base_events.py", line 1922, in _run_once
    handle._run()
    │      └ <function Handle._run at 0x7f6ec0ed42c0>
    └ <Handle <TaskStepMethWrapper object at 0x7f6ebbb3db40>()>
  File "/usr/lib/python3.11/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
    │    │            │    │           │    └ <member '_args' of 'Handle' objects>
    │    │            │    │           └ <Handle <TaskStepMethWrapper object at 0x7f6ebbb3db40>()>
    │    │            │    └ <member '_callback' of 'Handle' objects>
    │    │            └ <Handle <TaskStepMethWrapper object at 0x7f6ebbb3db40>()>
    │    └ <member '_context' of 'Handle' objects>
    └ <Handle <TaskStepMethWrapper object at 0x7f6ebbb3db40>()>

> File "/home/xc9/act/bot2/chatgpt-mirai-qq-bot/universal.py", line 206, in request
    async for rendered in task:
                          └ <async_generator object retry.<locals>.decorator.<locals>.wrapper at 0x7f6ebcf49800>

  File "/home/xc9/act/bot2/chatgpt-mirai-qq-bot/utils/retry.py", line 21, in wrapper
    async for result in func(*args, **kwargs):
                        │     │       └ {'prompt': '画一个鸽子', 'chain': MessageChain([Plain(text='画一个鸽子')]), 'name': '司南'}
                        │     └ (<conversation.ConversationContext object at 0x7f6ebbb14ad0>,)
                        └ <function ConversationContext.ask at 0x7f6ebd972de0>

  File "/home/xc9/act/bot2/chatgpt-mirai-qq-bot/conversation.py", line 156, in ask
    images = await self.drawing_adapter.text_to_img(prompt)
                   │    │               │           └ '一个鸽子'
                   │    │               └ <function BingAdapter.text_to_img at 0x7f6ebda4c0e0>
                   │    └ <adapter.ms.bing.BingAdapter object at 0x7f6ebdb20250>
                   └ <conversation.ConversationContext object at 0x7f6ebbb14ad0>

  File "/home/xc9/act/bot2/chatgpt-mirai-qq-bot/adapter/ms/bing.py", line 104, in text_to_img
    images = await image_generator.get_images(prompt)
                   │               │          └ '一个鸽子'
                   │               └ <function ImageGenAsync.get_images at 0x7f6ebda2fec0>
                   └ <BingImageCreator.ImageGenAsync object at 0x7f6ebe814bd0>

  File "/home/xc9/.local/lib/python3.11/site-packages/BingImageCreator.py", line 202, in get_images
    await self.session.get(f"{BING_URL}{redirect_url}")
          │    │       └ <function ClientSession.get at 0x7f6ebfc8efc0>
          │    └ <aiohttp.client.ClientSession object at 0x7f6ebbb17d50>
          └ <BingImageCreator.ImageGenAsync object at 0x7f6ebe814bd0>
  File "/home/xc9/.local/lib/python3.11/site-packages/aiohttp/client.py", line 536, in _request
    conn = await self._connector.connect(
                 │    └ None
                 └ <aiohttp.client.ClientSession object at 0x7f6ebbb17d50>
  File "/home/xc9/.local/lib/python3.11/site-packages/aiohttp/connector.py", line 540, in connect
    proto = await self._create_connection(req, traces, timeout)
                  │    │                  │    │       └ ClientTimeout(total=300, connect=None, sock_read=None, sock_connect=None)
                  │    │                  │    └ []
                  │    │                  └ <aiohttp.client_reqrep.ClientRequest object at 0x7f6ebbb63c90>
                  │    └ <function TCPConnector._create_connection at 0x7f6ebfc46840>
                  └ <aiohttp.connector.TCPConnector object at 0x7f6ebbb55590>
  File "/home/xc9/.local/lib/python3.11/site-packages/aiohttp/connector.py", line 901, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
                     │    │                         │    │       └ ClientTimeout(total=300, connect=None, sock_read=None, sock_connect=None)
                     │    │                         │    └ []
                     │    │                         └ <aiohttp.client_reqrep.ClientRequest object at 0x7f6ebbb63c90>
                     │    └ <function TCPConnector._create_direct_connection at 0x7f6ebfc46f20>
                     └ <aiohttp.connector.TCPConnector object at 0x7f6ebbb55590>
  File "/home/xc9/.local/lib/python3.11/site-packages/aiohttp/connector.py", line 1166, in _create_direct_connection
    raise ClientConnectorError(req.connection_key, exc) from exc
          │                    │   └ <property object at 0x7f6ebfc1e570>
          │                    └ <aiohttp.client_reqrep.ClientRequest object at 0x7f6ebbb63c90>
          └ <class 'aiohttp.client_exceptions.ClientConnectorError'>

aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host www.bing.comhttps:443 ssl:default [Name or service not known]
2023-04-20 09:23:06.936 | INFO     | graia.ariadne.model:log:82 - 1852637873: [SEND][司南(xxx)] <- 出现故障!如果这个问题持续出现,请和我说“重置会话” 来开启一段新的会话,或者发送 “回滚对话” 来回溯到上一条对话,你上一条说的我就当作没看见。\n原因:Cannot connect to host www.bing.comhttps:443 ssl:default [Name or service not known]
ken0414 commented 1 year ago

发生了同样的错误,设置代理无法解决

似乎是proxy配置没有生效,同样配置方法在openai下生效

wangmw3617 commented 1 year ago

发生了同样的错误,设置代理无法解决

似乎是proxy配置没有生效,同样配置方法在openai下生效

同样错误

出现故障!如果这个问题持续出现,请和我说“重置会话” 来开启一段新的会话,或者发送 “回滚会话” 来回溯到上一条对话,你上一条说的我就当作没看见。 Cannot connect to host www.bing.comhttps:443 ssl:default [Name or service not known]

superboyyy commented 1 year ago

我也碰到了这个问题

Onimaimai commented 1 year ago

同问+1

ken0414 commented 1 year ago

发生了同样的错误,设置代理无法解决

似乎是proxy配置没有生效,同样配置方法在openai下生效

经过测试,如果只设置config内bing选项下的proxy内容是无法成功使用http代理获取bing画图的。 我的处理方法是,将docker部署在有代理环境的系统下,成功使用bing绘画功能: image

M4n5ter commented 1 year ago

发生了同样的错误,设置代理无法解决 似乎是proxy配置没有生效,同样配置方法在openai下生效

同样错误

出现故障!如果这个问题持续出现,请和我说“重置会话” 来开启一段新的会话,或者发送 “回滚会话” 来回溯到上一条对话,你上一条说的我就当作没看见。 Cannot connect to host www.bing.comhttps:443 ssl:default [Name or service not known]

我也遇到了这个错误,代理是可用的,但是连接的地址为什么是 www.bing.comhttps:443 ?

VectorZhao commented 1 year ago
image
Qboy-1214 commented 1 year ago

发生了同样的错误,设置代理无法解决 似乎是proxy配置没有生效,同样配置方法在openai下生效

经过测试,如果只设置config内bing选项下的proxy内容是无法成功使用http代理获取bing画图的。 我的处理方法是,将docker部署在有代理环境的系统下,成功使用bing绘画功能: image

我设置了机器http_proxy和https_proxy,还是不行。 bing画图和edgeTTS都是报类似的错误

VectorZhao commented 1 year ago

只能部署在国外vps,本地环境即使设置了代理,bing的画图功能也无法使用。不清楚其中的原因。

AthanaD commented 1 year ago

画图失败!原因: 404, message='Not Found', url=URL('https://tse4.mm.bing.net/th/id/OIG.LNn_HzBbMMRal_eNoaoM')

画图失败!原因: 画图失败:Redirect failed

eric-hu519 commented 1 year ago

看起来像是因为没配置 proxy。你是使用接入点连接的 bing 吗?

根据 adapter/ms/bing.py 中的

async def __download_image(self, url):
    async with aiohttp.ClientSession() as session:
        async with session.get(url, proxy=self.bot.proxy) as resp:
            if resp.status == 200:
                return GraiaImage(data_bytes=await resp.read())

可以看出,当且仅当 bing bot 在配置文件中了 proxy 时才可用。

如果你是通过接入点访问的,那么就会出现这个错误。

目前 接入点 仅配置了与 bing 的聊天,没有配置画图的API,我也不懂如何配置,需要其他人来解决这个问题

临时解决办法

使用proxy连接bing而不是使用接入点连接bing。

在你的 config.cfg 中的添加下面的配置,并删除接入点的配置,应该就可以了

[[bing.accounts]]
proxy="http://127.0.0.1:1080"  #你的代理地址

只在config.cfg里面写还不行,我在docker-compose.yaml里面chatgpt那一段加入了代理参数就能画了:

  chatgpt:
    image: lss233/chatgpt-mirai-qq-bot:browser-version
    restart: always
    environment:
      LANG: 'C.UTF-8'
      # 设置代理
      HTTP_PROXY: http://192.168.1.101:7890
      HTTPS_PROXY: http://192.168.1.101:7890
    ports:
      - 8554:8554/tcp
    volumes:
      - ./config.cfg:/app/config.cfg
      - ./data:/app/data
      - ./presets:/app/presets