nangongchengfeng / Chat-CodeReview

ChatGPT集成Gitlab,自动审计代码进行评论
146 stars 35 forks source link

执行python app.py出现如下报错 #2

Closed JeanStory closed 1 year ago

JeanStory commented 1 year ago

哈喽,大佬好.我这边尝试在本地部署Chat-CodeReview. 在执行了python deal_package.py并修改适配了config/config.py之后.尝试调用python app.py启动服务时,出现了如下的报错 `2023-08-30 12:02:09.922 INFO | [MainThread] chat [21] | apollo_config.py | 加载apollo配置 Traceback (most recent call last): File "/home/aitest2/anaconda3/lib/python3.9/site-packages/urllib3/connection.py", line 174, in _new_conn conn = connection.create_connection( File "/home/aitest2/anaconda3/lib/python3.9/site-packages/urllib3/util/connection.py", line 72, in create_connection for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): File "/home/aitest2/anaconda3/lib/python3.9/socket.py", line 954, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/aitest2/anaconda3/lib/python3.9/site-packages/urllib3/connectionpool.py", line 703, in urlopen httplib_response = self._make_request( File "/home/aitest2/anaconda3/lib/python3.9/site-packages/urllib3/connectionpool.py", line 398, in _make_request conn.request(method, url, **httplib_request_kw) File "/home/aitest2/anaconda3/lib/python3.9/site-packages/urllib3/connection.py", line 239, in request super(HTTPConnection, self).request(method, url, body=body, headers=headers) File "/home/aitest2/anaconda3/lib/python3.9/http/client.py", line 1285, in request self._send_request(method, url, body, headers, encode_chunked) File "/home/aitest2/anaconda3/lib/python3.9/http/client.py", line 1331, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/home/aitest2/anaconda3/lib/python3.9/http/client.py", line 1280, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/home/aitest2/anaconda3/lib/python3.9/http/client.py", line 1040, in _send_output self.send(msg) File "/home/aitest2/anaconda3/lib/python3.9/http/client.py", line 980, in send self.connect() File "/home/aitest2/anaconda3/lib/python3.9/site-packages/urllib3/connection.py", line 205, in connect conn = self._new_conn() File "/home/aitest2/anaconda3/lib/python3.9/site-packages/urllib3/connection.py", line 186, in _new_conn raise NewConnectionError( urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f6d9ff89eb0>: Failed to establish a new connection: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/aitest2/anaconda3/lib/python3.9/site-packages/requests/adapters.py", line 486, in send resp = conn.urlopen( File "/home/aitest2/anaconda3/lib/python3.9/site-packages/urllib3/connectionpool.py", line 785, in urlopen retries = retries.increment( File "/home/aitest2/anaconda3/lib/python3.9/site-packages/urllib3/util/retry.py", line 592, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='config-server-dev.ownit.top', port=80): Max retries exceeded with url: /notifications/v2?appId=chat-review&cluster=default&notifications=%5B%7B%22namespaceName%22%3A+%22application%22%2C+%22notificationId%22%3A+-1%7D%5D (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f6d9ff89eb0>: Failed to establish a new connection: [Errno -2] Name or service not known'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/aitest2/junfengtian/chat-review/app.py", line 16, in from app.git import git File "/home/aitest2/junfengtian/chat-review/app/git.py", line 12, in from config.config import WEBHOOK_VERIFY_TOKEN File "/home/aitest2/junfengtian/chat-review/config/config.py", line 9, in from config.apollo_config import gitlab_server_url, gitlab_private_token, openai_api_key File "/home/aitest2/junfengtian/chat-review/config/apollo_config.py", line 26, in gitlab_server_url = client.get_value('gitlab_server_url') File "/home/aitest2/anaconda3/lib/python3.9/site-packages/pyapollos/apollo_client.py", line 47, in get_value self._long_poll() File "/home/aitest2/anaconda3/lib/python3.9/site-packages/pyapollos/apollo_client.py", line 121, in _long_poll r = requests.get(url=url, params={ File "/home/aitest2/anaconda3/lib/python3.9/site-packages/requests/api.py", line 73, in get return request("get", url, params=params, kwargs) File "/home/aitest2/anaconda3/lib/python3.9/site-packages/requests/api.py", line 59, in request return session.request(method=method, url=url, kwargs) File "/home/aitest2/anaconda3/lib/python3.9/site-packages/requests/sessions.py", line 589, in request resp = self.send(prep, send_kwargs) File "/home/aitest2/anaconda3/lib/python3.9/site-packages/requests/sessions.py", line 703, in send r = adapter.send(request, kwargs) File "/home/aitest2/anaconda3/lib/python3.9/site-packages/requests/adapters.py", line 519, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPConnectionPool(host='config-server-dev.ownit.top', port=80): Max retries exceeded with url: /notifications/v2?appId=chat-review&cluster=default&notifications=%5B%7B%22namespaceName%22%3A+%22application%22%2C+%22notificationId%22%3A+-1%7D%5D (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f6d9ff89eb0>: Failed to establish a new connection: [Errno -2] Name or service not known'))` 请问下,出现该问题的原因是什么?我该如何修改来解决这个问题呢?

nangongchengfeng commented 1 year ago

您好,因为你的配置走apollo的。这个是我私人的,当时为了调试 不泄露key。 现在你只需要 在config/config.py 文件中配置相关的信息,不要引用 apollo 的东西即可

nangongchengfeng commented 1 year ago

您好,因为你的配置走apollo的。这个是我私人的,当时为了调试 不泄露key。 现在你只需要 在config/config.py 文件中配置相关的信息,不要引用 apollo 的东西即可 @JeanStory image

JeanStory commented 1 year ago

@nangongchengfeng 感谢大佬指点,将config/apollo_config.py删除后,问题解决了.