mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-16 20:07:49 +01:00
enh: allow plaintext for external tool servers
This commit is contained in:
@@ -626,7 +626,13 @@ async def execute_tool_server(
|
|||||||
if response.status >= 400:
|
if response.status >= 400:
|
||||||
text = await response.text()
|
text = await response.text()
|
||||||
raise Exception(f"HTTP error {response.status}: {text}")
|
raise Exception(f"HTTP error {response.status}: {text}")
|
||||||
return await response.json()
|
|
||||||
|
try:
|
||||||
|
response_data = await response.json()
|
||||||
|
except Exception:
|
||||||
|
response_data = await response.text()
|
||||||
|
|
||||||
|
return response_data
|
||||||
else:
|
else:
|
||||||
async with request_method(
|
async with request_method(
|
||||||
final_url,
|
final_url,
|
||||||
@@ -636,7 +642,13 @@ async def execute_tool_server(
|
|||||||
if response.status >= 400:
|
if response.status >= 400:
|
||||||
text = await response.text()
|
text = await response.text()
|
||||||
raise Exception(f"HTTP error {response.status}: {text}")
|
raise Exception(f"HTTP error {response.status}: {text}")
|
||||||
return await response.json()
|
|
||||||
|
try:
|
||||||
|
response_data = await response.json()
|
||||||
|
except Exception:
|
||||||
|
response_data = await response.text()
|
||||||
|
|
||||||
|
return response_data
|
||||||
|
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
error = str(err)
|
error = str(err)
|
||||||
|
|||||||
Reference in New Issue
Block a user