Skip to content

Commit ba7bdaf

Browse files
authored
Merge pull request #1128 from open-webui/dev
2 parents 1ab5b3d + 7b2d077 commit ba7bdaf

File tree

4 files changed

+106
-12
lines changed

4 files changed

+106
-12
lines changed

docs/features/ai-knowledge/models.md

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,33 @@ These tools are specifically designed to help administrators quickly manage exte
147147

148148
Administrators can set **global default metadata and parameters** that apply as a baseline to all models. This eliminates the need to manually configure capabilities and inference settings for every model individually.
149149

150-
- **Default Model Metadata** (`DEFAULT_MODEL_METADATA`): Sets baseline capabilities (vision, web search, code interpreter, etc.) and other model metadata for all models. For capabilities, defaults and per-model values are merged — per-model overrides always win on conflicts. For other metadata fields, the global default is only applied when a model has no value set.
151-
- **Default Model Params** (`DEFAULT_MODEL_PARAMS`): Sets baseline inference parameters (temperature, top_p, max_tokens, seed, etc.) for all models. Per-model parameter overrides always take precedence.
150+
- **Default Model Metadata** (`DEFAULT_MODEL_METADATA`): Sets baseline capabilities (vision, web search, file context, code interpreter, builtin tools, etc.) and other model metadata for all models. For capabilities, defaults and per-model values are merged — per-model overrides always win on conflicts. For other metadata fields, the global default is only applied when a model has no value set.
151+
- **Default Model Params** (`DEFAULT_MODEL_PARAMS`): Sets baseline inference parameters (temperature, top_p, max_tokens, seed, function_calling, etc.) for all models. Per-model parameter overrides always take precedence — but only when a per-model value is explicitly set.
152152

