forked from open-webui/open-webui
fix: cors & #281
This commit is contained in:
parent
0c30a08596
commit
0ae57b5ae1
5 changed files with 20 additions and 49 deletions
|
@ -61,6 +61,13 @@ def proxy(path):
|
|||
|
||||
r = None
|
||||
|
||||
del headers["Host"]
|
||||
del headers["Authorization"]
|
||||
del headers["Origin"]
|
||||
del headers["Referer"]
|
||||
|
||||
print(headers)
|
||||
|
||||
try:
|
||||
# Make a request to the target server
|
||||
r = requests.request(
|
||||
|
@ -86,8 +93,10 @@ def proxy(path):
|
|||
|
||||
return response
|
||||
except Exception as e:
|
||||
print(e)
|
||||
error_detail = "Ollama WebUI: Server Connection Error"
|
||||
if r != None:
|
||||
print(r.text)
|
||||
res = r.json()
|
||||
if "error" in res:
|
||||
error_detail = f"Ollama: {res['error']}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue