fix(ollama) additional fixes for ollama web sidecar and refactor some code (#19417)

**Description**
Fix issues where web gui was not persisted
added gui items (regardless of the db; the options have to be persisted
via env variables)

⚒️ Fixes  # <!--(issue)-->

**⚙️ Type of change**

- [ ] ⚙️ Feature/App addition
- [X] 🪛 Bugfix
- [ ] ⚠️ Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [X] 🔃 Refactor of current code

**🧪 How Has This Been Tested?**
<!--
Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details
for your test configuration
-->

**📃 Notes:**
<!-- Please enter any other relevant information here -->

**✔️ Checklist:**

- [X] ⚖️ My code follows the style guidelines of this project
- [X] 👀 I have performed a self-review of my own code
- [ ] #️⃣ I have commented my code, particularly in hard-to-understand
areas
- [ ] 📄 I have made corresponding changes to the documentation
- [ ] ⚠️ My changes generate no new warnings
- [ ] 🧪 I have added tests to this description that prove my fix is
effective or that my feature works
- [X] ⬆️ I increased versions for any altered app according to semantic
versioning
- [X] I made sure the title starts with `feat(chart-name):`,
`fix(chart-name):` or `chore(chart-name):`

** App addition**

If this PR is an app addition please make sure you have done the
following.

- [ ] 🖼️ I have added an icon in the Chart's root directory called
`icon.png`

---

_Please don't blindly check all the boxes. Read them and only check
those that apply.
Those checkboxes are there for the reviewer to see what is this all
about and
the status of this PR with a quick glance._

---------

Signed-off-by: Xstar97TheNoob <9399967+xstar97@users.noreply.github.com>
Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>
Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>
This commit is contained in:
Xstar97TheNoob 2024-03-24 20:47:39 -04:00 committed by GitHub
parent 6a4b5da3f2
commit 35192a5bf6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 110 additions and 12 deletions

View File

@ -36,4 +36,4 @@ sources:
- https://hub.docker.com/r/ollama/ollama
- https://ghcr.io/open-webui/open-webui
type: application
version: 5.2.5
version: 5.3.0

View File

@ -15,6 +15,82 @@ questions:
# Include{containerBasic}
# Include{containerAdvanced}
- variable: ollama
group: App Configuration
label: Ollama
schema:
additional_attrs: true
type: dict
attrs:
- variable: registration
label: Registration Configuration
schema:
additional_attrs: true
type: dict
attrs:
- variable: enabled
label: Enable Registration
schema:
type: boolean
default: true
- variable: def_user_role
label: Default User Role
schema:
type: string
default: pending
enum:
- value: pending
description: Pending
- value: user
description: User
- value: admin
description: Admin
- variable: stable_diffusion
label: Stable Diffusion Configuration
schema:
additional_attrs: true
type: dict
attrs:
- variable: base_url
label: Base Url
schema:
type: string
default: ""
- variable: whisper
label: Whisper Configuration
schema:
additional_attrs: true
type: dict
attrs:
- variable: model
label: Model
schema:
type: string
default: "base"
- variable: rag
label: Rag Configuration
schema:
additional_attrs: true
type: dict
attrs:
- variable: model_device_type
label: Model Device Type
schema:
type: string
default: "cpu"
enum:
- value: cpu
description: CPU
- value: gpu
description: GPU (nvidia)
- value: mps
description: MPS (Apple)
- variable: model
label: Embedding Model
schema:
type: string
default: "all-MiniLM-L6-v2"
# Include{containerConfig}
# Include{podOptions}
# Include{serviceRoot}

View File

@ -7,6 +7,13 @@ uiImage:
pullPolicy: IfNotPresent
tag: latest@sha256:d822c999c4d09f36e01a88473ceccfb53b88bbadf7c839ac6d8f5ae6d57620f5
securityContext:
container:
runAsNonRoot: false
readOnlyRootFilesystem: false
runAsUser: 0
runAsGroup: 0
service:
main:
targetSelector: ui
@ -32,17 +39,27 @@ ingress:
targetSelector:
api: api
ollama:
registration:
enabled: true
# admin | user | pending
def_user_role: "pending"
stable_diffusion:
base_url: ""
whisper:
model: "base"
rag:
# cpu | gpu | mps
model_device_type: "cpu"
# embedding model
model: "all-MiniLM-L6-v2"
workload:
main:
podSpec:
containers:
main:
imageSelector: image
securityContext:
runAsUser: 0
runAsGroup: 0
runAsNonRoot: false
readOnlyRootFilesystem: false
probes:
liveness:
enabled: true
@ -67,11 +84,8 @@ workload:
primary: true
enabled: true
imageSelector: uiImage
securityContext:
runAsUser: 0
runAsGroup: 0
runAsNonRoot: false
readOnlyRootFilesystem: false
resources:
excludeExtra: true
probes:
liveness:
enabled: true
@ -89,12 +103,20 @@ workload:
port: "{{ .Values.service.main.ports.main.port }}"
env:
PORT: "{{ .Values.service.main.ports.main.port }}"
DATA_DIR: "{{ .Values.persistence.data.mountPath }}"
OLLAMA_BASE_URL: '{{ printf "http://%v-api:%v" (include "tc.v1.common.lib.chart.names.fullname" $) .Values.service.api.ports.api.targetPort }}'
WEBUI_SECRET_KEY:
secretKeyRef:
name: ollama-secrets
key: WEBUI_SECRET_KEY
AUTOMATIC1111_BASE_URL: "{{ .Values.ollama.stable_diffusion.base_url }}"
ENABLE_SIGNUP: "{{ .Values.ollama.registration.enabled }}"
DEFAULT_USER_ROLE: "{{ .Values.ollama.registration.def_user_role }}"
WHISPER_MODEL: "{{ .Values.ollama.whisper.model }}"
RAG_EMBEDDING_MODEL: "{{ .Values.ollama.rag.model }}"
RAG_EMBEDDING_MODEL_DEVICE_TYPE: "{{ .Values.ollama.rag.model_device_type }}"
# OPENAI_API_BASE_URL
# OPENAI_API_KEY
# DEFAULT_MODELS
persistence:
config: