diff --git a/src/lib/components/admin/Settings.svelte b/src/lib/components/admin/Settings.svelte index 36e87df26..d47b68dde 100644 --- a/src/lib/components/admin/Settings.svelte +++ b/src/lib/components/admin/Settings.svelte @@ -18,12 +18,15 @@ import Documents from './Settings/Documents.svelte'; import WebSearch from './Settings/WebSearch.svelte'; - import ChartBar from '../icons/ChartBar.svelte'; - import DocumentChartBar from '../icons/DocumentChartBar.svelte'; import Evaluations from './Settings/Evaluations.svelte'; import CodeExecution from './Settings/CodeExecution.svelte'; import Tools from './Settings/Tools.svelte'; + import ChartBar from '../icons/ChartBar.svelte'; + import DocumentChartBar from '../icons/DocumentChartBar.svelte'; + import Search from '../icons/Search.svelte'; + import XMark from '../icons/XMark.svelte'; + const i18n = getContext('i18n'); let selectedTab = 'general'; @@ -63,6 +66,207 @@ } }; + let search = ''; + let searchDebounceTimeout; + let filteredSettings = []; + + const allSettings = [ + { + id: 'general', + title: 'General', + route: '/admin/settings/general', + keywords: [ + 'general', + 'admin', + 'settings', + 'version', + 'update', + 'language', + 'theme', + 'data', + 'users', + 'roles', + 'ldap', + 'authentication', + 'reverse proxy', + 'webhook', + 'community', + 'channels' + ] + }, + { + id: 'connections', + title: 'Connections', + route: '/admin/settings/connections', + keywords: [ + 'connections', + 'ollama', + 'openai', + 'api', + 'base url', + 'direct connections', + 'proxy', + 'key' + ] + }, + { + id: 'models', + title: 'Models', + route: '/admin/settings/models', + keywords: [ + 'models', + 'pull', + 'delete', + 'create', + 'edit', + 'modelfile', + 'gguf', + 'import', + 'export' + ] + }, + { + id: 'evaluations', + title: 'Evaluations', + route: '/admin/settings/evaluations', + keywords: ['evaluations', 'feedback', 'rating', 'arena', 'leaderboard', 'preference'] + }, + { + id: 'tools', + title: 'External Tools', + route: '/admin/settings/tools', + keywords: ['tools', 'plugins', 'extensions', 'functions', 'openapi', 'server'] + }, + { + id: 'documents', + title: 'Documents', + route: '/admin/settings/documents', + keywords: [ + 'documents', + 'files', + 'rag', + 'knowledge', + 'upload', + 'embedding', + 'vector db', + 'chunk', + 'overlap', + 'splitter', + 'pdf', + 'ocr', + 'tika', + 'docling', + 'unstructured' + ] + }, + { + id: 'web', + title: 'Web Search', + route: '/admin/settings/web', + keywords: [ + 'web search', + 'google', + 'bing', + 'duckduckgo', + 'serp', + 'searxng', + 'moojeh', + 'yacy', + 'serper', + 'serply', + 'tavily', + 'exa', + 'perplexity', + 'firecrawl' + ] + }, + { + id: 'code-execution', + title: 'Code Execution', + route: '/admin/settings/code-execution', + keywords: ['code execution', 'python', 'sandbox', 'compiler', 'jupyter', 'interpreter'] + }, + { + id: 'interface', + title: 'Interface', + route: '/admin/settings/interface', + keywords: [ + 'interface', + 'ui', + 'appearance', + 'banners', + 'tasks', + 'prompt suggestions', + 'title generation', + 'tags' + ] + }, + { + id: 'audio', + title: 'Audio', + route: '/admin/settings/audio', + keywords: [ + 'audio', + 'voice', + 'speech', + 'tts', + 'stt', + 'whisper', + 'deepgram', + 'azure', + 'openai', + 'elevenlabs' + ] + }, + { + id: 'images', + title: 'Images', + route: '/admin/settings/images', + keywords: [ + 'images', + 'generation', + 'dalle', + 'stable diffusion', + 'comfyui', + 'automatic1111', + 'gemini' + ] + }, + { + id: 'pipelines', + title: 'Pipelines', + route: '/admin/settings/pipelines', + keywords: ['pipelines', 'workflows', 'filters', 'valves', 'middleware'] + }, + { + id: 'db', + title: 'Database', + route: '/admin/settings/db', + keywords: ['database', 'export', 'import', 'backup', 'chats', 'users'] + } + ]; + + const setFilteredSettings = () => { + filteredSettings = allSettings.filter((tab) => { + const searchTerm = search.toLowerCase().trim(); + return ( + search === '' || + tab.title.toLowerCase().includes(searchTerm) || + tab.keywords.some((keyword) => keyword.includes(searchTerm)) + ); + }); + }; + + const searchDebounceHandler = () => { + if (searchDebounceTimeout) { + clearTimeout(searchDebounceTimeout); + } + + searchDebounceTimeout = setTimeout(() => { + setFilteredSettings(); + }, 100); + }; + onMount(() => { const containerElement = document.getElementById('admin-settings-tabs-container'); @@ -75,6 +279,7 @@ }); } + setFilteredSettings(); // Scroll to the selected tab on mount scrollToTab(selectedTab); }); @@ -85,352 +290,205 @@ id="admin-settings-tabs-container" class="tabs mx-[16px] lg:mx-0 lg:px-[16px] flex flex-row overflow-x-auto gap-2.5 max-w-full lg:gap-1 lg:flex-col lg:flex-none lg:w-50 dark:text-gray-200 text-sm font-medium text-left scrollbar-none" > - + + + - - - - - - - - - - - - - - - - - - - - - - - + {#each filteredSettings as tab (tab.id)} + + {/each}