Commit Graph

51 Commits

Author SHA1 Message Date
Timothy Jaeryang Baek
3ceaa107ab chore: format 2026-03-07 20:14:32 -06:00
Timothy Jaeryang Baek
e6b00a8905 refac 2026-03-07 17:03:23 -06:00
Timothy Jaeryang Baek
03c6caac1f refac 2026-03-07 17:02:02 -06:00
Timothy Jaeryang Baek
29160741a3 refac 2026-03-07 16:59:06 -06:00
Timothy Jaeryang Baek
6d9996e599 refac 2026-03-06 20:12:37 -06:00
Classic298
d93cb3658d perf(models): batch-fetch function valves to eliminate N+1 queries (#22301)
* perf(models): batch-fetch function valves to eliminate N+1 queries

get_action_priority() called Functions.get_function_valves_by_id()
individually for every action on every model — an N+1 query pattern
that issued one DB round-trip per (action x model) pair.

Add Functions.get_function_valves_by_ids() that fetches all valves in
a single WHERE IN query, then look up each action's valves from the
pre-fetched dict inside get_action_priority().

No functional change — same priority resolution, same sort order.

* Update models.py

* Update models.py
2026-03-06 15:56:01 -06:00
Classic298
5c403fb829 fix: resolve valve priority for actions and filters via class instantiation (#21841)
fix: resolve valve priority for actions and filters via class instantiation

The priority sorting for action buttons and filter execution order
read valve data directly from the database JSON column using
Functions.get_function_valves_by_id(). This returns only explicitly
saved values — when a developer defines priority as a class default
in their Valves definition (e.g. priority: int = 5) without ever
opening the Valves UI to persist it, the database column remains
empty. Every function then resolves to priority 0, and the preceding
set() deduplication produces non-deterministic iteration order that
the stable sort preserves — resulting in random button placement on
every page load.

The fix instantiates the Valves class with database values as keyword
overrides: Valves(**(db_valves or {})). This merges any persisted
overrides onto the code-defined defaults, matching the pattern already
established in the action execution handler, filter processing
pipeline, and tool module initialization. A secondary sort key (the
function ID) ensures fully deterministic ordering even when multiple
functions share the same priority value.

Affected locations:
- get_action_priority in utils/models.py (action button ordering)
- get_priority in utils/filter.py (filter execution ordering)
2026-02-24 15:58:23 -06:00
Classic298
1808d7fd2f feat: sort action buttons by valve priority (#21790)
feat: sort action buttons by valve priority

Action buttons under assistant messages were rendered in
non-deterministic order due to set() deduplication. They now
respect the priority field from function Valves, sorted ascending
(lower value = appears first, default 0), matching the existing
filter priority mechanism.
2026-02-23 13:52:12 -06:00
Timothy Jaeryang Baek
95bde946ba refac 2026-02-23 03:22:19 -06:00
Timothy Jaeryang Baek
c341f97cfe feat: default model metadata & params 2026-02-22 16:54:34 -06:00
Timothy Jaeryang Baek
34cd3d79e8 refac 2026-02-16 23:52:32 -06:00
Timothy Jaeryang Baek
15b893e651 refac 2026-02-16 15:32:28 -06:00
Classic298
656de56a3e fix: gracefully handle missing functions when loading models (#21476)
When models reference functions (via filterIds/actionIds) that no longer
exist in the database, the /api/models endpoint crashes with a 500 error,
preventing the UI from loading chats entirely. This can happen after
upgrades when built-in functions are removed or when user-created
functions are deleted while still referenced by models.

Instead of raising an exception, log at INFO level and skip the missing
function so the rest of the models load successfully.

Fixes #21464

https://claude.ai/code/session_015JRM7m2bNeZPBBmV2Gv4Mj

Co-authored-by: Claude <noreply@anthropic.com>
2026-02-16 13:02:54 -06:00
Timothy Jaeryang Baek
3ae4c618e1 refac 2026-02-15 19:07:53 -06:00
Timothy Jaeryang Baek
4a0d893995 refac 2026-02-15 19:03:08 -06:00
Timothy Jaeryang Baek
589c4e64c1 refac 2026-02-13 13:56:29 -06:00
Timothy Jaeryang Baek
f376d4f378 chore: format 2026-02-11 16:24:11 -06:00
Timothy Jaeryang Baek
3e56261c5e refac 2026-02-11 02:06:43 -06:00
Timothy Jaeryang Baek
f7406ff576 refac 2026-02-09 13:28:14 -06:00
Timothy Jaeryang Baek
b55a46ae99 refac 2026-01-05 03:46:46 +04:00
Timothy Jaeryang Baek
2453b75ff0 refac 2025-12-29 01:31:27 +04:00
Timothy Jaeryang Baek
0dd2cfe1f2 enh: models endpoint optimization
Co-Authored-By: Classic298 <27028174+Classic298@users.noreply.github.com>

#20010
2025-12-21 15:43:02 +04:00
Classic298
823b9a6dd9 chore/perf: Remove old SRC level log env vars with no impact (#20045)
* Update openai.py

* Update env.py

* Merge pull request open-webui#19030 from open-webui/dev (#119)

Co-authored-by: Tim Baek <tim@openwebui.com>
Co-authored-by: Claude <noreply@anthropic.com>

---------

Co-authored-by: Tim Baek <tim@openwebui.com>
Co-authored-by: Claude <noreply@anthropic.com>
2025-12-20 08:16:14 -05:00
Timothy Jaeryang Baek
39f7575b64 refac: show connection type for custom models 2025-12-02 06:19:48 -05:00
Timothy Jaeryang Baek
b5e5617a41 enh: redis dict for internal models state
Co-Authored-By: cw.a <57549718+acwoo97@users.noreply.github.com>
2025-11-27 01:33:52 -05:00
Adam Skalicky
dc6e1fe6bd Fetched user_group_ids prior to looping through models with has_access to reduce DB hits for group membership 2025-11-10 16:48:56 -08:00
Timothy Jaeryang Baek
6593b7ccc8 refac 2025-10-21 18:11:30 -04:00
Timothy Jaeryang Baek
b77848244b refac: user valves 2025-09-26 17:49:42 -05:00
Timothy Jaeryang Baek
9738ddfd99 refac 2025-09-16 23:19:21 -05:00
Timothy Jaeryang Baek
05a9b72670 refac/fix: base model cache 2025-07-07 11:30:27 +04:00
Timothy Jaeryang Baek
8a334decf6 refac: ENABLE_MODEL_LIST_CACHE -> ENABLE_BASE_MODELS_CACHE 2025-06-30 13:27:07 +04:00
Timothy Jaeryang Baek
962e078a9a refac 2025-06-28 19:15:52 +04:00
Timothy Jaeryang Baek
551597b9cc chore: format 2025-05-29 02:36:33 +04:00
toriset
9eccce2444 Added proper type hints to new functions
Forgot about that...
2025-05-27 15:44:20 +03:00
toriset
27de981246 Parallelize base model fetching 2025-05-27 15:35:16 +03:00
Gunwoo Hur
14c3d0c2d1 Prevent duplicate function module loads with caching helper and refactor 2025-05-27 18:08:58 +09:00
Timothy Jaeryang Baek
74ace200fe fix/refac: functions multi-replica issue 2025-05-20 20:20:27 +04:00
Timothy Jaeryang Baek
08e4c163ea feat: local/external connections 2025-05-17 01:47:48 +04:00
Timothy Jaeryang Baek
ecae944fd0 refac 2025-05-16 23:59:24 +04:00
Timothy Jaeryang Baek
b61efcf54a feat: toggle filter 2025-05-16 22:59:02 +04:00
Yak!
b5cfa2b992 fix: Multiple actions in an action module do not work as intended. 2025-05-01 16:41:06 +09:00
Timothy Jaeryang Baek
daabc188e8 fix: model list hide issue 2025-04-12 18:34:10 -07:00
Timothy Jaeryang Baek
c309412980 enh: connection tags 2025-03-11 20:37:30 +00:00
Timothy Jaeryang Baek
d8bc3098db Merge pull request #9918 from df-cgdm/main
feat: Add  X-OpenWebUI when forwarding to ollama servers
2025-02-24 11:55:04 -08:00
i-infra
5e3742f899 and one last edit 2025-02-15 19:42:58 -05:00
Didier FOURNOUT
06062568c7 black formatting 2025-02-13 16:12:46 +00:00
Didier FOURNOUT
6d62e71c34 Add x-Open-Webui headers for ollama + more for openai 2025-02-13 15:29:26 +00:00
Timothy Jaeryang Baek
556c75e876 refac 2024-12-21 09:59:12 -07:00
Timothy Jaeryang Baek
ddfed87b15 fix 2024-12-15 22:44:47 -08:00
Timothy Jaeryang Baek
1197c640c4 refac 2024-12-12 22:28:42 -08:00