Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
8962d948
Unverified
Commit
8962d948
authored
Mar 25, 2024
by
Jannik S
Committed by
GitHub
Mar 25, 2024
Browse files
Check if running on K8s to correctly allocate Ollama Base URL
parent
c91c9543
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
1 deletion
+16
-1
backend/config.py
backend/config.py
+16
-1
No files found.
backend/config.py
View file @
8962d948
...
@@ -209,6 +209,7 @@ OLLAMA_API_BASE_URL = os.environ.get(
...
@@ -209,6 +209,7 @@ OLLAMA_API_BASE_URL = os.environ.get(
OLLAMA_BASE_URL
=
os
.
environ
.
get
(
"OLLAMA_BASE_URL"
,
""
)
OLLAMA_BASE_URL
=
os
.
environ
.
get
(
"OLLAMA_BASE_URL"
,
""
)
RUNNING_ON_K8S
=
os
.
environ
.
get
(
"KUBERNETES_SERVICE_HOST"
,
""
)
if
OLLAMA_BASE_URL
==
""
and
OLLAMA_API_BASE_URL
!=
""
:
if
OLLAMA_BASE_URL
==
""
and
OLLAMA_API_BASE_URL
!=
""
:
OLLAMA_BASE_URL
=
(
OLLAMA_BASE_URL
=
(
...
@@ -217,9 +218,23 @@ if OLLAMA_BASE_URL == "" and OLLAMA_API_BASE_URL != "":
...
@@ -217,9 +218,23 @@ if OLLAMA_BASE_URL == "" and OLLAMA_API_BASE_URL != "":
else
OLLAMA_API_BASE_URL
else
OLLAMA_API_BASE_URL
)
)
if
ENV
==
"prod"
:
if
ENV
==
"prod"
and
RUNNING_ON_K8S
==
""
:
if
OLLAMA_BASE_URL
==
"/ollama"
:
if
OLLAMA_BASE_URL
==
"/ollama"
:
OLLAMA_BASE_URL
=
"http://host.docker.internal:11434"
OLLAMA_BASE_URL
=
"http://host.docker.internal:11434"
else
:
OLLAMA_BASE_URL
=
"http://ollama-service.open-webui.svc.cluster.local:11434"
def
is_running_in_kubernetes
():
return
'KUBERNETES_SERVICE_HOST'
in
os
.
environ
# Setze EMV auf True, wenn in Kubernetes
if
is_running_in_kubernetes
():
os
.
environ
[
'EMV'
]
=
'True'
print
(
"Läuft in Kubernetes, EMV gesetzt auf True."
)
else
:
print
(
"Läuft nicht in Kubernetes."
)
OLLAMA_BASE_URLS
=
os
.
environ
.
get
(
"OLLAMA_BASE_URLS"
,
""
)
OLLAMA_BASE_URLS
=
os
.
environ
.
get
(
"OLLAMA_BASE_URLS"
,
""
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment