refac
This commit is contained in:
1 parent
7b2efdff08
commit
c9103a29ff
1 file changed
+17
-13
@@ -1,7 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Fuse from 'fuse.js';
|
import Fuse from 'fuse.js';
|
||||||
import Bolt from '$lib/components/icons/Bolt.svelte';
|
import Bolt from '$lib/components/icons/Bolt.svelte';
|
||||||
import { onMount, getContext } from 'svelte';
|
import { getContext } from 'svelte';
|
||||||
import { settings, WEBUI_NAME } from '$lib/stores';
|
import { settings, WEBUI_NAME } from '$lib/stores';
|
||||||
import { WEBUI_VERSION } from '$lib/constants';
|
import { WEBUI_VERSION } from '$lib/constants';
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
export let suggestionPrompts = [];
|
export let suggestionPrompts = [];
|
||||||
export let className = '';
|
export let className = '';
|
||||||
export let inputValue = '';
|
export let inputValue = '';
|
||||||
export let onSelect = (e) => {};
|
export let onSelect = () => {};
|
||||||
|
|
||||||
let sortedPrompts = [];
|
let sortedPrompts = [];
|
||||||
|
|
||||||
@@ -81,36 +81,40 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="h-40 w-full">
|
<div class="h-36 w-full">
|
||||||
{#if filteredPrompts.length > 0}
|
{#if filteredPrompts.length > 0}
|
||||||
<div role="list" class="max-h-40 overflow-auto scrollbar-none items-start {className}">
|
<div role="list" class="max-h-36 overflow-auto scrollbar-none items-start {className}">
|
||||||
{#each filteredPrompts as prompt, idx (prompt.id || `${prompt.content}-${idx}`)}
|
{#each filteredPrompts as prompt, idx (prompt.id || `${prompt.content}-${idx}`)}
|
||||||
<!-- svelte-ignore a11y-no-interactive-element-to-noninteractive-role -->
|
<!-- svelte-ignore a11y-no-interactive-element-to-noninteractive-role -->
|
||||||
<button
|
<button
|
||||||
role="listitem"
|
role="listitem"
|
||||||
class="waterfall flex flex-col flex-1 shrink-0 w-full justify-between
|
class="waterfall flex flex-col flex-1 shrink-0 w-full justify-between
|
||||||
px-3 py-2 rounded-xl bg-transparent hover:bg-black/5
|
px-2.5 py-1.5 rounded-lg bg-transparent transition-colors
|
||||||
dark:hover:bg-white/5 transition group"
|
hover:text-gray-950 dark:hover:text-white group"
|
||||||
style="animation-delay: {idx * 60}ms"
|
style="animation-delay: {idx * 45}ms"
|
||||||
on:click={() => onSelect({ type: 'prompt', data: prompt.content })}
|
on:click={() => onSelect({ type: 'prompt', data: prompt.content })}
|
||||||
>
|
>
|
||||||
<div class="flex flex-col text-left">
|
<div class="flex flex-col text-left leading-snug">
|
||||||
{#if prompt.title && prompt.title[0] !== ''}
|
{#if prompt.title && prompt.title[0] !== ''}
|
||||||
<div
|
<div
|
||||||
class="font-normal dark:text-gray-300 dark:group-hover:text-gray-200 transition line-clamp-1"
|
class="text-sm font-normal group-hover:text-gray-950 dark:text-gray-300 dark:group-hover:text-white transition line-clamp-1"
|
||||||
>
|
>
|
||||||
{prompt.title[0]}
|
{prompt.title[0]}
|
||||||
</div>
|
</div>
|
||||||
<div class="text-xs text-gray-600 dark:text-gray-400 font-normal line-clamp-1">
|
<div
|
||||||
|
class="text-xs text-gray-600 group-hover:text-gray-900 dark:text-gray-400 dark:group-hover:text-gray-100 font-normal line-clamp-1"
|
||||||
|
>
|
||||||
{prompt.title[1]}
|
{prompt.title[1]}
|
||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
<div
|
<div
|
||||||
class="font-normal dark:text-gray-300 dark:group-hover:text-gray-200 transition line-clamp-1"
|
class="text-sm font-normal group-hover:text-gray-950 dark:text-gray-300 dark:group-hover:text-white transition line-clamp-1"
|
||||||
>
|
>
|
||||||
{prompt.content}
|
{prompt.content}
|
||||||
</div>
|
</div>
|
||||||
<div class="text-xs text-gray-600 dark:text-gray-400 font-normal line-clamp-1">
|
<div
|
||||||
|
class="text-xs text-gray-600 group-hover:text-gray-900 dark:text-gray-400 dark:group-hover:text-gray-100 font-normal line-clamp-1"
|
||||||
|
>
|
||||||
{$i18n.t('Prompt')}
|
{$i18n.t('Prompt')}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
@@ -126,7 +130,7 @@
|
|||||||
@keyframes fadeInUp {
|
@keyframes fadeInUp {
|
||||||
0% {
|
0% {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transform: translateY(20px);
|
transform: translateY(6px);
|
||||||
}
|
}
|
||||||
100% {
|
100% {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
|
|||||||
Reference in new issue
Block a user