diff --git a/docs/platform/llm-server/ai/GNAI-022-TECH_OpenWebUI-DeepResearch.md b/docs/platform/llm-server/ai/GNAI-022-TECH_OpenWebUI-DeepResearch.md index 3c904f4..b9c8991 100644 --- a/docs/platform/llm-server/ai/GNAI-022-TECH_OpenWebUI-DeepResearch.md +++ b/docs/platform/llm-server/ai/GNAI-022-TECH_OpenWebUI-DeepResearch.md @@ -104,8 +104,21 @@ nach OWUI-v0.13.3 Reserved-Args (`user_prompt` lesen, History cappen). ## 5. Betrieb und E2E-Abnahme -- **UI (Browser, OIDC):** Model-Selector → `gnai-deep-research` wählen, - Frage stellen; Statusmeldungen streamen, Report mit Quellenliste. +- **UI (Browser, OIDC):** Model-Selector → `Deep Research (gnai)` + (`gnai-deep-research`) wählen, Frage stellen; Statusmeldungen streamen, + Report mit Quellenliste. **Sichtbarkeit (Befund 14.11.):** Pipe-Functions + ohne eigenen `model`-Tabelleneintrag sind admin-only — die Rolle seedet + daher zusätzlich eine `model`-Row (id = function id, name + „Deep Research (gnai)") + public read grant; ohne beides sieht nur der + Admin die Pipe im Selector. +- **Branding (GNAI-021, persistent nachgezogen 14.11.):** Favicons + + `custom.css`-Theme liegen in `roles/open_webui/files/branding/`, werden + nach `openwebui-branding/` deployt und per ro-Mount in + `/app/backend/open_webui/static/` **und** `/app/build/favicon.png` + gemountet (v0.13.3: index.html lädt `/static/*` aus dem Backend-static, + die Root-Route `/favicon.png` aus dem Build-Dir). Verifiziert von außen: + `/favicon.png` und `/static/favicon.png` md5 `78966788…` (Geist), + `/static/custom.css` 200 mit 5311 B. - **API:** `POST /api/chat/completions` mit `"model": "gnai-deep-research"`. - **E2E-Betreiberschritt (noch offen, analog GNAI-020 Abschnitt 4e/g):** temporären API-Key im Admin-UI anlegen (`auth.enable_api_keys` temporär diff --git a/llm-server/llm/ansible/roles/open_webui/README.md b/llm-server/llm/ansible/roles/open_webui/README.md index 5c7afc4..52973f1 100644 --- a/llm-server/llm/ansible/roles/open_webui/README.md +++ b/llm-server/llm/ansible/roles/open_webui/README.md @@ -56,4 +56,14 @@ Fetch-Limits) liegen in `defaults/main.yml`. Der Loop ruft die Engine direkt `http://searxng:8080`; Seiten-Fetch mit SSRF-Guard (keine privaten/loopback/ link-local IPs), Redirect-Chain mit Re-Validierung, Content-Cap und Timeout. Nach jeder Code-Änderung `sha256sum` neu berechnen und -`open_webui_deep_research_pipe_sha256` aktualisieren. +`open_webui_deep_research_pipe_sha256` aktualisieren. Sichtbarkeit im +Model-Selector: Pipe braucht zusätzlich eine Zeile in der `model`-Tabelle +(ohne sie sind Pipes admin-only) + public read grant — beides seedet die Rolle. + +## Branding (GNAI-021) + +`files/branding/` (Geist-Favicons + `custom.css` Theme „gnai-catppuccin-mocha") +wird nach `open_webui_branding_dir` deployt und per read-only Mounts in +`/app/backend/open_webui/static/` des Image gemountet — update-persistent, +da OpenWebUIs Start-Wipe von `static/` ro-Mounts nicht anfassen kann. +Datei-Ersetzen erzeugt einen neuen Inode, daher notify Restart. diff --git a/llm-server/llm/ansible/roles/open_webui/defaults/main.yml b/llm-server/llm/ansible/roles/open_webui/defaults/main.yml index 4246e62..6dd9a9f 100644 --- a/llm-server/llm/ansible/roles/open_webui/defaults/main.yml +++ b/llm-server/llm/ansible/roles/open_webui/defaults/main.yml @@ -64,6 +64,19 @@ open_webui_host_addr: 10.0.0.90 open_webui_host_port: 8081 open_webui_container_port: 8080 +# Branding (GNAI-021): Geist-Favicons + Theme custom.css ("gnai-catppuccin- +# mocha"), update-persistent via read-only mounts into the image's static +# dir. The files live in files/branding/ (favicon.png is byte-identical to +# the monitoring dashboard's original ghost, md5 789667887d0f5f704213222bfe61ad52). +open_webui_branding_dir: /var/lib/ghostnet-ai/production/openwebui-branding +open_webui_branding_files: + - favicon.png + - favicon.svg + - favicon.ico + - favicon-96x96.png + - apple-touch-icon.png + - custom.css + # Persistent app data (SQLite DB, uploads, cache). open_webui_data_dir: /var/lib/ghostnet-ai/production/openwebui-data diff --git a/llm-server/llm/ansible/roles/open_webui/files/branding/apple-touch-icon.png b/llm-server/llm/ansible/roles/open_webui/files/branding/apple-touch-icon.png new file mode 100644 index 0000000..fa7dbd1 Binary files /dev/null and b/llm-server/llm/ansible/roles/open_webui/files/branding/apple-touch-icon.png differ diff --git a/llm-server/llm/ansible/roles/open_webui/files/branding/custom.css b/llm-server/llm/ansible/roles/open_webui/files/branding/custom.css new file mode 100644 index 0000000..7f8914e --- /dev/null +++ b/llm-server/llm/ansible/roles/open_webui/files/branding/custom.css @@ -0,0 +1,134 @@ +/* Ghostnet.AI OpenWebUI theme "gnai-catppuccin-mocha" (GNAI-021). + * + * Farbschema identisch zum Monitoring-Dashboard (GNMON, app.css): + * Catppuccin Mocha + Monospace (DejaVu Sans Mono, wie im Dashboard selbst + * gehostet — hier als System-Stack, damit keine Font-Datei gemountet werden + * muss). + * + * Auslieferung: read-only bind mount over + * /app/backend/open_webui/static/custom.css (siehe Quadlet). index.html lädt + * /static/custom.css auf jeder Seite — update-sicher, weil der Mount host-seitig + * im Quadlet liegt und die Datei aus dem Repo kommt. + * + * Default-Theme: OpenWebUI speichert die Theme-Wahl (light/dark) pro Browser in + * localStorage; es gibt keinen server-seitigen Default. Dieses CSS bildet daher + * BEIDE Modi (html.light und html.dark) auf dieselbe Mocha-Palette ab — das + * GNMON-Theme ist damit für alle Nutzer der Default-Look, unabhängig von der + * Theme-Auswahl im UI. + * + * !important ist nötig, weil setTheme() (src/lib/utils/theme.ts) die Graustufen + * 800/850/900/950 als Inline-Style auf setzt; Inline-Styles schlagen + * Stylesheet-Regeln ohne !important. Ungelayertes CSS (diese Datei) schlägt + * además die @layer-theme-Variablen von Tailwind v4. + */ + +/* Basis (gilt immer, auch vor dem Setzen der light/dark-Klasse): Modus-Mapping + * für dark — zugleich Akzent-Rampen für beide Modi. */ +html:root { + color-scheme: dark; + + /* Monospace wie GNMON */ + --font-sans: "DejaVu Sans Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace !important; + + /* Graustufen → Catppuccin Mocha (Dark-Semantik: 950 = tiefster Hintergrund) */ + --color-gray-50: #cdd6f4 !important; /* text */ + --color-gray-100: #cdd6f4 !important; /* text */ + --color-gray-200: #bac2de !important; /* subtext1 */ + --color-gray-300: #a6adc8 !important; /* subtext0 */ + --color-gray-400: #7f849c !important; /* overlay1 */ + --color-gray-500: #6c7086 !important; /* overlay0 */ + --color-gray-600: #585b70 !important; /* surface2 */ + --color-gray-700: #45475a !important; /* surface1 */ + --color-gray-800: #313244 !important; /* surface0 */ + --color-gray-850: #181825 !important; /* mantle */ + --color-gray-900: #1e1e2e !important; /* base */ + --color-gray-950: #11111b !important; /* crust */ + + /* In dark mode ist --color-white meist Textfarbe, --color-black Button-Grund */ + --color-white: #cdd6f4 !important; + --color-black: #11111b !important; + + /* Akzenten → Catppuccin (Links/Fokus blau, Erfolg grün, Fehler rot, Warnung gelb) */ + --color-blue-300: #b4befe !important; /* lavender */ + --color-blue-400: #74c7ec !important; /* sapphire */ + --color-blue-500: #89b4fa !important; /* blue */ + --color-blue-600: #89b4fa !important; + --color-blue-700: #74c7ec !important; + --color-green-400: #a6e3a1 !important; + --color-green-500: #a6e3a1 !important; + --color-green-600: #94e2d5 !important; /* teal */ + --color-red-400: #f38ba8 !important; + --color-red-500: #f38ba8 !important; + --color-yellow-300: #f9e2af !important; + --color-yellow-400: #f9e2af !important; + --color-yellow-500: #fab387 !important; /* peach */ + --color-orange-400: #fab387 !important; + --color-orange-500: #fab387 !important; + --color-violet-400: #cba6f7 !important; /* mauve */ + --color-violet-500: #cba6f7 !important; + --color-teal-400: #94e2d5 !important; + --color-teal-500: #94e2d5 !important; +} + +/* html.dark: identisch zur Basis — explizit mit !important gegen die + * Inline-Styles, die setTheme() für dark/oled-dark auf schreibt. */ +html.dark { + --color-gray-800: #313244 !important; + --color-gray-850: #181825 !important; + --color-gray-900: #1e1e2e !important; + --color-gray-950: #11111b !important; +} + +/* html.light: die Light-Rampe wird auf DERSELBE dunkle Mocha-Palette abgebildet + * (bg-white → base, text-gray-900 → text usw.), damit auch Nutzer mit Theme + * "light"/"system" (prefers-color-scheme: light) das GNMON-Theme sehen. */ +html.light { + --color-white: #1e1e2e !important; /* Light-Haupthintergrund → base */ + --color-black: #cdd6f4 !important; /* Light-Text → text */ + --color-gray-50: #181825 !important; /* helle Panels → mantle */ + --color-gray-100: #313244 !important; /* → surface0 */ + --color-gray-200: #45475a !important; /* Borders → surface1 */ + --color-gray-300: #585b70 !important; /* → surface2 */ + --color-gray-400: #6c7086 !important; /* → overlay0 */ + --color-gray-500: #7f849c !important; /* → overlay1 */ + --color-gray-600: #a6adc8 !important; /* → subtext0 */ + --color-gray-700: #bac2de !important; /* → subtext1 */ + --color-gray-800: #cdd6f4 !important; /* → text */ + --color-gray-850: #cdd6f4 !important; + --color-gray-900: #cdd6f4 !important; /* Light-Text → text */ + --color-gray-950: #cdd6f4 !important; +} + +/* Splash-Screen (app.html) auf Mocha trimmen — !important schlägt die + * Inline-Styles des Splash-Markups. */ +#splash-screen { + background: #1e1e2e !important; +} + +#splash-screen #progress-background { + background-color: #313244 !important; +} + +#splash-screen #progress-bar { + background-color: #a6e3a1 !important; +} + +/* Akzente im Fließtext (GNMON: Links sapphire, Code peach) */ +.marked a, +.prose a { + color: #74c7ec; +} + +.marked a:hover, +.prose a:hover { + color: #89dceb; +} + +code { + color: #fab387; +} + +::selection { + background: rgba(203, 166, 247, 0.35); /* mauve */ + color: #cdd6f4; +} diff --git a/llm-server/llm/ansible/roles/open_webui/files/branding/favicon-96x96.png b/llm-server/llm/ansible/roles/open_webui/files/branding/favicon-96x96.png new file mode 100644 index 0000000..31f37cb Binary files /dev/null and b/llm-server/llm/ansible/roles/open_webui/files/branding/favicon-96x96.png differ diff --git a/llm-server/llm/ansible/roles/open_webui/files/branding/favicon.ico b/llm-server/llm/ansible/roles/open_webui/files/branding/favicon.ico new file mode 100644 index 0000000..7aa0608 Binary files /dev/null and b/llm-server/llm/ansible/roles/open_webui/files/branding/favicon.ico differ diff --git a/llm-server/llm/ansible/roles/open_webui/files/branding/favicon.png b/llm-server/llm/ansible/roles/open_webui/files/branding/favicon.png new file mode 100644 index 0000000..23030a4 Binary files /dev/null and b/llm-server/llm/ansible/roles/open_webui/files/branding/favicon.png differ diff --git a/llm-server/llm/ansible/roles/open_webui/files/branding/favicon.svg b/llm-server/llm/ansible/roles/open_webui/files/branding/favicon.svg new file mode 100644 index 0000000..3581051 --- /dev/null +++ b/llm-server/llm/ansible/roles/open_webui/files/branding/favicon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/llm-server/llm/ansible/roles/open_webui/tasks/main.yml b/llm-server/llm/ansible/roles/open_webui/tasks/main.yml index c05b421..248d62f 100644 --- a/llm-server/llm/ansible/roles/open_webui/tasks/main.yml +++ b/llm-server/llm/ansible/roles/open_webui/tasks/main.yml @@ -442,10 +442,34 @@ failed_when: >- open_webui_pipe_hash.stdout.split()[0] != open_webui_deep_research_pipe_sha256 +- name: Ensure the branding directory exists + ansible.builtin.file: + path: "{{ open_webui_branding_dir }}" + state: directory + owner: "{{ open_webui_user }}" + group: "{{ open_webui_user }}" + mode: "0750" + +- name: Deploy the branding files (favicons + custom.css theme, GNAI-021) + # Read-only mounted into the image's static dir by the quadlet below. + # File replaces create a new inode, so a restart is required for the + # running container to pick up new content (GNAI-021 Inode-Befund). + ansible.builtin.copy: + src: "files/branding/{{ item }}" + dest: "{{ open_webui_branding_dir }}/{{ item }}" + owner: "{{ open_webui_user }}" + group: "{{ open_webui_user }}" + mode: "0644" + loop: "{{ open_webui_branding_files }}" + notify: + - Reload workload user manager + - Restart OpenWebUI unit + - name: Ensure the deep-research pipe exists, is active and publicly readable in OpenWebUI - # Pipe functions (type='pipe') appear as models in the selector with - # id=function.id; the public read grant on resource_type='model' makes it - # visible to every authenticated OIDC user. Valves are stored as plain + # Pipe functions (type='pipe') appear in the model selector with + # id=function.id; non-admin users only see them when a row in the `model` + # table exists for that id (plus a public read access_grant on + # resource_type='model'). Both are seeded here. Valves are stored as plain # JSON (no secret fields). Idempotent; touches only the app DB. ansible.builtin.shell: | set -euo pipefail @@ -493,6 +517,24 @@ (str(uuid.uuid4()), "model", fn_id, "user", "*", "read", now), ) changed = True + # model row: without it, pipe models are visible to admins only + # (open-webui issue: "Pipe models without a model entry are shown to + # admins only"). With row + grant, every OIDC user sees the pipe. + mrow = con.execute("select name, meta, is_active from model where id=?", (fn_id,)).fetchone() + model_meta = json.dumps({"description": "Deep Research: iterativer plan→SearXNG→fetch→Synthese-Loop mit Quellen (GNAI-022). Engine: Production-llama.cpp, SearXNG: kuratiert."}) + if not mrow: + con.execute( + "insert into model (id, user_id, base_model_id, name, params, meta, is_active, version_id, created_at, updated_at)" + " values (?,?,?,?,?,?,?,?,?,?)", + (fn_id, "openwebui", None, "Deep Research (gnai)", "{}", model_meta, 1, str(uuid.uuid4()), now, now), + ) + changed = True + elif mrow[0] != "Deep Research (gnai)" or mrow[1] != model_meta or mrow[2] != 1: + con.execute( + "update model set name=?, meta=?, is_active=1, updated_at=? where id=?", + ("Deep Research (gnai)", model_meta, now, fn_id), + ) + changed = True con.commit() print("CHANGED" if changed else "UNCHANGED") PYEOF @@ -519,6 +561,8 @@ (fn_id,), ).fetchone()[0] assert grant == 1, "public read grant missing" + mrow = con.execute("select is_active from model where id=?", (fn_id,)).fetchone() + assert mrow and mrow[0] == 1, "model row for pipe missing (pipe would be admin-only)" print("PIPE-OK") PYEOF args: diff --git a/llm-server/llm/ansible/roles/open_webui/templates/open-webui.container.j2 b/llm-server/llm/ansible/roles/open_webui/templates/open-webui.container.j2 index 4888c2d..8da212a 100644 --- a/llm-server/llm/ansible/roles/open_webui/templates/open-webui.container.j2 +++ b/llm-server/llm/ansible/roles/open_webui/templates/open-webui.container.j2 @@ -11,6 +11,14 @@ Network={{ open_webui_network_name }} Network={{ open_webui_egress_network_name }} PublishPort={{ open_webui_host_addr }}:{{ open_webui_host_port }}:{{ open_webui_container_port }} Volume={{ open_webui_data_dir }}:/app/backend/data:rw +# Branding: read-only file mounts into the image's static dir; OpenWebUI's +# start-wipe of static/ cannot touch ro mounts (GNAI-021). +{% for f in open_webui_branding_files %} +Volume={{ open_webui_branding_dir }}/{{ f }}:/app/backend/open_webui/static/{{ f }}:ro +{% endfor %} +# v0.13.3 serves the root route /favicon.png from the frontend build dir, +# while index.html links /static/favicon.png (backend static, mounted above). +Volume={{ open_webui_branding_dir }}/favicon.png:/app/build/favicon.png:ro # Secrets are injected as environment variables, never written to disk or git. Secret={{ open_webui_webui_secret_key_secret }},type=env,target=WEBUI_SECRET_KEY Secret={{ open_webui_engine_api_key_secret }},type=env,target=OPENAI_API_KEY