Frrrrrrrrank / auto_job__find__chatgpt__rpa

This is a tool used to automatically generate a cover letter using chatgpt based on your resume and job description and send messages to bosses in China.
1.46k stars 217 forks source link

读取文件一直超时 #9

Open wxx2019 opened 10 months ago

wxx2019 commented 10 months ago

image

求解答

Frrrrrrrrank commented 10 months ago

朋友,你可以把错误信息分享在这,然后我看一下你的文档结构吗?这个有点奇怪,似乎是因为创建assistant的retrival函数上出了问题

wxx2019 commented 10 months ago

image 目录结构如图,我在原代码基础上加了三次重试,120秒超时,可还是连接报错。

wxx2019 commented 10 months ago

C:\Users\admin\AppData\Local\Programs\Python\Python38\python.exe D:/python/auto_jobfindchatgpt__rpa-master/auto_job_find/write_response.py OpenAI version is compatible. Request timed out. Retrying... Request timed out. Retrying... Request timed out. Retrying... Traceback (most recent call last): File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpcore_exceptions.py", line 10, in map_exceptions yield File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpcore_backends\sync.py", line 206, in connect_tcp sock = socket.create_connection( File "C:\Users\admin\AppData\Local\Programs\Python\Python38\lib\socket.py", line 808, in create_connection raise err File "C:\Users\admin\AppData\Local\Programs\Python\Python38\lib\socket.py", line 796, in create_connection sock.connect(sa) socket.timeout: timed out

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

Traceback (most recent call last): File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpx_transports\default.py", line 67, in map_httpcore_exceptions yield File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpx_transports\default.py", line 231, in handle_request resp = self._pool.handle_request(req) File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpcore_sync\connection_pool.py", line 268, in handle_request raise exc File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpcore_sync\connection_pool.py", line 251, in handle_request response = connection.handle_request(request) File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpcore_sync\connection.py", line 99, in handle_request raise exc File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpcore_sync\connection.py", line 76, in handle_request stream = self._connect(request) File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpcore_sync\connection.py", line 124, in _connect stream = self._network_backend.connect_tcp(**kwargs) File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpcore_backends\sync.py", line 213, in connect_tcp sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) File "C:\Users\admin\AppData\Local\Programs\Python\Python38\lib\contextlib.py", line 131, in exit self.gen.throw(type, value, traceback) File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpcore_exceptions.py", line 14, in map_exceptions raise to_exc(exc) from exc httpcore.ConnectTimeout: timed out

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

Traceback (most recent call last): File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\openai_base_client.py", line 877, in _request response = self._client.send( File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpx_client.py", line 915, in send response = self._send_handling_auth( File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpx_client.py", line 943, in _send_handling_auth response = self._send_handling_redirects( File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpx_client.py", line 980, in _send_handling_redirects response = self._send_single_request(request) File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpx_client.py", line 1016, in _send_single_request response = transport.handle_request(request) File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpx_transports\default.py", line 231, in handle_request resp = self._pool.handle_request(req) File "C:\Users\admin\AppData\Local\Programs\Python\Python38\lib\contextlib.py", line 131, in exit self.gen.throw(type, value, traceback) File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpx_transports\default.py", line 84, in map_httpcore_exceptions raise mapped_exc(message) from exc httpx.ConnectTimeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpcore_exceptions.py", line 10, in map_exceptions yield File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpcore_backends\sync.py", line 206, in connect_tcp sock = socket.create_connection( File "C:\Users\admin\AppData\Local\Programs\Python\Python38\lib\socket.py", line 808, in create_connection raise err File "C:\Users\admin\AppData\Local\Programs\Python\Python38\lib\socket.py", line 796, in create_connection sock.connect(sa) socket.timeout: timed out

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

Traceback (most recent call last): File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpx_transports\default.py", line 67, in map_httpcore_exceptions yield File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpx_transports\default.py", line 231, in handle_request resp = self._pool.handle_request(req) File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpcore_sync\connection_pool.py", line 268, in handle_request raise exc File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpcore_sync\connection_pool.py", line 251, in handle_request response = connection.handle_request(request) File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpcore_sync\connection.py", line 99, in handle_request raise exc File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpcore_sync\connection.py", line 76, in handle_request stream = self._connect(request) File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpcore_sync\connection.py", line 124, in _connect stream = self._network_backend.connect_tcp(**kwargs) File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpcore_backends\sync.py", line 213, in connect_tcp sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) File "C:\Users\admin\AppData\Local\Programs\Python\Python38\lib\contextlib.py", line 131, in exit self.gen.throw(type, value, traceback) File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpcore_exceptions.py", line 14, in map_exceptions raise to_exc(exc) from exc httpcore.ConnectTimeout: timed out

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

Traceback (most recent call last): File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\openai_base_client.py", line 877, in _request response = self._client.send( File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpx_client.py", line 915, in send response = self._send_handling_auth( File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpx_client.py", line 943, in _send_handling_auth response = self._send_handling_redirects( File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpx_client.py", line 980, in _send_handling_redirects response = self._send_single_request(request) File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpx_client.py", line 1016, in _send_single_request response = transport.handle_request(request) File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpx_transports\default.py", line 231, in handle_request resp = self._pool.handle_request(req) File "C:\Users\admin\AppData\Local\Programs\Python\Python38\lib\contextlib.py", line 131, in exit self.gen.throw(type, value, traceback) File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpx_transports\default.py", line 84, in map_httpcore_exceptions raise mapped_exc(message) from exc httpx.ConnectTimeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpcore_exceptions.py", line 10, in map_exceptions yield File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpcore_backends\sync.py", line 206, in connect_tcp sock = socket.create_connection( File "C:\Users\admin\AppData\Local\Programs\Python\Python38\lib\socket.py", line 808, in create_connection raise err File "C:\Users\admin\AppData\Local\Programs\Python\Python38\lib\socket.py", line 796, in create_connection sock.connect(sa) socket.timeout: timed out

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

Traceback (most recent call last): File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpx_transports\default.py", line 67, in map_httpcore_exceptions yield File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpx_transports\default.py", line 231, in handle_request resp = self._pool.handle_request(req) File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpcore_sync\connection_pool.py", line 268, in handle_request raise exc File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpcore_sync\connection_pool.py", line 251, in handle_request response = connection.handle_request(request) File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpcore_sync\connection.py", line 99, in handle_request raise exc File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpcore_sync\connection.py", line 76, in handle_request stream = self._connect(request) File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpcore_sync\connection.py", line 124, in _connect stream = self._network_backend.connect_tcp(**kwargs) File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpcore_backends\sync.py", line 213, in connect_tcp sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) File "C:\Users\admin\AppData\Local\Programs\Python\Python38\lib\contextlib.py", line 131, in exit self.gen.throw(type, value, traceback) File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpcore_exceptions.py", line 14, in map_exceptions raise to_exc(exc) from exc httpcore.ConnectTimeout: timed out

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

Traceback (most recent call last): File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\openai_base_client.py", line 877, in _request response = self._client.send( File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpx_client.py", line 915, in send response = self._send_handling_auth( File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpx_client.py", line 943, in _send_handling_auth response = self._send_handling_redirects( File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpx_client.py", line 980, in _send_handling_redirects response = self._send_single_request(request) File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpx_client.py", line 1016, in _send_single_request response = transport.handle_request(request) File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpx_transports\default.py", line 231, in handle_request resp = self._pool.handle_request(req) File "C:\Users\admin\AppData\Local\Programs\Python\Python38\lib\contextlib.py", line 131, in exit self.gen.throw(type, value, traceback) File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\httpx_transports\default.py", line 84, in map_httpcore_exceptions raise mapped_exc(message) from exc httpx.ConnectTimeout: timed out

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

Traceback (most recent call last): File "D:/python/auto_jobfindchatgptrpa-master/auto_job_find/write_response.py", line 34, in assistant_id = functions.create_assistant(client) File "D:\python\auto_jobfindchatgptrpa-master\auto_job_find\functions.py", line 48, in create_assistant }, File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\openai\resources\beta\assistants\assistants.py", line 95, in create return self._post( File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\openai_base_client.py", line 1088, in post return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)) File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\openai_base_client.py", line 853, in request return self._request( File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\openai_base_client.py", line 884, in _request return self._retry_request( File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\openai_base_client.py", line 958, in _retry_request return self._request( File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\openai_base_client.py", line 884, in _request return self._retry_request( File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\openai_base_client.py", line 958, in _retry_request return self._request( File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\openai_base_client.py", line 893, in _request raise APITimeoutError(request=request) from err openai.APITimeoutError: Request timed out.

进程已结束,退出代码 1 报错信息如上

wxx2019 commented 10 months ago

此问题我已解决,也解决了求职职位选择的问题,但在给HR发送消息时出现了新的报错。信息如下 C:\Users\admin\AppData\Local\Programs\Python\Python38\python.exe D:/python/auto_jobfindchatgpt__rpa-master/auto_job_find/write_response.py OpenAI version is compatible. Loaded existing assistant ID. Loaded existing assistant ID. Error creating thread: Request timed out. {"error": "Failed to create a new thread"}

进程已结束,退出代码 -1

请问如何解决

Frrrrrrrrank commented 10 months ago

你之前的那个问题是怎么解决的? 现在新问题似乎可能是网络连接问题或者是openai的包的版本问题,也可能是电脑此时cpu等资源被占满了,下面是我的openai包版本信息:

Name: openai
Version: 1.3.7
Summary: The official Python library for the openai API

为了更好的维护社区环境帮助其他人,您能否将您解决第一个问题的方式分享在这里?

wxx2019 commented 10 months ago

我的是python3.8版本+openai1.6.1不知是否兼容? 解决是在functions.py文件中加了 os.environ["http_proxy"] = "http://localhost:7890" os.environ["https_proxy"] = "http://localhost:7890" 两段代码

Winson-030 commented 10 months ago

我的是python3.8版本+openai1.6.1不知是否兼容? 解决是在functions.py文件中加了 os.environ["http_proxy"] = "http://localhost:7890" os.environ["https_proxy"] = "http://localhost:7890" 两段代码

网络连接的问题,上面有问题的代码都是 request timeout。 配置代理或者透明网关都可以解决这个问题