From 937e38d8629b89ca9d18d5478919400f3ea11899 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Thu, 23 Nov 2023 14:33:08 -0800 Subject: [PATCH] feat: basic chat search support --- src/lib/components/layout/Sidebar.svelte | 74 +++++++++++++++++++++++- 1 file changed, 71 insertions(+), 3 deletions(-) diff --git a/src/lib/components/layout/Sidebar.svelte b/src/lib/components/layout/Sidebar.svelte index a14855dc..73b6e8b3 100644 --- a/src/lib/components/layout/Sidebar.svelte +++ b/src/lib/components/layout/Sidebar.svelte @@ -15,6 +15,7 @@ let importFiles; let title: string = 'Ollama Web UI'; + let search = ''; let chatTitleEditIdx = null; let chatTitle = ''; @@ -82,7 +83,7 @@
+
+ +
+ +
+ +
+
+
+ + + +
+ + +
-
- {#each $chats as chat, i} +
+ {#each $chats.filter((chat) => { + if (search === '') { + return true; + } else { + let title = chat.title.toLowerCase(); + + if (title.includes(search)) { + return true; + } else { + return false; + } + } + }) as chat, i}