From 516e60966d32c98e45802cfa5ee562e4692f2afa Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Sat, 5 Dec 2026 07:06:03 +0400 Subject: [PATCH] refac --- backend/open_webui/models/tasks.py | 3 + backend/open_webui/routers/folders.py | 7 +- backend/open_webui/routers/tasks.py | 3 + src/lib/apis/folders/index.ts | 10 +- src/lib/apis/tasks/index.ts | 2 + .../chat/Placeholder/FolderAutomations.svelte | 13 +- .../chat/Placeholder/FolderKnowledge.svelte | 13 +- .../chat/Placeholder/FolderNotes.svelte | 8 + .../chat/Placeholder/FolderOverview.svelte | 184 +++- .../chat/Placeholder/FolderPlaceholder.svelte | 221 ++-- .../chat/Placeholder/FolderTags.svelte | 12 +- src/lib/components/tasks/Task.svelte | 4 +- src/lib/components/tasks/TaskBoard.svelte | 381 +++++-- src/lib/components/tasks/TaskGroupIcon.svelte | 4 + src/lib/components/tasks/TaskList.svelte | 15 +- src/lib/components/tasks/Tasks.svelte | 947 +++++++++++++----- src/lib/components/tasks/groups.ts | 28 +- src/lib/i18n/locales/ar-BH/translation.json | 5 + src/lib/i18n/locales/ar/translation.json | 5 + src/lib/i18n/locales/az-AZ/translation.json | 5 + src/lib/i18n/locales/bg-BG/translation.json | 5 + src/lib/i18n/locales/bn-BD/translation.json | 5 + src/lib/i18n/locales/bo-TB/translation.json | 5 + src/lib/i18n/locales/bs-BA/translation.json | 5 + src/lib/i18n/locales/ca-ES/translation.json | 5 + src/lib/i18n/locales/ceb-PH/translation.json | 5 + src/lib/i18n/locales/cs-CZ/translation.json | 5 + src/lib/i18n/locales/da-DK/translation.json | 5 + src/lib/i18n/locales/de-DE/translation.json | 5 + src/lib/i18n/locales/dg-DG/translation.json | 5 + src/lib/i18n/locales/el-GR/translation.json | 5 + src/lib/i18n/locales/en-GB/translation.json | 5 + src/lib/i18n/locales/en-US/translation.json | 5 + src/lib/i18n/locales/es-ES/translation.json | 5 + src/lib/i18n/locales/et-EE/translation.json | 5 + src/lib/i18n/locales/eu-ES/translation.json | 5 + src/lib/i18n/locales/fa-IR/translation.json | 5 + src/lib/i18n/locales/fi-FI/translation.json | 5 + src/lib/i18n/locales/fil-PH/translation.json | 5 + src/lib/i18n/locales/fo-FO/translation.json | 5 + src/lib/i18n/locales/fr-CA/translation.json | 5 + src/lib/i18n/locales/fr-FR/translation.json | 5 + src/lib/i18n/locales/gl-ES/translation.json | 5 + src/lib/i18n/locales/he-IL/translation.json | 5 + src/lib/i18n/locales/hi-IN/translation.json | 5 + src/lib/i18n/locales/hr-HR/translation.json | 5 + src/lib/i18n/locales/hu-HU/translation.json | 5 + src/lib/i18n/locales/id-ID/translation.json | 5 + src/lib/i18n/locales/ie-GA/translation.json | 5 + src/lib/i18n/locales/it-IT/translation.json | 5 + src/lib/i18n/locales/ja-JP/translation.json | 5 + src/lib/i18n/locales/ka-GE/translation.json | 5 + src/lib/i18n/locales/kab-DZ/translation.json | 5 + src/lib/i18n/locales/ko-KR/translation.json | 5 + src/lib/i18n/locales/lt-LT/translation.json | 5 + src/lib/i18n/locales/lv-LV/translation.json | 5 + src/lib/i18n/locales/ms-MY/translation.json | 5 + src/lib/i18n/locales/nb-NO/translation.json | 5 + src/lib/i18n/locales/nl-NL/translation.json | 5 + src/lib/i18n/locales/pa-IN/translation.json | 5 + src/lib/i18n/locales/pl-PL/translation.json | 5 + src/lib/i18n/locales/pt-BR/translation.json | 5 + src/lib/i18n/locales/pt-PT/translation.json | 5 + src/lib/i18n/locales/ro-RO/translation.json | 5 + src/lib/i18n/locales/ru-RU/translation.json | 5 + src/lib/i18n/locales/sk-SK/translation.json | 5 + src/lib/i18n/locales/sl-SI/translation.json | 5 + src/lib/i18n/locales/sr-RS/translation.json | 5 + src/lib/i18n/locales/sv-SE/translation.json | 5 + src/lib/i18n/locales/ta-IN/translation.json | 5 + src/lib/i18n/locales/th-TH/translation.json | 5 + src/lib/i18n/locales/tk-TM/translation.json | 5 + src/lib/i18n/locales/tr-TR/translation.json | 5 + src/lib/i18n/locales/ug-CN/translation.json | 5 + src/lib/i18n/locales/uk-UA/translation.json | 5 + src/lib/i18n/locales/ur-PK/translation.json | 5 + .../i18n/locales/uz-Cyrl-UZ/translation.json | 5 + .../i18n/locales/uz-Latn-UZ/translation.json | 5 + src/lib/i18n/locales/vi-VN/translation.json | 5 + src/lib/i18n/locales/zh-CN/translation.json | 5 + src/lib/i18n/locales/zh-TW/translation.json | 5 + 81 files changed, 1726 insertions(+), 449 deletions(-) diff --git a/backend/open_webui/models/tasks.py b/backend/open_webui/models/tasks.py index c00e2f6b35..bb0afee584 100644 --- a/backend/open_webui/models/tasks.py +++ b/backend/open_webui/models/tasks.py @@ -400,6 +400,7 @@ class TasksTable: assignee_ids: Optional[list[str]] = None, folder_ids: Optional[list[str]] = None, tag_ids: Optional[list[str]] = None, + updated_at_gte: Optional[int] = None, search: Optional[str] = None, sort_by: str = 'updated_at', sort_dir: str = 'desc', @@ -418,6 +419,8 @@ class TasksTable: conditions.append(Task.folder_id.in_(folder_ids)) if tag_ids: conditions.append(resource_tag_filter('task', Task.id, tag_ids)) + if updated_at_gte is not None: + conditions.append(Task.updated_at >= updated_at_gte) if assignee_id: conditions.append(Task.assignee_id == assignee_id) if creator_id: diff --git a/backend/open_webui/routers/folders.py b/backend/open_webui/routers/folders.py index f4ef253f97..868f35f0c1 100644 --- a/backend/open_webui/routers/folders.py +++ b/backend/open_webui/routers/folders.py @@ -963,6 +963,7 @@ async def get_folder_notes( request: Request, id: str, page: int = Query(1, ge=1), + query: Optional[str] = Query(None, max_length=256), user=Depends(get_verified_user), db: AsyncSession = Depends(get_async_session), ): @@ -970,7 +971,11 @@ async def get_folder_notes( folder = await check_folder_read_access(request, id, user, db) await check_notes_access(user, db=db) result = await Notes.search_notes( - user.id, {'folder_id': id}, skip=(page - 1) * FOLDER_PAGE_SIZE, limit=FOLDER_PAGE_SIZE, db=db + user.id, + {'folder_id': id, **({'query': query} if query else {})}, + skip=(page - 1) * FOLDER_PAGE_SIZE, + limit=FOLDER_PAGE_SIZE, + db=db, ) has_write = ( user.role == 'admin' or folder.user_id == user.id or await _has_folder_access(user.id, folder, 'write', db) diff --git a/backend/open_webui/routers/tasks.py b/backend/open_webui/routers/tasks.py index b08a93f319..25393c1546 100644 --- a/backend/open_webui/routers/tasks.py +++ b/backend/open_webui/routers/tasks.py @@ -196,6 +196,8 @@ async def get_tasks( folder_ids: list[str] = Query(default=[], alias='folder'), # 'none' keeps untagged tasks. tag_ids: list[str] = Query(default=[], alias='tag'), + # Seconds; keeps tasks changed since then, as the folder chat list's Updated filter does. + updated_at_gte: Optional[int] = None, sort_by: str = 'updated_at', sort_dir: Literal['asc', 'desc'] = 'desc', page: int = Query(default=1, ge=1), @@ -216,6 +218,7 @@ async def get_tasks( assignee_ids=assignee_ids, folder_ids=folder_ids, tag_ids=tag_ids, + updated_at_gte=updated_at_gte, search=search, sort_by=sort_by, sort_dir=sort_dir, diff --git a/src/lib/apis/folders/index.ts b/src/lib/apis/folders/index.ts index 46696943c0..a6bb232384 100644 --- a/src/lib/apis/folders/index.ts +++ b/src/lib/apis/folders/index.ts @@ -449,11 +449,17 @@ export const getFolderUsers = async (token: string, id: string, signal?: AbortSi return res; }; -export const getFolderNotes = async (token: string, id: string, page: number = 1) => { +export const getFolderNotes = async ( + token: string, + id: string, + page: number = 1, + query: string = '' +) => { let error = null; + const params = new URLSearchParams({ page: String(page), ...(query ? { query } : {}) }); const res = await fetch( - `${WEBUI_API_BASE_URL}/folders/${encodeURIComponent(id)}/notes?page=${page}`, + `${WEBUI_API_BASE_URL}/folders/${encodeURIComponent(id)}/notes?${params}`, { method: 'GET', headers: { diff --git a/src/lib/apis/tasks/index.ts b/src/lib/apis/tasks/index.ts index b1c7cce335..7a397a59b8 100644 --- a/src/lib/apis/tasks/index.ts +++ b/src/lib/apis/tasks/index.ts @@ -59,6 +59,8 @@ export type TaskQuery = { folder?: string[]; // Tag ids; 'none' keeps untagged tasks. tag?: string[]; + // Seconds; tasks changed since then. + updated_at_gte?: number; sort_by?: string; sort_dir?: 'asc' | 'desc'; page?: number; diff --git a/src/lib/components/chat/Placeholder/FolderAutomations.svelte b/src/lib/components/chat/Placeholder/FolderAutomations.svelte index e0f38f042d..fd5395e6f6 100644 --- a/src/lib/components/chat/Placeholder/FolderAutomations.svelte +++ b/src/lib/components/chat/Placeholder/FolderAutomations.svelte @@ -21,6 +21,11 @@ export let automations: FolderAutomation[] = []; export let loading = false; export let canCreate = false; + // Filters the loaded automations by name. + export let query = ''; + $: shown = automations.filter( + (item) => !query.trim() || item.name.toLowerCase().includes(query.trim().toLowerCase()) + ); export let onReload: () => Promise; let showModal = false; @@ -83,9 +88,15 @@ > {/if} +{:else if query.trim() && !shown.length} +
+ {$i18n.t('No results found')} +
{:else}