refac: openai allow empty key

This commit is contained in:
Timothy J. Baek
2024-05-29 01:12:25 -07:00
parent 943baad689
commit e8d4e03c0d
5 changed files with 91 additions and 44 deletions

View File

@@ -219,6 +219,8 @@ async def get_ollama_tags(
return models
else:
url = app.state.config.OLLAMA_BASE_URLS[url_idx]
r = None
try:
r = requests.request(method="GET", url=f"{url}/api/tags")
r.raise_for_status()
@@ -270,6 +272,8 @@ async def get_ollama_versions(url_idx: Optional[int] = None):
)
else:
url = app.state.config.OLLAMA_BASE_URLS[url_idx]
r = None
try:
r = requests.request(method="GET", url=f"{url}/api/version")
r.raise_for_status()

View File

@@ -407,9 +407,6 @@ async def proxy(path: str, request: Request, user=Depends(get_verified_user)):
target_url = f"{url}/{path}"
if key == "":
raise HTTPException(status_code=401, detail=ERROR_MESSAGES.API_KEY_NOT_FOUND)
headers = {}
headers["Authorization"] = f"Bearer {key}"
headers["Content-Type"] = "application/json"