open-webui/backend/open_webui
Classic298 1a3e5ef4c1
perf(prompts): make /tags fetch only the tags column with SQL access filter (#24287)
Non-admin GET /api/v1/prompts/tags went through get_prompts_by_user_id,
which loaded every active prompt with its full content/data/meta plus
owner records and all access grants, then ran one has_access query per
prompt that wasn't owned by the caller - all so the endpoint could
collapse the result to a sorted tag list. With 600 prompts this took
several seconds while the admin path (a single SELECT) returned in <1s.

Add Prompts.get_tags_by_user_id which selects only the tags column and
applies the same EXISTS-based access filter used by /list. Also tighten
the admin get_tags to project just the tags column instead of full rows.
The endpoint is now one DB query (plus one for groups), no row hydration,
no N+1.

Co-authored-by: Claude <noreply@anthropic.com>
2026-05-09 05:20:13 +09:00
..
data refac: mv backend files to /open_webui dir 2024-09-04 16:54:48 +02:00
internal refac 2026-05-09 02:38:08 +09:00
migrations refac 2026-05-09 04:39:44 +09:00
models perf(prompts): make /tags fetch only the tags column with SQL access filter (#24287) 2026-05-09 05:20:13 +09:00
retrieval refac 2026-05-09 04:49:18 +09:00
routers perf(prompts): make /tags fetch only the tags column with SQL access filter (#24287) 2026-05-09 05:20:13 +09:00
socket refac 2026-05-09 03:15:53 +09:00
static chore: format 2026-04-19 22:45:54 +09:00
storage refac 2026-04-12 19:08:30 -05:00
test refac 2026-03-17 17:58:01 -05:00
tools refac 2026-05-09 03:15:53 +09:00
utils refac 2026-05-09 05:14:55 +09:00
__init__.py refac 2026-05-09 02:38:08 +09:00
alembic.ini fix: Alembic CLI commands from failing 2025-08-15 04:17:47 -04:00
config.py refac 2026-05-09 05:14:55 +09:00
constants.py chore: format 2026-04-14 17:27:31 -05:00
env.py refac 2026-04-24 16:23:28 +09:00
functions.py refac 2026-05-09 04:17:58 +09:00
main.py refac 2026-05-09 05:14:55 +09:00
tasks.py refac 2026-03-17 17:58:01 -05:00