描述:Traceback (most recent call last):
File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/uvicorn/protocols/http/httptools_impl.py", line 426, in run_asgi
result = await app( # type: ignore[func-returns-value]
File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in call
return await self.app(scope, receive, send)
File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/fastapi/applications.py", line 1115, in call
await super().call(scope, receive, send)
File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/starlette/applications.py", line 122, in call
await self.middleware_stack(scope, receive, send)
File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/starlette/middleware/errors.py", line 184, in call
raise exc
File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/starlette/middleware/errors.py", line 162, in call
await self.app(scope, receive, _send)
File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/starlette/middleware/exceptions.py", line 79, in call
raise exc
File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/starlette/middleware/exceptions.py", line 68, in call
await self.app(scope, receive, sender)
File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/fastapi/middleware/asyncexitstack.py", line 20, in call
raise e
File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/fastapi/middleware/asyncexitstack.py", line 17, in call
await self.app(scope, receive, send)
File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/starlette/routing.py", line 718, in call
await route.handle(scope, receive, send)
File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/starlette/routing.py", line 276, in handle
await self.app(scope, receive, send)
File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/starlette/routing.py", line 69, in app
await response(scope, receive, send)
File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/starlette/responses.py", line 277, in call
await wrap(partial(self.listen_for_disconnect, receive))
File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 597, in aexit
raise exceptions[0]
File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/starlette/responses.py", line 273, in wrap
await func()
File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/starlette/responses.py", line 262, in stream_response
async for chunk in self.body_iterator:
File "/home/zhuhaifeng/project/chatchat7/server/chat/search_engine_chat.py", line 159, in search_engine_chat_iterator
docs = await lookup_search_engine(query, search_engine_name, top_k, split_result=split_result)
File "/home/zhuhaifeng/project/chatchat7/server/chat/search_engine_chat.py", line 111, in lookup_search_engine
results = SEARCH_ENGINES[search_engine_name](query, result_len=top_k)
File "/home/zhuhaifeng/project/chatchat7/server/chat/search_engine_chat.py", line 37, in duckduckgo_search
return search.results(text, result_len)
File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/langchain/utilities/duckduckgo_search.py", line 108, in results
for i, res in enumerate(results, 1):
File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/duckduckgo_search/duckduckgo_search.py", line 95, in text
for i, result in enumerate(results, start=1):
File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/duckduckgo_search/duckduckgo_search.py", line 123, in _text_api
vqd = self._get_vqd(keywords)
File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/duckduckgo_search/duckduckgo_search.py", line 59, in _get_vqd
resp = self._get_url("POST", "https://duckduckgo.com", data={"q": keywords})
File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/duckduckgo_search/duckduckgo_search.py", line 54, in _get_url
raise ex
File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/duckduckgo_search/duckduckgo_search.py", line 45, in _get_url
resp = self._client.request(method, url, follow_redirects=True, **kwargs)
File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/httpx/_client.py", line 814, in request
return self.send(request, auth=auth, follow_redirects=follow_redirects)
File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/httpx/_client.py", line 901, in send
response = self._send_handling_auth(
File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/httpx/_client.py", line 929, in _send_handling_auth
response = self._send_handling_redirects(
File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/httpx/_client.py", line 966, in _send_handling_redirects
response = self._send_single_request(request)
File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/httpx/_client.py", line 1002, in _send_single_request
response = transport.handle_request(request)
File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/httpx/_transports/default.py", line 228, in handle_request
resp = self._pool.handle_request(req)
File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/contextlib.py", line 131, in exit
self.gen.throw(type, value, traceback)
File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/httpx/_transports/default.py", line 83, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.ConnectTimeout: _ssl.c:1114: The handshake operation timed out
2023-11-21 16:18:34,877 - utils.py[line:187] - ERROR: RemoteProtocolError: API通信遇到错误:peer closed connection without sending complete message body (incomplete chunked read)
{'timeout': 300.0, 'proxies': {'all://127.0.0.1': None, 'all://localhost': None, 'http://127.0.0.1': None, 'http://': None, 'https://': None, 'all://': None}}
问题:duckduckgo老是报错,链接超时;一会能用一会不能用的。
描述:Traceback (most recent call last): File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/uvicorn/protocols/http/httptools_impl.py", line 426, in run_asgi result = await app( # type: ignore[func-returns-value] File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in call return await self.app(scope, receive, send) File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/fastapi/applications.py", line 1115, in call await super().call(scope, receive, send) File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/starlette/applications.py", line 122, in call await self.middleware_stack(scope, receive, send) File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/starlette/middleware/errors.py", line 184, in call raise exc File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/starlette/middleware/errors.py", line 162, in call await self.app(scope, receive, _send) File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/starlette/middleware/exceptions.py", line 79, in call raise exc File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/starlette/middleware/exceptions.py", line 68, in call await self.app(scope, receive, sender) File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/fastapi/middleware/asyncexitstack.py", line 20, in call raise e File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/fastapi/middleware/asyncexitstack.py", line 17, in call await self.app(scope, receive, send) File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/starlette/routing.py", line 718, in call await route.handle(scope, receive, send) File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/starlette/routing.py", line 276, in handle await self.app(scope, receive, send) File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/starlette/routing.py", line 69, in app await response(scope, receive, send) File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/starlette/responses.py", line 277, in call await wrap(partial(self.listen_for_disconnect, receive)) File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 597, in aexit raise exceptions[0] File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/starlette/responses.py", line 273, in wrap await func() File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/starlette/responses.py", line 262, in stream_response async for chunk in self.body_iterator: File "/home/zhuhaifeng/project/chatchat7/server/chat/search_engine_chat.py", line 159, in search_engine_chat_iterator docs = await lookup_search_engine(query, search_engine_name, top_k, split_result=split_result) File "/home/zhuhaifeng/project/chatchat7/server/chat/search_engine_chat.py", line 111, in lookup_search_engine results = SEARCH_ENGINES[search_engine_name](query, result_len=top_k) File "/home/zhuhaifeng/project/chatchat7/server/chat/search_engine_chat.py", line 37, in duckduckgo_search return search.results(text, result_len) File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/langchain/utilities/duckduckgo_search.py", line 108, in results for i, res in enumerate(results, 1): File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/duckduckgo_search/duckduckgo_search.py", line 95, in text for i, result in enumerate(results, start=1): File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/duckduckgo_search/duckduckgo_search.py", line 123, in _text_api vqd = self._get_vqd(keywords) File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/duckduckgo_search/duckduckgo_search.py", line 59, in _get_vqd resp = self._get_url("POST", "https://duckduckgo.com", data={"q": keywords}) File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/duckduckgo_search/duckduckgo_search.py", line 54, in _get_url raise ex File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/duckduckgo_search/duckduckgo_search.py", line 45, in _get_url resp = self._client.request(method, url, follow_redirects=True, **kwargs) File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/httpx/_client.py", line 814, in request return self.send(request, auth=auth, follow_redirects=follow_redirects) File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/httpx/_client.py", line 901, in send response = self._send_handling_auth( File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/httpx/_client.py", line 929, in _send_handling_auth response = self._send_handling_redirects( File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/httpx/_client.py", line 966, in _send_handling_redirects response = self._send_single_request(request) File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/httpx/_client.py", line 1002, in _send_single_request response = transport.handle_request(request) File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/httpx/_transports/default.py", line 228, in handle_request resp = self._pool.handle_request(req) File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/contextlib.py", line 131, in exit self.gen.throw(type, value, traceback) File "/home/zhuhaifeng/langchain-chatchat6/lib/python3.8/site-packages/httpx/_transports/default.py", line 83, in map_httpcore_exceptions raise mapped_exc(message) from exc httpx.ConnectTimeout: _ssl.c:1114: The handshake operation timed out 2023-11-21 16:18:34,877 - utils.py[line:187] - ERROR: RemoteProtocolError: API通信遇到错误:peer closed connection without sending complete message body (incomplete chunked read) {'timeout': 300.0, 'proxies': {'all://127.0.0.1': None, 'all://localhost': None, 'http://127.0.0.1': None, 'http://': None, 'https://': None, 'all://': None}}