mirror of
https://github.com/open-webui/open-webui
synced 2024-11-16 13:40:55 +00:00
feat: display max 4 suggestions
This commit is contained in:
parent
7ac338ae31
commit
84844a84a0
@ -1,10 +1,17 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export let submitPrompt: Function;
|
export let submitPrompt: Function;
|
||||||
export let suggestionPrompts = [];
|
export let suggestionPrompts = [];
|
||||||
|
|
||||||
|
let prompts = [];
|
||||||
|
|
||||||
|
$: prompts =
|
||||||
|
suggestionPrompts.length <= 4
|
||||||
|
? suggestionPrompts
|
||||||
|
: suggestionPrompts.sort(() => Math.random() - 0.5).slice(0, 4);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class=" flex flex-wrap-reverse mb-3 md:p-1 text-left w-full">
|
<div class=" flex flex-wrap-reverse mb-3 md:p-1 text-left w-full">
|
||||||
{#each suggestionPrompts as prompt, promptIdx}
|
{#each prompts as prompt, promptIdx}
|
||||||
<div class="{promptIdx > 1 ? 'hidden sm:inline-flex' : ''} basis-full sm:basis-1/2 p-[5px]">
|
<div class="{promptIdx > 1 ? 'hidden sm:inline-flex' : ''} basis-full sm:basis-1/2 p-[5px]">
|
||||||
<button
|
<button
|
||||||
class=" flex-1 flex justify-between w-full h-full px-4 py-2.5 bg-white hover:bg-gray-50 dark:bg-gray-900 dark:hover:bg-gray-700 outline outline-1 outline-gray-200 dark:outline-gray-800 rounded-lg transition group"
|
class=" flex-1 flex justify-between w-full h-full px-4 py-2.5 bg-white hover:bg-gray-50 dark:bg-gray-900 dark:hover:bg-gray-700 outline outline-1 outline-gray-200 dark:outline-gray-800 rounded-lg transition group"
|
||||||
|
Loading…
Reference in New Issue
Block a user