binary-husky / binary-husky/gpt_academic

[Bug]: 使用第三方api的gpt和claude无法连接,[Local Message] Request timeout. Network error. Please check proxy settings in config.py.网络错误,检查代理服务器是否可用,以及代理设置的格式是否正确,格式须是[协议]://[地址]:[端口],缺一不可。

Open
#1,777 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
71.4k
Forks
8.3k
PR merge metrics
No merged PRs in 30d

Description

### Installation Method | 安装方法与平台

Huggingface

### Version | 版本

Please choose | 请选择

### OS | 操作系统

Please choose | 请选择

### Describe the bug | 简述

已经在config里修改了url,然后本地版本也是可以运行的。运行国内大模型没有问题,不知道是不是什么网络问题。
log如下:
Traceback (most recent call last):
File "/home/user/app/request_llms/bridge_chatgpt.py", line 207, in predict
response = requests.post(endpoint, headers=headers, proxies=proxies,
File "/usr/local/lib/python3.10/site-packages/requests/api.py", line 115, in post
return request("post", url, data=data, json=json, **kwargs)
File "/usr/local/lib/python3.10/site-packages/requests/api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 519, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.chatgpt-3.vip', port=443): Max retries exceeded with url: /v1/chat/completions (Caused by NameResolutionError(": Failed to resolve 'api.chatgpt-3.vip' ([Errno -5] No address associated with hostname)"))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 422, in run_predict
output = await app.get_blocks().process_api(
File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 1323, in process_api
result = await self.call_function(
File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 1067, in call_function
prediction = await utils.async_iteration(iterator)
File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 336, in async_iteration
return await iterator.anext()
File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 329, in anext
return await anyio.to_thread.run_sync(
File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 56, in run_sync
return await get_async_backend().run_sync_in_worker_thread(
File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2144, in run_sync_in_worker_thread
return await future
File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 851, in run
result = context.run(func, *args)
File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 312, in run_sync_iterator_async
return next(iterator)
File "/home/user/app/toolbox.py", line 119, in decorated
yield from f(txt_passon, llm_kwargs, plugin_kwargs, chatbot_with_cookie, history, system_prompt, *args)
File "/home/user/app/request_llms/bridge_all.py", line 783, in predict
yield from method(inputs, llm_kwargs, *args, **kwargs)
File "/home/user/app/request_llms/bridge_chatgpt.py", line 214, in predict
if retry > MAX_RETRY: raise TimeoutError
TimeoutError

### Screen Shot | 有帮助的截图

![image](https://github.com/binary-husky/gpt_academic/assets/158176338/81a0ca1c-c74c-46ee-9c2f-368a997a007a)

### Terminal Traceback & Material to Help Reproduce Bugs | 终端traceback(如有) + 帮助我们复现的测试材料样本(如有)

_No response_

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with config.py and request_llms/bridge_chatgpt.py, especially the requests.post call and proxy handling shown in the traceback. Reproduce the failure with the reported third-party endpoint and verify the configured URL, proxy format, and hostname resolution. Done means the cause is identified and the GPT or Claude connection either works with valid settings or reports a specific actionable error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.