Skip to content

Commit e992669

Browse files
authored
fix: add username search support to workspace and admin pages (open-webui#20780)
This fix restores and extends the username/email search functionality across workspace pages that was originally added in PR open-webui#14002. The issue was that: 1. The backend search functions for Models and Knowledge only searched `User.name` and `User.email`, but not `User.username` 2. The Functions admin page lacked user search entirely Changes made: Added User.username to backend search conditions for Models and Knowledge pages Added complete user search (name, email, username) to the Functions admin page client-side filter
1 parent 5cfb7a0 commit e992669

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

backend/open_webui/models/knowledge.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,9 @@ def search_knowledge_bases(
229229
or_(
230230
Knowledge.name.ilike(f"%{query_key}%"),
231231
Knowledge.description.ilike(f"%{query_key}%"),
232+
User.name.ilike(f"%{query_key}%"),
233+
User.email.ilike(f"%{query_key}%"),
234+
User.username.ilike(f"%{query_key}%"),
232235
)
233236
)
234237

backend/open_webui/models/models.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,9 @@ def search_models(
294294
or_(
295295
Model.name.ilike(f"%{query_key}%"),
296296
Model.base_model_id.ilike(f"%{query_key}%"),
297+
User.name.ilike(f"%{query_key}%"),
298+
User.email.ilike(f"%{query_key}%"),
299+
User.username.ilike(f"%{query_key}%"),
297300
)
298301
)
299302

src/lib/components/admin/Functions.svelte

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,10 @@
8686
(selectedType !== '' ? f.type === selectedType : true) &&
8787
(query === '' ||
8888
f.name.toLowerCase().includes(query.toLowerCase()) ||
89-
f.id.toLowerCase().includes(query.toLowerCase())) &&
89+
f.id.toLowerCase().includes(query.toLowerCase()) ||
90+
(f.user?.name || '').toLowerCase().includes(query.toLowerCase()) ||
91+
(f.user?.email || '').toLowerCase().includes(query.toLowerCase()) ||
92+
(f.user?.username || '').toLowerCase().includes(query.toLowerCase())) &&
9093
(viewOption === '' ||
9194
(viewOption === 'created' && f.user_id === $user?.id) ||
9295
(viewOption === 'shared' && f.user_id !== $user?.id))

0 commit comments

Comments
 (0)