mirror of
https://github.com/open-webui/open-webui.git
synced 2026-11-27 23:59:20 -05:00
* perf(channels): batch user lookup in model_response_handler thread history The thread-history builder in model_response_handler called Users.get_user_by_id once per thread message (deduped via an intra-loop dict), producing N individual SELECTs for a thread of N unique authors. Replace with a single Users.get_users_by_user_ids call that returns all authors in one WHERE id IN (...) query, matching the batch pattern already used elsewhere in this file (lines 739, 804, 1320). Behavior is preserved: deleted users still resolve to None and fall through to the existing 'Unknown' fallback via .get(). * refac(channels): rename loop vars to full words per review Address reviewer feedback to use descriptive names `message` and `user` instead of single-letter `m` and `u` in the batch user-lookup comprehensions. --------- Co-authored-by: Claude <noreply@anthropic.com>