fix: cors & #281

This commit is contained in:
Timothy J. Baek 2023-12-26 13:40:03 -08:00
parent 0c30a08596
commit 0ae57b5ae1
5 changed files with 20 additions and 49 deletions

View file

@ -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']}"

View file

@ -1 +1 @@
uvicorn main:app --port 8080 --reload
uvicorn main:app --port 8080 --host 0.0.0.0 --reload