File size: 3,529 Bytes
0f72f45
b2c8c3c
 
0f72f45
b2c8c3c
0f72f45
b2c8c3c
0f72f45
 
 
b2c8c3c
 
2ff8e37
b2c8c3c
2ff8e37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9eff2c1
546d0f6
 
 
 
 
 
 
 
 
 
 
9391b1f
 
 
2ff8e37
 
546d0f6
 
 
 
 
 
9eff2c1
546d0f6
9eff2c1
546d0f6
 
 
 
 
 
 
 
9eff2c1
9391b1f
9eff2c1
9391b1f
 
 
 
2372d8d
9391b1f
 
546d0f6
 
 
 
 
9eff2c1
 
 
 
 
 
 
546d0f6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
---
title: Montaigne OpenWebUI
emoji: 🪶
colorFrom: yellow
colorTo: gray
sdk: docker
app_port: 8080
pinned: false
---

# Montaigne OpenWebUI

**This Space is the production user interface of the Montaigne chatbot.**

`https://ask-montaigne.pages.dev` redirects here; the admin dashboard (backend
user management) lives at `https://ask-montaigne.pages.dev/admin.html` and uses
its own cookie/CSRF auth.

The Space connects to the Montaigne FastAPI backend through an
OpenAI-compatible API exposed at `/v1`.

## Auth Model

OpenWebUI runs with authentication **disabled** (guest-only, `features.auth=false`):

- Anonymous visitors are mapped to per-IP backend guest accounts with a
  **5-message limit** per IP.
- At the limit, the UI patch shows a "Create free account" modal
  (`POST /auth/claim-guest`), which creates a backend account and sets its
  password at claim time.
- The account token rides on `/v1` requests as `variables.montaigne_token`;
  conversation continuity is keyed by `X-OpenWebUI-Chat-Id` / browser
  fingerprint.
- There are **no OpenWebUI accounts, no billing, no conversation sharing, and
  no OAuth buttons** in the UI. The backend `/auth/profile` and `/billing/*`
  endpoints stay dormant.

## UI Policy (Minimal Consumer Interface)

Standard users see a stripped-down chat-only interface.  The model selector,
Controls panel, advanced parameters, voice input/output, Settings menu,
and all power-user surfaces are hidden.  Only admins retain full access.

This is enforced in two layers:

1. **Persistent config** — the container entrypoint syncs
   `config/ui_policy.json` into OpenWebUI's database on every boot,
   ensuring permissions and feature flags always match the repo state.
2. **Runtime DOM patch** — `config/minimal_ui_patch.js` is copied into the
   built OpenWebUI app and injected into `index.html` at container startup.
   It hides the model selector, settings entry, archived chats, keyboard
   shortcuts, and other power-user affordances from the public UI, and
   implements the guest-limit claim modal.

### Updating the policy

Edit `config/ui_policy.json` and redeploy.  The entrypoint handles first
boot (bootstrap `config.json`) and subsequent boots (update the `config`
row in `webui.db`).

Key fields:

| Key | Purpose |
|-----|---------|
| `default_models` | Model pre-selected for every new chat |
| `default_pinned_models` | Model pinned in the selector |
| `permissions.chat.*` | Per-user chat capabilities |
| `permissions.features.*` | Per-user feature access |
| `permissions.workspace.*` | Per-user workspace access |
| `features.*` | Global OpenWebUI feature toggles |

### Minimal UI patch

`config/minimal_ui_patch.js` is intentionally lightweight: it uses a small
MutationObserver-based DOM patch instead of rebuilding OpenWebUI from source.
That keeps the Space repo small, avoids binary asset issues on Hugging Face,
and still removes the public-facing controls we do not want to expose.

If you upgrade OpenWebUI and the selectors stop matching, adjust only
`config/minimal_ui_patch.js` and redeploy.

## Conversation Starters

Configured in `config/prompt_suggestions.json`.  These Montaigne-style
prompts appear on the empty chat screen.

## Environment Variables

| Variable | Description |
|----------|-------------|
| `OPENAI_API_KEY` | Your API key for the backend LLM provider |
| `OPENAI_API_BASE` | Backend URL: `https://tgrumb-michel.hf.space/v1` |
| `DEFAULT_PROMPT_SUGGESTIONS` | Optional override for the repo-managed prompt suggestions |