mirror of
https://github.com/open-webui/open-webui.git
synced 2026-12-02 01:42:53 -05:00
Merge pull request #33929 from Classic298/fix-chat-view-disconnect-log
fix: error traceback in the log when a chat's layout save is dropped
This commit is contained in:
1 parent
b6534c58ff
commit
494e2790af
1 file changed
+8
-4
@@ -52,6 +52,7 @@ from open_webui.utils.tool_permissions import DEFAULT_TOOL_PERMISSIONS_AUTO_PROM
|
||||
from open_webui.utils.tool_search import DEFAULT_TOOL_SEARCH_DECISIONS_PROMPT, validate_decisions_config
|
||||
from pydantic import BaseModel, Field, ValidationError, field_validator, model_validator
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
from starlette.requests import ClientDisconnect
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@@ -1424,10 +1425,13 @@ async def get_chat_view(
|
||||
async def bounded_chat_view(request: Request):
|
||||
# Bound the body before JSON/schema parsing, including chunked requests.
|
||||
body = bytearray()
|
||||
async for chunk in request.stream():
|
||||
body.extend(chunk)
|
||||
if len(body) > 1024 * 1024:
|
||||
raise HTTPException(status_code=413, detail='Chat view is too large')
|
||||
try:
|
||||
async for chunk in request.stream():
|
||||
body.extend(chunk)
|
||||
if len(body) > 1024 * 1024:
|
||||
raise HTTPException(status_code=413, detail='Chat view is too large')
|
||||
except ClientDisconnect:
|
||||
raise HTTPException(status_code=499)
|
||||
try:
|
||||
return ChatViewStateForm.model_validate_json(bytes(body))
|
||||
except ValueError:
|
||||
|
||||
Reference in new issue
Block a user