更新脚本文件后,SSLError
lijoe123 opened this issue · 24 comments
下面是报错内容,麻烦up主了,谢谢您
chat_counter - 0
payload is - {'model': 'gpt-3.5-turbo', 'messages': [{'role': 'system', 'content': 'You are a helpful assistant.'}, {'role': 'user', 'content': '你好'}], 'temperature': 1, 'top_p': 1, 'n': 1, 'stream': True, 'presence_penalty': 0, 'frequency_penalty': 0}
Traceback (most recent call last):
File "C:\Miniconda3\lib\site-packages\urllib3\connectionpool.py", line 696, in urlopen
self._prepare_proxy(conn)
File "C:\Miniconda3\lib\site-packages\urllib3\connectionpool.py", line 964, in _prepare_proxy
conn.connect()
File "C:\Miniconda3\lib\site-packages\urllib3\connection.py", line 364, in connect
conn = self._connect_tls_proxy(hostname, conn)
File "C:\Miniconda3\lib\site-packages\urllib3\connection.py", line 501, in _connect_tls_proxy
socket = ssl_wrap_socket(
File "C:\Miniconda3\lib\site-packages\urllib3\util\ssl_.py", line 453, in ssl_wrap_socket
ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls)
File "C:\Miniconda3\lib\site-packages\urllib3\util\ssl_.py", line 495, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock)
File "C:\Miniconda3\lib\ssl.py", line 500, in wrap_socket
return self.sslsocket_class._create(
File "C:\Miniconda3\lib\ssl.py", line 1040, in _create
self.do_handshake()
File "C:\Miniconda3\lib\ssl.py", line 1309, in do_handshake
self._sslobj.do_handshake()
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1129)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Miniconda3\lib\site-packages\requests\adapters.py", line 440, in send
resp = conn.urlopen(
File "C:\Miniconda3\lib\site-packages\urllib3\connectionpool.py", line 755, in urlopen
retries = retries.increment(
File "C:\Miniconda3\lib\site-packages\urllib3\util\retry.py", line 574, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.openai.com', port=443): Max retries exceeded with url: /v1/chat/completions (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1129)')))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Miniconda3\lib\site-packages\gradio\routes.py", line 384, in run_predict
output = await app.get_blocks().process_api(
File "C:\Miniconda3\lib\site-packages\gradio\blocks.py", line 1032, in process_api
result = await self.call_function(
File "C:\Miniconda3\lib\site-packages\gradio\blocks.py", line 858, in call_function
prediction = await anyio.to_thread.run_sync(
File "C:\Miniconda3\lib\site-packages\anyio\to_thread.py", line 31, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "C:\Miniconda3\lib\site-packages\anyio\_backends\_asyncio.py", line 937, in run_sync_in_worker_thread
return await future
File "C:\Miniconda3\lib\site-packages\anyio\_backends\_asyncio.py", line 867, in run
result = context.run(func, *args)
File "C:\Miniconda3\lib\site-packages\gradio\utils.py", line 448, in async_iteration
return next(iterator)
File "D:\Desktop\ChuanhuChatGPT-main\ChuanhuChatbot.py", line 99, in predict
response = requests.post(API_URL, headers=headers,
File "C:\Miniconda3\lib\site-packages\requests\api.py", line 117, in post
return request('post', url, data=data, json=json, **kwargs)
File "C:\Miniconda3\lib\site-packages\requests\api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "C:\Miniconda3\lib\site-packages\requests\sessions.py", line 529, in request
resp = self.send(prep, **send_kwargs)
File "C:\Miniconda3\lib\site-packages\requests\sessions.py", line 645, in send
r = adapter.send(request, **kwargs)
File "C:\Miniconda3\lib\site-packages\requests\adapters.py", line 517, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='api.openai.com', port=443): Max retries exceeded with url: /v1/chat/completions (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1129)')))
这就是openai.com没有被代理成功。但是,注意不要代理127.0.0.1,否则会导致出错。
@GaiZhenbiao 那请问up主我该修改哪里呢?谢谢
请将openai.com
加入你使用的代理App的代理规则。注意不要将127.0.0.1
加入代理,否则也会出错。例如,在Clash配置文件中,加入:
rules:
- DOMAIN-SUFFIX,openai.com,你的代理规则
- DOMAIN,127.0.0.1,DIRECT
Surge:
[Rule]
DOMAIN,127.0.0.1,DIRECT
DOMAIN-SUFFIX,openai.com,你的代理规则
哭了,我赶紧去B站给您投个币
还有127.0.0.1
开启TUN模式。
一样的报错
D:\Desktop\ChuanhuChatGPT-main>python ChuanhuChatbot.py
川虎的温馨提示:访问 http://localhost:7860 查看界面
Running on local URL: http://0.0.0.0:7860
To create a public link, set `share=True` in `launch()`.
chat_counter - 0
payload is - {'model': 'gpt-3.5-turbo', 'messages': [{'role': 'system', 'content': 'You are a helpful assistant.'}, {'role': 'user', 'content': '你好'}], 'temperature': 1, 'top_p': 1, 'n': 1, 'stream': True, 'presence_penalty': 0, 'frequency_penalty': 0}
Traceback (most recent call last):
File "C:\Miniconda3\lib\site-packages\urllib3\connectionpool.py", line 696, in urlopen
self._prepare_proxy(conn)
File "C:\Miniconda3\lib\site-packages\urllib3\connectionpool.py", line 964, in _prepare_proxy
conn.connect()
File "C:\Miniconda3\lib\site-packages\urllib3\connection.py", line 364, in connect
conn = self._connect_tls_proxy(hostname, conn)
File "C:\Miniconda3\lib\site-packages\urllib3\connection.py", line 501, in _connect_tls_proxy
socket = ssl_wrap_socket(
File "C:\Miniconda3\lib\site-packages\urllib3\util\ssl_.py", line 453, in ssl_wrap_socket
ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls)
File "C:\Miniconda3\lib\site-packages\urllib3\util\ssl_.py", line 495, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock)
File "C:\Miniconda3\lib\ssl.py", line 500, in wrap_socket
return self.sslsocket_class._create(
File "C:\Miniconda3\lib\ssl.py", line 1040, in _create
self.do_handshake()
File "C:\Miniconda3\lib\ssl.py", line 1309, in do_handshake
self._sslobj.do_handshake()
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1129)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Miniconda3\lib\site-packages\requests\adapters.py", line 440, in send
resp = conn.urlopen(
File "C:\Miniconda3\lib\site-packages\urllib3\connectionpool.py", line 755, in urlopen
retries = retries.increment(
File "C:\Miniconda3\lib\site-packages\urllib3\util\retry.py", line 574, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.openai.com', port=443): Max retries exceeded with url: /v1/chat/completions (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1129)')))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Miniconda3\lib\site-packages\gradio\routes.py", line 384, in run_predict
output = await app.get_blocks().process_api(
File "C:\Miniconda3\lib\site-packages\gradio\blocks.py", line 1032, in process_api
result = await self.call_function(
File "C:\Miniconda3\lib\site-packages\gradio\blocks.py", line 858, in call_function
prediction = await anyio.to_thread.run_sync(
File "C:\Miniconda3\lib\site-packages\anyio\to_thread.py", line 31, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "C:\Miniconda3\lib\site-packages\anyio\_backends\_asyncio.py", line 937, in run_sync_in_worker_thread
return await future
File "C:\Miniconda3\lib\site-packages\anyio\_backends\_asyncio.py", line 867, in run
result = context.run(func, *args)
File "C:\Miniconda3\lib\site-packages\gradio\utils.py", line 448, in async_iteration
return next(iterator)
File "D:\Desktop\ChuanhuChatGPT-main\ChuanhuChatbot.py", line 99, in predict
response = requests.post(API_URL, headers=headers,
File "C:\Miniconda3\lib\site-packages\requests\api.py", line 117, in post
return request('post', url, data=data, json=json, **kwargs)
File "C:\Miniconda3\lib\site-packages\requests\api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "C:\Miniconda3\lib\site-packages\requests\sessions.py", line 529, in request
resp = self.send(prep, **send_kwargs)
File "C:\Miniconda3\lib\site-packages\requests\sessions.py", line 645, in send
r = adapter.send(request, **kwargs)
File "C:\Miniconda3\lib\site-packages\requests\adapters.py", line 517, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='api.openai.com', port=443): Max retries exceeded with url: /v1/chat/completions (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1129)')))
- 确认代理可用吗?
- 重装urllib3试试
重装urllib3,成功,感谢up主,今年多涨粉,多赚钱
请问您这个代理是哪里来的呢。可以分享一下嘛
请问您这个代理是哪里来的呢。可以分享一下嘛
非常感谢。我已经配置好了代理。但是遇到一个问题,就是无法加入openai和127.0.0.1的配置。请问这是如何做到的呢。
那不清楚你为啥不能了,我就是按照他的方法,你重开一个问题问问吧
那不清楚你为啥不能了,我就是按照他的方法,你重开一个问题问问吧
可以通过WX请教一下吗。18721697423.
请问您这个代理是哪里来的呢。可以分享一下嘛
非常感谢。我已经配置好了代理。但是遇到一个问题,就是无法加入openai和127.0.0.1的配置。请问这是如何做到的呢。
yaml文件里边,搜索rule。下边添加就行
mac用户要怎么添加呢?
问题已经解决:
按照上面的方式如果还是没有成功的话可以试试下面这个方法:
clash窗口页面-->常规-->服务模式(把旁边的小地球点亮在试试。)
开启TUN模式,重启clash。
在这里要感谢UP的耐心解答,祝你今年赚大钱,涨大粉。
- 确认代理可用吗?
- 重装urllib3试试
大佬,用docker部署的怎么重装urllib3啊,我代理是没问题的,但是偶尔还是会报这个异常。