enh: allow plaintext for external tool servers
This commit is contained in:
parent
17cc3b7d72
commit
f890fe6901
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue