Allow multiple configurations for OPENAI_API_BASE_URLS

This commit is contained in:
Zadjad Rezai 2025-02-07 11:57:29 +00:00
parent eb466a6236
commit 7cc125f8cf
2 changed files with 19 additions and 5 deletions

View File

@ -113,19 +113,30 @@ spec:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
env: env:
{{- if or .Values.ollamaUrls .Values.ollama.enabled }} {{- if .Values.ollamaUrlsFromExtraEnv}}
{{- else if or .Values.ollamaUrls .Values.ollama.enabled }}
- name: "OLLAMA_BASE_URLS" - name: "OLLAMA_BASE_URLS"
value: {{ include "ollamaBaseUrls" . | quote }} value: {{ include "ollamaBaseUrls" . | quote }}
{{- else }} {{- else }}
- name: "ENABLE_OLLAMA_API" - name: "ENABLE_OLLAMA_API"
value: "False" value: "False"
{{- end }} {{- end }}
{{- if .Values.pipelines.enabled }} {{- if .Values.openaiBaseApiUrl }}
- name: "OPENAI_API_BASE_URL" # If only an OpenAI API value is set, set it to OPENAI_API_BASE_URL
value: {{ include "pipelines.serviceEndpoint" . }}
{{- else if .Values.openaiBaseApiUrl }}
- name: "OPENAI_API_BASE_URL" - name: "OPENAI_API_BASE_URL"
value: {{ .Values.openaiBaseApiUrl | quote }} value: {{ .Values.openaiBaseApiUrl | quote }}
{{- else if and (not .Values.openaiBaseApiUrls) .Values.pipelines.enabled }}
# If Pipelines is enabled and no OpenAI API value is set, set OPENAI_API_BASE_URL to the Pipelines server endpoint
- name: "OPENAI_API_BASE_URL"
value: {{ include "pipelines.serviceEndpoint" . | quote }}
{{- else if and .Values.openaiBaseApiUrls .Values.pipelines.enabled }}
# If OpenAI API value(s) set and Pipelines is enabled, use OPENAI_API_BASE_URLS to support all the endpoints in the chart
- name: "OPENAI_API_BASE_URLS"
value: {{ toJson .Values.openaiBaseApiUrls | quote }}
{{- else if and (not .Values.pipelines.enabled) (kindIs "slice" .Values.openaiBaseApiUrls) (gt (len .Values.openaiBaseApiUrls) 1) }}
# If Pipelines is disabled and multiple OpenAI API URLs are set, use OPENAI_API_BASE_URLS
- name: "OPENAI_API_BASE_URLS"
value: {{ toJson .Values.openaiBaseApiUrls | quote }}
{{- end }} {{- end }}
{{- if .Values.extraEnvVars }} {{- if .Values.extraEnvVars }}
{{- toYaml .Values.extraEnvVars | nindent 8 }} {{- toYaml .Values.extraEnvVars | nindent 8 }}

View File

@ -32,6 +32,9 @@ tika:
# -- A list of Ollama API endpoints. These can be added in lieu of automatically installing the Ollama Helm chart, or in addition to it. # -- A list of Ollama API endpoints. These can be added in lieu of automatically installing the Ollama Helm chart, or in addition to it.
ollamaUrls: [] ollamaUrls: []
# -- Disables taking Ollama Urls from `ollamaUrls` list
ollamaUrlsFromExtraEnv: false
websocket: websocket:
# -- Enables websocket support in Open WebUI with env `ENABLE_WEBSOCKET_SUPPORT` # -- Enables websocket support in Open WebUI with env `ENABLE_WEBSOCKET_SUPPORT`
enabled: false enabled: false