mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-11 20:05:19 +00:00
refac/fix: verify connection
This commit is contained in:
parent
c1e86ad0a6
commit
19ba6c06dd
1 changed files with 5 additions and 2 deletions
|
|
@ -72,10 +72,13 @@
|
|||
// remove trailing slash from url
|
||||
url = url.replace(/\/$/, '');
|
||||
|
||||
let _headers = null;
|
||||
|
||||
if (headers) {
|
||||
try {
|
||||
const _headers = JSON.parse(headers);
|
||||
_headers = JSON.parse(headers);
|
||||
if (typeof _headers !== 'object' || Array.isArray(_headers)) {
|
||||
_headers = null;
|
||||
throw new Error('Headers must be a valid JSON object');
|
||||
}
|
||||
headers = JSON.stringify(_headers, null, 2);
|
||||
|
|
@ -94,7 +97,7 @@
|
|||
auth_type,
|
||||
azure: azure,
|
||||
api_version: apiVersion,
|
||||
headers: JSON.parse(headers)
|
||||
...(_headers ? { headers: _headers } : {})
|
||||
}
|
||||
},
|
||||
direct
|
||||
|
|
|
|||
Loading…
Reference in a new issue