Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/lib/components/layout/Sidebar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
channels,
socket,
config,
isApp
isApp,
knowledgeFiltered
} from '$lib/stores';
import { onMount, getContext, tick, onDestroy } from 'svelte';

Expand Down Expand Up @@ -655,7 +656,10 @@
<div class="px-1.5 flex justify-center text-gray-800 dark:text-gray-200">
<a
class="grow flex items-center space-x-3 rounded-lg px-2 py-[7px] hover:bg-gray-100 dark:hover:bg-gray-900 transition"
href="/workspace/knowledge"
href={$knowledgeFiltered.length === 0
? "/workspace/knowledge/create"
: "/workspace/knowledge"}

on:click={() => {
selectedChatId = null;
chatId.set('');
Expand Down
4 changes: 3 additions & 1 deletion src/lib/components/workspace/Knowledge.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import { onMount, getContext } from 'svelte';
const i18n = getContext('i18n');

import { WEBUI_NAME, knowledge } from '$lib/stores';
import { WEBUI_NAME, knowledge, knowledgeFiltered } from '$lib/stores';
import {
getKnowledgeBases,
deleteKnowledgeById,
Expand Down Expand Up @@ -52,6 +52,8 @@
: knowledgeBases;
}

$: knowledgeFiltered.set(filteredItems);

const deleteHandler = async (item) => {
const res = await deleteKnowledgeById(localStorage.token, item.id).catch((e) => {
toast.error(`${e}`);
Expand Down
1 change: 1 addition & 0 deletions src/lib/stores/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export const channels = writable([]);
export const chats = writable(null);
export const pinnedChats = writable([]);
export const tags = writable([]);
export const knowledgeFiltered = writable([]);

export const models: Writable<Model[]> = writable([]);

Expand Down
Loading