36 Commits

Author SHA1 Message Date
Classic298
52cfb02c72 perf: build debug log messages lazily so disabled debug logs cost nothing (#27834)
GLOBAL_LOG_LEVEL defaults to INFO, so every log.debug(...) in the backend is discarded, but the message is built first: 187 call sites interpolate their payload into an f-string before the logging call runs, so the work happens on every request and the result is thrown away. The worst one sits in process_chat_payload and stringifies the whole request body, full conversation history included, once per chat completion.

That one line with DEBUG disabled, CPython 3.12:

| conversation | payload | before   | after   |
| ------------ | ------- | -------- | ------- |
| 4 messages   | 1.2 kB  | 3.4 us   | 0.07 us |
| 20 messages  | 17 kB   | 24.8 us  | 0.07 us |
| 60 messages  | 123 kB  | 216.6 us | 0.07 us |

The lazy form log.debug('form_data: %s', form_data) hands the payload to record.getMessage(), which the InterceptHandler only reaches once a record has passed the level check. With DEBUG enabled the emitted lines are byte-identical, f'{x=}' sites included: those map to %r. MistralLoader._debug_log callers get the same treatment, since that wrapper already forwards *args.
2026-07-31 19:09:01 -05:00
Timothy Jaeryang Baek
bb0f898b43 refac 2026-07-31 17:41:14 -04:00
Timothy Jaeryang Baek
48cc9d388e refac 2026-07-23 03:39:56 -04:00
Classic298
f8c0d2fdd6 fix: don't mutate caller's payload when resolving a pipe base model (#26906)
generate_function_chat_completion rewrote form_data['model'] to the base
model id in place. Because that dict is the same object process_chat_response
later re-submits for the post-tool-call continuation, the continuation was
access-checked against the base model instead of the user-facing preset.
For a public preset over a private/unregistered pipe base, a non-admin's
first message succeeded but the continuation after a native tool call was
denied and silently swallowed, aborting the response (admins skip the
user-only check, so they were unaffected).

Operate on a shallow copy of form_data, mirroring the openai/ollama routers
which already substitute the base model on a copy. The continuation now
re-checks the preset the user actually has access to.


Claude-Session: https://claude.ai/code/session_018toPfJW1hMXAhokGaL43Ep

Co-authored-by: Claude <noreply@anthropic.com>
2026-07-10 13:33:24 -05:00
Timothy Jaeryang Baek
8e46450acd refac 2026-07-09 17:28:34 -05:00
Algorithm5838
5d104abd08 fix: emit [DONE] for AsyncGenerator pipe returns (#24763) 2026-05-19 22:07:56 +04:00
Timothy Jaeryang Baek
6d0295588e refac: modernize type annotations (PEP 604 / PEP 585) 2026-05-12 17:10:15 +09:00
Timothy Jaeryang Baek
c1202a2327 refac 2026-05-09 04:17:58 +09:00
Timothy Jaeryang Baek
a27916d1db refac 2026-04-21 14:31:04 +09:00
Timothy Jaeryang Baek
8acce144f9 refac 2026-04-17 14:15:36 +09:00
Timothy Jaeryang Baek
27169124f2 refac: async db 2026-04-12 14:22:11 -05:00
Timothy Jaeryang Baek
a775fc9b50 refac 2026-04-08 13:34:23 -07:00
Timothy Jaeryang Baek
de3317e26b refac 2026-03-17 17:58:01 -05:00
Timothy Jaeryang Baek
f376d4f378 chore: format 2026-02-11 16:24:11 -06:00
Timothy Jaeryang Baek
d193c143a5 refac 2026-02-08 21:18:38 -06: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
b77848244b refac: user valves 2025-09-26 17:49:42 -05:00
Timothy Jaeryang Baek
e4c4ba0979 fix: oauth token 2025-09-19 00:10:48 -05:00
Timothy Jaeryang Baek
f0856bcb46 refac 2025-09-16 16:15:52 -05:00
Timothy Jaeryang Baek
71f99228ef refac 2025-09-16 15:49:43 -05:00
Timothy Jaeryang Baek
8edfd29102 refac 2025-09-16 15:26:08 -05:00
Timothy Jaeryang Baek
e66e0526ed refac/enh: function valves validation 2025-09-16 12:00:59 -05:00
Timothy Jaeryang Baek
6c0a5fa91c refac 2025-09-11 21:56:59 +04:00
Timothy Jaeryang Baek
b5bb6ae177 refac 2025-09-08 18:50:23 +04:00
Timothy Jaeryang Baek
0e46f8091f fix: __tools__ param issue 2025-08-25 14:29:05 +04:00
Timothy Jaeryang Baek
094a16ab49 refac 2025-08-21 03:38:26 +04:00
Timothy Jaeryang Baek
bbafeca495 refac: reserved __user__ param format 2025-06-04 15:53:07 +04:00
Timothy Jaeryang Baek
d43bbcae28 refac/fix: open webui params handling 2025-05-29 12:57:58 +04: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
c062353a3f refac 2025-03-26 01:17:10 -07:00
Olof Larsson
ab1f2ae914 feat/async-pipes 2025-02-21 08:24:48 +01:00
Timothy Jaeryang Baek
7ba717d171 refac: system prompt template 2025-02-05 14:35:18 -08:00
Timothy Jaeryang Baek
ddfed87b15 fix 2024-12-15 22:44:47 -08:00
Timothy Jaeryang Baek
6efca03a8f refac 2024-12-13 22:51:43 -08:00
Timothy Jaeryang Baek
4311bb7b99 wip 2024-12-12 20:22:17 -08:00