Langchain-Chatchat
Langchain-Chatchat copied to clipboard
API通信遇到错误:peer closed connection without sending complete message body (incomplete chunked read)
D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\torch_utils.py:831: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage() return self.fget.get(instance, owner)() 2024-04-26 16:03:56,433 - embeddings_api.py[line:39] - ERROR: Repo id must use alphanumeric chars or '-', '_', '.', '--' and '..' are forbidden, '-' and '.' cannot start or end the name, max length is 96: 'D:\chatglm_ai\Langchain-Chatchat\models\bge-large-zh-v1.5'. ERROR: Exception in ASGI application Traceback (most recent call last): File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\sse_starlette\sse.py", line 269, in call await wrap(partial(self.listen_for_disconnect, receive)) File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\sse_starlette\sse.py", line 258, in wrap await func() File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\sse_starlette\sse.py", line 215, in listen_for_disconnect message = await receive() ^^^^^^^^^^^^^^^ File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 535, in receive await self.message_event.wait() File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\asyncio\locks.py", line 213, in wait await fut asyncio.exceptions.CancelledError: Cancelled by cancel scope 1e0781cd090
During handling of the above exception, another exception occurred:
- Exception Group Traceback (most recent call last): | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 407, in run_asgi | result = await app( # type: ignore[func-returns-value] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 69, in call | return await self.app(scope, receive, send) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\fastapi\applications.py", line 1054, in call | await super().call(scope, receive, send) | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\starlette\applications.py", line 119, in call | await self.middleware_stack(scope, receive, send) | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\starlette\middleware\errors.py", line 186, in call | raise exc | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\starlette\middleware\errors.py", line 164, in call | await self.app(scope, receive, _send) | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\starlette\middleware\cors.py", line 83, in call | await self.app(scope, receive, send) | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\starlette\middleware\exceptions.py", line 62, in call | await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\starlette_exception_handler.py", line 64, in wrapped_app | raise exc | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app | await app(scope, receive, sender) | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\starlette\routing.py", line 762, in call | await self.middleware_stack(scope, receive, send) | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\starlette\routing.py", line 782, in app | await route.handle(scope, receive, send) | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\starlette\routing.py", line 297, in handle | await self.app(scope, receive, send) | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\starlette\routing.py", line 77, in app | await wrap_app_handling_exceptions(app, request)(scope, receive, send) | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\starlette_exception_handler.py", line 64, in wrapped_app | raise exc | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app | await app(scope, receive, sender) | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\starlette\routing.py", line 75, in app | await response(scope, receive, send) | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\sse_starlette\sse.py", line 255, in call | async with anyio.create_task_group() as task_group: | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\anyio_backends_asyncio.py", line 678, in aexit | raise BaseExceptionGroup( | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception) +-+---------------- 1 ---------------- | Traceback (most recent call last): | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\sse_starlette\sse.py", line 258, in wrap | await func() | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\sse_starlette\sse.py", line 245, in stream_response | async for data in self.body_iterator: | File "D:\chatglm_ai\Langchain-Chatchat\server\chat\knowledge_base_chat.py", line 81, in knowledge_base_chat_iterator | docs = await run_in_threadpool(search_docs, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\starlette\concurrency.py", line 40, in run_in_threadpool | return await anyio.to_thread.run_sync(func, *args) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\anyio\to_thread.py", line 56, in run_sync | return await get_async_backend().run_sync_in_worker_thread( | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\anyio_backends_asyncio.py", line 2144, in run_sync_in_worker_thread | return await future | ^^^^^^^^^^^^ | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\anyio_backends_asyncio.py", line 851, in run | result = context.run(func, *args) | ^^^^^^^^^^^^^^^^^^^^^^^^ | File "D:\chatglm_ai\Langchain-Chatchat\server\knowledge_base\kb_doc_api.py", line 38, in search_docs | docs = kb.search_docs(query, top_k, score_threshold) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "D:\chatglm_ai\Langchain-Chatchat\server\knowledge_base\kb_service\base.py", line 182, in search_docs | docs = self.do_search(query, top_k, score_threshold) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "D:\chatglm_ai\Langchain-Chatchat\server\knowledge_base\kb_service\faiss_kb_service.py", line 66, in do_search | embeddings = embed_func.embed_query(query) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "D:\chatglm_ai\Langchain-Chatchat\server\knowledge_base\kb_service\base.py", line 443, in embed_query | query_embed = embeddings[0] | ~~~~~~~~~~^^^ | TypeError: 'NoneType' object is not subscriptable +------------------------------------ 2024-04-26 16:03:56,467 - utils.py[line:197] - ERROR: RemoteProtocolError: API通信遇到错误:peer closed connection without sending complete message body (incomplete chunked read)
To address the issues you're encountering, here are targeted solutions:
-
API Communication Error ("peer closed connection without sending complete message body"): Implement retry logic for your API requests to handle intermittent network issues. Use libraries like
httpx
with a retry mechanism to automatically retry failed requests. -
"TypedStorage is deprecated" Warning: Update your PyTorch code to use the latest APIs. Replace
TypedStorage
usage with the recommendedtensor.untyped_storage()
or update to the latest version of PyTorch and adjust your code according to the new API guidelines. -
Repo ID Format Error: Ensure your repo id matches the required format using a regular expression that allows only alphanumeric characters and specific symbols. Adjust your validation logic to match these requirements closely.
-
NoneType
Object Error During Document Search: Before proceeding with operations on the response from your document search, verify that the response is notNone
. Implement checks to handle cases where the response might be empty or not as expected.
For the ExceptionGroup
error related to unhandled errors in a TaskGroup
, ensure all asynchronous tasks within the TaskGroup
have proper exception handling. This involves wrapping task operations in try-except blocks to catch and manage exceptions locally within tasks, preventing unhandled exceptions from escalating.
These solutions are designed to directly address the specific errors in your application, focusing on practical steps and adjustments. For the PyTorch deprecation warning and other library-specific issues, consulting the official documentation or community forums can provide additional insights and examples tailored to the latest versions.
Details
Sources
- 使用agent问答报错
- 使用知识库问答 问完问题后API通信遇到错误
- 项目使用时报错API通信遇到错误:对等关闭连接而不发送完整的消息正文(不完整的分块读取),再把openai降级为0.28.1后,项目运行报错,一些其他库和openai库冲突
- [BUG] API通信遇到错误:peer closed connection without sending complete message body (incomplete chunked read)
- [BUG] streamlit run webui.py 出现错误: API通信遇到错误:peer closed connection without sending complete message body (incomplete chunked read)
- [BUG] 简洁阐述问题 / Concis我安装后,LLM问答没问题,知识库不能问答,也不能上传文件,API通信遇到错误:peer closed connection without sending complete message body (incomplete chunked read)e description of the issue,请教如何查找服务器端口,做映射
-
[BUG]
dev v0.2.8
API通信遇到错误 - knowledge_base/samples/content/test_files/langchain-ChatGLM_open.jsonl
- webui_pages/utils.py
- server/knowledge_base/kb_doc_api.py
About Dosu This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
To continue the conversation, mention @dosu.
根据你提供的报错信息的头部错误提示:2024-04-26 16:03:56,433 - embeddings_api.py[line:39] - ERROR: Repo id must use alphanumeric chars or '-', '_', '.', '--' and '..' are forbidden, '-' and '.' cannot start or end the name, max length is 96: 'D:\chatglm_ai\Langchain-Chatchat\models\bge-large-zh-v1.5'. ERROR: Exception in ASGI application
看起来是model_config中配置的EMBEDDING_MODEL模型文件id有问题,检查一下路径,模型目录文件下级文件或者目录是否有缺失。