fix: skill search does not find a skill by its translated name (#32174)

Searching Workspace > Skills only matched a skill's original name, description and id, so typing the German name given to a skill in its editor found nothing, even with the interface in German. The search now also matches the names and descriptions translated in the skill editor, in any language, so both the translated and the original name find the skill, as the Translations page in the docs says.

Fixes #32018
This commit is contained in:
Classic298 2026-10-10 17:48:08 +02:00 • committed by GitHub
parent cdd96e5b57
commit 1579af28a0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -8,9 +8,10 @@ from open_webui.models.access_grants import AccessGrant, AccessGrantModel, Acces
from open_webui.models.groups import Groups
from open_webui.models.skill_history import SkillHistories, SkillHistory
from open_webui.models.users import User, UserModel, UserResponse, Users
from open_webui.utils.misc import json_text_variants
from open_webui.utils.skill_files import SkillFile, SkillFileOperation, apply_operations, validate_files
from pydantic import BaseModel, ConfigDict, Field
from sqlalchemy import JSON, BigInteger, Boolean, Column, String, Text, delete, func, or_, select, update
from sqlalchemy import JSON, BigInteger, Boolean, Column, String, Text, cast, delete, func, or_, select, update
from sqlalchemy.ext.asyncio import AsyncSession
log = logging.getLogger(__name__)
@ -301,6 +302,10 @@ class SkillsTable:
Skill.id.ilike(f'%{query_key}%'),
User.name.ilike(f'%{query_key}%'),
User.email.ilike(f'%{query_key}%'),
*(
cast(Skill.meta, String).icontains(variant, autoescape=True)
for variant in json_text_variants(query_key)
),
)
)