mirror of
https://github.com/open-webui/open-webui.git
synced 2026-09-26 09:21:23 -04:00
fix: return no chats when a folder search term matches no folder (#30273)
This commit is contained in:
@@ -1988,10 +1988,8 @@ class ChatTable:
|
||||
]
|
||||
|
||||
# Extract folder names
|
||||
folders = await Folders.search_folders_by_names(
|
||||
user_id,
|
||||
[word.replace('folder:', '') for word in search_text_words if word.startswith('folder:')],
|
||||
)
|
||||
folder_names = [word.replace('folder:', '') for word in search_text_words if word.startswith('folder:')]
|
||||
folders = await Folders.search_folders_by_names(user_id, folder_names)
|
||||
folder_ids = [folder.id for folder in folders]
|
||||
|
||||
is_pinned = None
|
||||
@@ -2035,7 +2033,7 @@ class ChatTable:
|
||||
else:
|
||||
stmt = stmt.filter(Chat.share_id.is_(None))
|
||||
|
||||
if folder_ids:
|
||||
if folder_names:
|
||||
stmt = stmt.filter(Chat.folder_id.in_(folder_ids))
|
||||
|
||||
# Check if the database dialect is either 'sqlite' or 'postgresql'
|
||||
|
||||
Reference in New Issue
Block a user