fix: Show connection tags in Admin - Models tag filter (also fixes pl-PL locale file formatting) - #29191
Closed
BLACKTHOMAS wants to merge 2 commits into
Closed
Conversation
Tags added to a provider connection (Admin -> Connections -> Advanced) were merged into the runtime model list (/api/models) but were invisible to /api/v1/models/base/tags and /api/v1/models/base, which read tags only from the model DB. As a result the Admin - Models tag filter did not list connection tags, and filtering by one of them returned nothing. Fixes open-webui#29190
12 tasks
Matches the CI 'Format & Build' prettier pass; also adds the missing trailing newline to the pl-PL locale file (pre-existing from open-webui#29184).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Checklist
Do not open a pull request as the first step.
For real, reproducible bugs, start with a well-described Issue that explains the problem, why it matters, and what outcome you are looking for.
For feature requests, enhancements, behavior changes, UI/UX changes, architecture changes, suspected fixes, or unconfirmed approaches, start with an active Discussion. Merely opening a discussion is not enough; it needs to be actively discussed.
If you want to propose an implementation, include it only as a reference in the Issue or Discussion, such as a local diff, patch, or branch.
Opening an Issue or Discussion does not mean a PR is the right next step. Maintainers will confirm when a PR would be useful.
We ask for this because PRs, especially from first-time contributors, often need broader maintainer context on product direction, scope, architecture, UX, edge cases, compatibility, documentation, and long-term maintenance before implementation.
Unsolicited PRs may be closed without review. Contributors with a history of successful merged PRs may be given more latitude.
Note: This PR is opened against the existing, maintainer-labeled
bugissue #29190. It is intended as a concrete reference implementation for that issue — happy to hold it until maintainers confirm a PR is fully welcome.Before submitting, make sure you've checked and filled out the following:
Closes #29190.devbranch. PRs targetingmainwill be immediately closed.Config.get_many) and existing runtime-merged tags instead of adding new state.dev, and contains no unrelated feature work.fixProblem
#29190 — tags added to a provider connection (Admin → Settings → Connections → Edit Connection → Advanced → Tags) do not show up in the Admin → Settings → Models tag filter dropdown, even though the very same tags do appear on models in the New Chat model selector and correctly filter models there.
Root cause
Connection tags and model tags live in two different storage locations, and the Admin → Models page only reads one of them:
Where connection tags are stored. A tag added in Edit Connection → Advanced is saved into the per-connection entry of the persistent config —
openai.api_configs/ollama.api_configs(frontend:src/lib/components/AddConnectionModal.svelte,tags = normalizeTags(connection.config?.tags)). It is not written to themodeltable.Why the chat model selector shows them. When the runtime model list is built, both provider routers copy the connection tags onto every model served by that connection:
backend/open_webui/routers/openai.py(get_all_models_responses):tags = api_config.get('tags', [])→model['tags'] = tagsbackend/open_webui/routers/ollama.py(get_all_models):allowed_tags = api_config.get('tags', [])→m['tags'] = allowed_tagsand
GET /api/models(backend/open_webui/main.py) additionally merges them with DB meta tags:tags = normalize_model_tags(meta.get('tags')) + normalize_model_tags(model.get('tags')). That is why the chat selector works.Why the Admin → Models tag filter does not. The filter dropdown is fed by
GET /api/v1/models/base/tags(backend/open_webui/routers/models.py), which callsModels.get_all_tags(...)(backend/open_webui/models/models.py). That method extracts tags exclusively from themetaJSON column of themodeltable. Connection tags are stored in the config store, not in that table — so they can never appear in the dropdown.Filtering would also return nothing. Even if the dropdown listed a connection tag, selecting it calls
GET /api/v1/models/base?tag=...→Models.get_base_models(tag=...), which filters DB rows byModel.metatags. A connection tag matches no DB row, so the result would be an empty model list. Both the dropdown and the filtering path had to be fixed; fixing only the dropdown would have turned the bug into "tag visible, clicking it shows nothing".As a side effect of the same root cause, two case variants of the same tag stored in the DB (e.g.
Uncensoredvsuncensored, visible in the issue's screenshot as "Uncensored" appearing twice) were both listed in the dropdown, because the deduplication set compared names case-sensitively.Solution
Two minimal, targeted changes (single commit, rebased on
dev):1. Backend —
backend/open_webui/routers/models.pyget_connection_tags(): readsopenai.enable/openai.api_configs/ollama.enable/ollama.api_configsvia the existingConfig.get_many(...)pattern (same idiom already used byget_all_base_modelsinbackend/open_webui/utils/models.py) and collects the tag names of enabled connections only. Per-connectionenabledefaults toTrue, mirroring the routers._get_connection_tag_names(): normalizes each connection'stagslist with the already-existingnormalize_model_tags()(handles both[{name}]dicts and legacy plain strings) and skips non-dict entries defensively.GET /api/v1/models/base/tagsnow returnsDB meta tags ∪ connection tags, deduplicated case-insensitively (keeping the first name in sort order as the canonical casing), sorted case-insensitively. This fixes both the missing tags and the duplicateUncensoredentry from the issue's screenshot.2. Frontend —
src/lib/components/admin/Settings/Models.svelte/api/modelsalready merged into the model list (connection tags). This is done entirely with data the page already fetches — no extra requests, no provider calls from the tag-filter path.ModelListItemtype extended with the optionaltagsfield (string | { name }items are both handled, since provider/base endpoints and the aggregated endpoint use slightly different shapes).Why not another approach
Models.get_base_models(tag)connection-aware) would require resolving which models each connection serves — that means live provider fetches on every tag selection, or denormalizing connection→model mappings into the DB. The runtime list already carries the merged tags, so the frontend fallback is the smallest correct change.Testing
End-to-end verified against a locally running server (
uvicorn open_webui.main:app, fresh SQLite data dir, first user = admin):enable: truewith tagswin10,Uncensored; second connectionenable: falsewith taghidden-tag→GET /api/v1/models/base/tags["Uncensored","win10"]— enabled connection's tags present, disabled connection's tag excluded ✅uncensored(lowercase),Localalongside scenario 1 →GET /api/v1/models/base/tags["Local","Uncensored","win10"]— Ollama path works,uncensored/Uncensoredcollapse into a single entry ✅GET /api/v1/models/base,/api/v1/models/list, config update endpoints200 OK✅svelte-checkonModels.svelteruff checkon the modified Python fileVerify code formatting+Verify i18n stringssteps after the formatting commitsrc/app.cssdrift noted below)UI-level verification steps for reviewers: add a tag to an OpenAI-compatible connection (Admin → Connections → Advanced), open Admin → Models → Tags dropdown — the tag now appears; selecting it shows all models served by that connection. The tag previously appeared in the chat model selector only.
Changelog Entry
Description
/api/models) and therefore visible in the chat model selector, but were invisible to the Admin → Models tag filter because/api/v1/models/base/tagsand/api/v1/models/basederive tags solely from themodeltable, while connection tags live in the connection config (openai.api_configs/ollama.api_configs). The tag filter now includes connection tags and filtering by them returns the models served by that connection. Case-variant duplicates of the same tag no longer appear multiple times in the dropdown. Fixes feat: include connection tags in the Admin > Models tag filter #29190.Added
get_connection_tags()/_get_connection_tag_names()helpers in the models router collecting tag names from enabled provider connections.Changed
GET /api/v1/models/base/tagsnow returns the union of model-DB tags and connection tags, deduplicated case-insensitively.Deprecated
Removed
Fixed
src/lib/i18n/locales/pl-PL/translation.json(pre-existing formatting drift since i18n: complete Polish (pl-PL) translation #29184, caught by theFormat & Buildprettier pass).Security
Breaking Changes
Additional Information
Format & Buildcheck currently fails on a pre-existing formatting issue insrc/app.cssthat is already present ondevitself (npx prettier --stdin-filepath src/app.css --checkfails against the unmodifieddevtree). It is unrelated to this PR and left untouched here; every open PR will hit it untildevreceives a formatting pass.bug, reproduced and root-caused as described above).Screenshots or Videos
Contributor License Agreement