diff --git a/frontend/src/lib/components/search/GlobalSearchModal.svelte b/frontend/src/lib/components/search/GlobalSearchModal.svelte index 422d3ba7e1..2a36576dfd 100644 --- a/frontend/src/lib/components/search/GlobalSearchModal.svelte +++ b/frontend/src/lib/components/search/GlobalSearchModal.svelte @@ -25,7 +25,8 @@ Route, Search, SearchCode, - Unplug + Unplug, + WandSparkles } from 'lucide-svelte' import Portal from '$lib/components/Portal.svelte' @@ -293,8 +294,7 @@ } if (tab === 'default') { - if (searchTerm === '') - itemMap['default'] = fuzzyFilter(searchTerm, defaultMenuItems, defaultMenuItemLabels) + if (searchTerm === '') itemMap['default'] = defaultMenuItems else itemMap['default'] = fuzzyFilter( searchTerm, @@ -372,9 +372,6 @@ } } } - if ((itemMap[tab] ?? []).length === 0 && searchTerm.length > 0 && event.key === 'Enter') { - askAiButton?.onClick() - } } } @@ -653,10 +650,14 @@
{#if tab === 'default' || tab === 'switch-mode'} {@const items = (itemMap[tab] ?? []).filter((e) => - defaultMenuItemsWithHidden.includes(e) + defaultMenuItemsWithHidden.some((x) => e.search_id === x.search_id) )} {#if items.length > 0} -
+
{#each items as el} el?.action(shift)} @@ -674,8 +675,8 @@ {/if} {#if tab === 'default'} -
- {#if (itemMap[tab] ?? []).filter((e) => (combinedItems ?? []).includes(e)).length > 0} + {#if (itemMap[tab] ?? []).filter((e) => (combinedItems ?? []).includes(e)).length > 0} +
Flows/Scripts/Apps
@@ -694,19 +695,28 @@ bind:mouseMoved /> {/each} - {/if} +
+ {/if} - {#if (itemMap[tab] ?? []).length === 0} + {#if (itemMap[tab] ?? []).length === 0} +
+ { + askAiButton?.onClick() + }} + id={'ai:no-results-ask-ai'} + hovered={true} + label={`Try asking \`${searchTerm}\` to AI`} + icon={WandSparkles} + bind:mouseMoved + />
-
Nothing found, ask the AI to find what you need!
-
Tip: press `esc` to quickly clear the search bar
+
Tip: press `esc` to quickly clear the search bar
- {/if} -
+
+ {/if} {:else if tab === 'content'}