mirror of
https://github.com/open-webui/open-webui.git
synced 2026-12-02 01:42:53 -05:00
fix: tool call through Tether hangs forever when the response is over 16 MiB (#35392)
When a tool on a computer connected through Tether returned more than 16 MiB, for example a large image, the tool call spun in the chat forever and the model never got an answer. Open WebUI rejected the oversized response and then tried to read it a second time, waiting for data that would never come. The tool call now fails right away with the "Response too large to buffer" error, which the model gets as the tool result. Fixes #35207
This commit is contained in:
1 parent
c3b38c8e65
commit
e771f3eb75
1 file changed
+6
-1
@@ -630,6 +630,7 @@ class RelayResponse:
|
||||
self.content_type = self.headers.get('Content-Type', '').split(';')[0]
|
||||
self.content = self
|
||||
self.cached = None
|
||||
self.error = None
|
||||
self.closed = False
|
||||
|
||||
async def iter_any(self):
|
||||
@@ -651,13 +652,17 @@ class RelayResponse:
|
||||
yield data, False
|
||||
|
||||
async def read(self):
|
||||
# The stream is closed, so a second read would wait forever.
|
||||
if self.error:
|
||||
raise self.error
|
||||
if self.cached is None:
|
||||
parts, size = [], 0
|
||||
async for data in self.iter_any():
|
||||
size += len(data)
|
||||
if size > MAX_MESSAGE:
|
||||
await self.close()
|
||||
raise HTTPException(413, 'Response too large to buffer; use streaming.')
|
||||
self.error = HTTPException(413, 'Response too large to buffer; use streaming.')
|
||||
raise self.error
|
||||
parts.append(data)
|
||||
self.cached = b''.join(parts)
|
||||
return self.cached
|
||||
|
||||
Reference in new issue
Block a user