mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 10:17:00 +00:00
enh: filter by untagged chat
This commit is contained in:
parent
86999157de
commit
7476bcaa2b
@ -480,7 +480,18 @@ class ChatTable:
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Check if there are any tags to filter, it should have all the tags
|
# Check if there are any tags to filter, it should have all the tags
|
||||||
if tag_ids:
|
if "none" in tag_ids:
|
||||||
|
query = query.filter(
|
||||||
|
text(
|
||||||
|
"""
|
||||||
|
NOT EXISTS (
|
||||||
|
SELECT 1
|
||||||
|
FROM json_each(Chat.meta, '$.tags') AS tag
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
)
|
||||||
|
elif tag_ids:
|
||||||
query = query.filter(
|
query = query.filter(
|
||||||
and_(
|
and_(
|
||||||
*[
|
*[
|
||||||
@ -518,7 +529,18 @@ class ChatTable:
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Check if there are any tags to filter, it should have all the tags
|
# Check if there are any tags to filter, it should have all the tags
|
||||||
if tag_ids:
|
if "none" in tag_ids:
|
||||||
|
query = query.filter(
|
||||||
|
text(
|
||||||
|
"""
|
||||||
|
NOT EXISTS (
|
||||||
|
SELECT 1
|
||||||
|
FROM json_array_elements_text(Chat.meta->'tags') AS tag
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
)
|
||||||
|
elif tag_ids:
|
||||||
query = query.filter(
|
query = query.filter(
|
||||||
and_(
|
and_(
|
||||||
*[
|
*[
|
||||||
|
@ -197,6 +197,7 @@
|
|||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
searchDebounceTimeout = setTimeout(async () => {
|
searchDebounceTimeout = setTimeout(async () => {
|
||||||
|
allChatsLoaded = false;
|
||||||
currentChatPage.set(1);
|
currentChatPage.set(1);
|
||||||
await chats.set(await getChatListBySearchText(localStorage.token, search));
|
await chats.set(await getChatListBySearchText(localStorage.token, search));
|
||||||
|
|
||||||
|
@ -30,7 +30,13 @@
|
|||||||
|
|
||||||
let filteredTags = [];
|
let filteredTags = [];
|
||||||
$: filteredTags = lastWord.startsWith('tag:')
|
$: filteredTags = lastWord.startsWith('tag:')
|
||||||
? $tags.filter((tag) => {
|
? [
|
||||||
|
...$tags,
|
||||||
|
{
|
||||||
|
id: 'none',
|
||||||
|
name: $i18n.t('Untagged')
|
||||||
|
}
|
||||||
|
].filter((tag) => {
|
||||||
const tagName = lastWord.slice(4);
|
const tagName = lastWord.slice(4);
|
||||||
if (tagName) {
|
if (tagName) {
|
||||||
const tagId = tagName.replace(' ', '_').toLowerCase();
|
const tagId = tagName.replace(' ', '_').toLowerCase();
|
||||||
|
Loading…
Reference in New Issue
Block a user