153-
These settings are accessible via **Admin Settings → Models** and are persisted via `PersistentConfig`. See [`DEFAULT_MODEL_METADATA`](/reference/env-configuration#default_model_metadata) and [`DEFAULT_MODEL_PARAMS`](/reference/env-configuration#default_model_params) for details.
153+
These settings are accessible via **Admin Settings → Models → ⚙️ (gear icon)** and are persisted via `PersistentConfig`. See [`DEFAULT_MODEL_METADATA`](/reference/env-configuration#default_model_metadata) and [`DEFAULT_MODEL_PARAMS`](/reference/env-configuration#default_model_params) for details.
154+
155+
#### Merge Behavior
156+
157+
Understanding how defaults combine with per-model settings is important:
158+
159+
| Setting Type | Merge Strategy | Example |
160+
|---|---|---|
161+
| **Capabilities** (metadata) | Deep merge: `{...global, ...per_model}` | Global sets `file_context: false`, model sets `vision: true` → model gets both |
162+
| **Other metadata** (description, tags, etc.) | Fill-only: global applied when model value is `None` | Global sets `description: "Default"`, model has no description → model gets "Default" |
163+
| **Parameters** | Simple merge: `{...global, ...per_model}` | Global sets `temperature: 0.7`, model sets `temperature: 0.3` → model gets `0.3` |
164+
165+
The key subtlety: **if a model doesn't explicitly set a parameter, the global default is the only value**. This is especially important for `function_calling` — see the warning below.
166+
167+
:::warning Knowledge Base + Function Calling Interaction
168+
Setting `function_calling: native` in Global Model Params changes how **all** models handle attached Knowledge Bases. In native mode, model-attached KBs are **not** auto-injected via RAG — instead, the model must autonomously call builtin tools to retrieve knowledge. If a model doesn't explicitly override `function_calling` in its own Advanced Params, it inherits the global value silently.
169+
170+
Additionally, if `file_context` is disabled in Global Model Capabilities, the RAG retrieval handler is skipped for all models that don't explicitly enable it — meaning attached files and KBs produce no results.
171+
172+
If your models' attached Knowledge Bases are not working, check global defaults first. See [Knowledge Base Attached to Model Not Working](/troubleshooting/rag#13-knowledge-base-attached-to-model-not-working) for detailed troubleshooting steps.
173+
:::
154174

155175
:::tip
156-
Global defaults are ideal for enforcing organizational policies — for example, disabling code interpreter by default across all models, or setting a consistent temperature for all models.
176+
Global defaults are ideal for enforcing organizational policies — for example, disabling code interpreter by default across all models, or setting a consistent temperature for all models. However, be cautious with `function_calling` and capability toggles, as they can have unexpected effects on Knowledge Base behavior.
157177
:::
158178

159179
## Model Switching in Chat

docs/features/extensibility/plugin/development/events.mdx

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,38 @@ await __event_emitter__(
147147
)
148148
```
149149

150+
#### The `done` Field
151+
152+
The `done` field controls the **shimmer animation** on the status text in the UI:
153+
154+
| `done` value | Visual effect |
155+
|---|---|
156+
| `false` (or omitted) | Status text has a **shimmer/loading animation** — indicates ongoing processing |
157+
| `true` | Status text appears **static** — indicates the step is complete |
158+
159+
The backend does not inspect `done` at all — it simply saves the value and forwards it to the frontend. The shimmer effect is purely a frontend visual cue.
160+
161+
:::warning Always Emit a Final `done: True`
162+
If you emit status events, always send at least one with `done: True` at the end of your status sequence. Without it, the last status item keeps its shimmer animation indefinitely, making it look like processing never finished — even after the response is complete.
163+
164+
```python
165+
# ✅ Correct pattern
166+
await __event_emitter__({"type": "status", "data": {"description": "Fetching data...", "done": False}})
167+
# ... do work ...
168+
await __event_emitter__({"type": "status", "data": {"description": "Complete!", "done": True}})
169+
170+
# ⚠️ Broken pattern — shimmer never stops
171+
await __event_emitter__({"type": "status", "data": {"description": "Fetching data...", "done": False}})
172+
# ... do work, return result, but never sent done: True
173+
```
174+
:::
175+
176+
#### The `hidden` Field
177+
178+
When `hidden` is `true`, the status is saved to `statusHistory` but **not shown** in the current status display. This is useful for internal status tracking that shouldn't be visible to the user.
179+
180+
Additionally, when `message.content` is empty and the last status has `hidden: true` (or no status exists at all), the frontend shows a skeleton loader instead of the status bar — so hidden statuses don't replace the loading indicator.
181+
150182
---
151183

152184
### `chat:message:delta` or `message`
@@ -312,6 +344,10 @@ await __event_emitter__(
312344
**What this does exactly:**
313345
This event forces the Open WebUI frontend to update the "favorite" state of a message in its local cache. Without this emitter, if an **Action Function** modifies the `message.favorite` field in the database directly, the frontend (which maintains its own state) might overwrite your change during its next auto-save cycle. This emitter ensures the UI and database stay perfectly in sync.
314346

347+
:::note Designed for Actions
348+
While this event can technically be emitted from any plugin type (tools, pipes, filters), it is **designed for and meaningful in Actions**. Actions operate on existing messages and can modify the database directly. From a pipe or tool, emitting this event would update the frontend state temporarily, but unless the plugin also wrote to the database, the change would be lost on the next chat auto-save.
349+
:::
350+
315351
**Where it appears:**
316352
* **Message Toolbar**: When set to `True`, the "Heart" icon beneath the message will fill in, indicating it is favorited.
317353
* **Chat Overview**: Favorited messages (pins) are highlighted in the conversation overview, making it easier for users to locate key information later.
@@ -543,6 +579,12 @@ Because `execute` runs unsandboxed JavaScript in the user's browser session, it
543579
- `await __event_call__` is for when you need a response from the user (input, confirmation) or a return value from client-side code (execute).
544580
- The `execute` event is unique: it works with **both** helpers. Use `__event_call__` when you need the JS return value, or `__event_emitter__` for fire-and-forget execution (e.g., triggering downloads).
545581

582+
:::warning Pipes: Return Value vs Events
583+
For Pipes, be careful about mixing content delivery methods. If your `pipe()` method **returns a string**, that string becomes the final message content. If it **yields** (generator), the yielded chunks are streamed. If you also emit `chat:message:delta` events during execution, both the return/yield content and the event-based content are processed and can conflict.
584+
585+
**Recommendation**: Either use return/yield for content delivery, **or** use `chat:message:delta`/`chat:message` events, but avoid using both simultaneously.
586+
:::
587+
546588
---
547589

548590
## 💡 Tips & Advanced Notes

docs/troubleshooting/rag.mdx

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -436,19 +436,30 @@ If you want to prevent a model from accessing **any** knowledge base in native m
436436

437437
✅ **Solutions (check in order):**
438438

439-
1. **Ensure Built-in Tools are enabled for the model**:
439+
1. **Check Global Model Settings first**:
440+
- Go to **Admin Panel > Settings > Models > ⚙️ (gear icon)**
441+
- Expand **Model Parameters** and check if **Function Calling** is set to `native`
442+
- If it is, this **overrides all models** that don't explicitly set their own `function_calling` parameter — even if you never intended for a specific model to use native mode
443+
- Either change the global setting to `default`, or explicitly set `function_calling` in the per-model **Advanced Params** to override the global value
444+
- Also check the **Model Capabilities** section — if **File Context** is disabled globally, RAG won't process files for any model that doesn't explicitly enable it
445+
446+
:::warning Global Settings Override
447+
The most common cause of this issue is a global `Function Calling: native` setting in **Admin Panel > Settings > Models > ⚙️ > Model Parameters**. This silently applies to **every model** that doesn't explicitly set its own `function_calling` parameter. Per-model settings in **Workspace > Models > Edit > Advanced Params** will override the global default, but only if explicitly set — a model that simply doesn't have `function_calling` configured will inherit the global value.
448+
:::
449+
450+
2. **Ensure Built-in Tools are enabled for the model** (if using native mode):
440451
- Go to **Workspace > Models > Edit** for your model
441452
- Under **Builtin Tools**, make sure the **Knowledge Base** category is enabled (it is by default)
442453
- If this is disabled, the model has no way to query attached knowledge bases
443454

444-
2. **Add a system prompt hint**:
455+
3. **Add a system prompt hint** (if using native mode):
445456
- Some models need explicit guidance to use their tools. Add something like:
446457
> "When users ask questions, first use list_knowledge_bases to see what knowledge is available, then use query_knowledge_bases to search for relevant information before answering."
447458

448-
3. **Or disable Native Function Calling** for that model:
459+
4. **Or disable Native Function Calling** for that model:
449460
- In the model settings, disable Native Function Calling to restore the classic auto-injection RAG behavior from earlier versions
450461

451-
4. **Or use Full Context mode**:
462+
5. **Or use Full Context mode**:
452463
- Click on the attached knowledge base and select **"Use Entire Document"**
453464
- This bypasses RAG entirely and always injects the full content, regardless of native function calling settings
454465

docs/troubleshooting/sso.mdx

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,22 @@ Most OAUTH errors (loops, 401s, unresponsiveness) are due to an environment vari
7474

7575
:::
7676

77+
:::warning
78+
79+
**Kubernetes/YAML users:** Watch out for **trailing spaces in environment variable names!** In YAML, quoting a key like `'OAUTH_CLIENT_ID '` (with a trailing space inside the quotes) will set a variable named `OAUTH_CLIENT_ID ` (with a space at the end), which Open WebUI will **not** recognize. Always ensure your env var names have no trailing whitespace:
80+
81+
```yaml
82+
# ❌ Wrong — trailing space inside quotes:
83+
- name: 'OAUTH_CLIENT_ID '
84+
value: your_client_id
85+
86+
# ✅ Correct — no trailing space:
87+
- name: OAUTH_CLIENT_ID
88+
value: your_client_id
89+
```
90+
91+
:::
92+
7793
---
7894
7995
### 3. Missing Required Variables 🚨⚠️
@@ -106,24 +122,29 @@ OPENID_PROVIDER_URL=https://your-authentik-domain/application/o/your-app-name/.w
106122

107123
### 4. Persistent Configuration Conflicts 🔄💾
108124

109-
**New Issue:** Many users don't realize that OAuth settings are stored in the database after the first launch when `ENABLE_OAUTH_PERSISTENT_CONFIG=true` (default).
125+
**Important:** Open WebUI has **two** persistence settings that affect OAuth:
126+
127+
1. **`ENABLE_PERSISTENT_CONFIG`** (defaults to **`true`**) — Controls whether *all* settings (including OAuth) are loaded from the database rather than environment variables, once they've been saved to the DB.
128+
2. **`ENABLE_OAUTH_PERSISTENT_CONFIG`** (defaults to **`false`**) — An *additional* gate specifically for OAuth settings. When set to `false`, OAuth settings with a config path starting with `oauth.` are **not** loaded from the database, even if `ENABLE_PERSISTENT_CONFIG` is `true`.
129+
130+
By default, OAuth env vars **will** take priority over database values because `ENABLE_OAUTH_PERSISTENT_CONFIG` defaults to `false`. However, if you previously configured OAuth through the Admin Panel, those DB values may have been saved, and they will be loaded if `ENABLE_OAUTH_PERSISTENT_CONFIG` is later set to `true`.
110131

111132
#### Symptoms:
112133
- Changes to environment variables don't take effect after restart
113134
- Authentication worked once but broke after configuration changes
114135
- "No token found in localStorage" errors after reconfiguration
115136

116137
**Solutions:**
117-
1. **For Development/Testing:** Set `ENABLE_OAUTH_PERSISTENT_CONFIG=false` to always read from environment variables
138+
1. **For Development/Testing:** Ensure `ENABLE_OAUTH_PERSISTENT_CONFIG=false` (this is already the default) to always read from environment variables
118139
2. **For Production:** Either:
119140
- Configure settings through Admin Panel instead of environment variables, OR
120-
- Temporarily set `ENABLE_OAUTH_PERSISTENT_CONFIG=false`, restart to apply new env vars, then set back to `true`
141+
- Keep `ENABLE_OAUTH_PERSISTENT_CONFIG=false` (default) so that env vars always take priority for OAuth settings
121142
3. **Fresh Start:** Delete the database volume and restart with correct configuration
122143

123144
📌 **Example for Docker Compose:**
124145
```yaml
125146
environment:
126-
- ENABLE_OAUTH_PERSISTENT_CONFIG=false # Forces reading from env vars
147+
- ENABLE_OAUTH_PERSISTENT_CONFIG=false # Forces reading from env vars (this is the default)
127148
- OAUTH_CLIENT_ID=your_client_id
128149
- OAUTH_CLIENT_SECRET=your_secret
129150
- OPENID_PROVIDER_URL=your_provider_url

0 commit comments

Comments
 (0)