mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-16 01:35:36 -04:00
This commit is contained in:
+5
-1
@@ -270,8 +270,10 @@ def _is_ollama_native_url(url: str) -> bool:
|
||||
path = (parsed.path or "").rstrip("/")
|
||||
if _host_match(url, "ollama.com"):
|
||||
return True
|
||||
if path.startswith("/v1"):
|
||||
return False
|
||||
local_ollama_host = host in {"localhost", "127.0.0.1", "0.0.0.0", "::1"} or parsed.port == 11434
|
||||
return local_ollama_host and (path == "/api" or path.startswith("/api/"))
|
||||
return local_ollama_host and (path == "" or path == "/api" or path.startswith("/api/"))
|
||||
|
||||
|
||||
def _ollama_api_root(url: str) -> str:
|
||||
@@ -287,6 +289,8 @@ def _ollama_api_root(url: str) -> str:
|
||||
return url[: -len("/generate")]
|
||||
if path.endswith("/api"):
|
||||
return url
|
||||
if path == "":
|
||||
return url + "/api"
|
||||
if _host_match(url, "ollama.com"):
|
||||
root = f"{parsed.scheme}://{parsed.netloc}" if parsed.scheme and parsed.netloc else "https://ollama.com"
|
||||
return root.rstrip("/") + "/api"
|
||||
|
||||
Reference in New Issue
Block a user