2023-11-02 03:29:50 +01:00
|
|
|
<script lang="ts">
|
|
|
|
export let submitPrompt: Function;
|
2023-12-03 20:54:11 +01:00
|
|
|
export let suggestionPrompts = [];
|
2024-02-08 03:51:45 +01:00
|
|
|
|
|
|
|
let prompts = [];
|
|
|
|
|
|
|
|
$: prompts =
|
|
|
|
suggestionPrompts.length <= 4
|
|
|
|
? suggestionPrompts
|
|
|
|
: suggestionPrompts.sort(() => Math.random() - 0.5).slice(0, 4);
|
2023-11-02 03:29:50 +01:00
|
|
|
</script>
|
|
|
|
|
2023-12-23 05:40:17 +01:00
|
|
|
<div class=" flex flex-wrap-reverse mb-3 md:p-1 text-left w-full">
|
2024-02-08 03:51:45 +01:00
|
|
|
{#each prompts as prompt, promptIdx}
|
2023-12-03 20:54:11 +01:00
|
|
|
<div class="{promptIdx > 1 ? 'hidden sm:inline-flex' : ''} basis-full sm:basis-1/2 p-[5px]">
|
|
|
|
<button
|
2024-02-08 02:55:19 +01:00
|
|
|
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"
|
2023-12-03 20:54:11 +01:00
|
|
|
on:click={() => {
|
|
|
|
submitPrompt(prompt.content);
|
|
|
|
}}
|
2023-11-02 03:29:50 +01:00
|
|
|
>
|
2023-12-03 20:54:11 +01:00
|
|
|
<div class="flex flex-col text-left self-center">
|
2024-01-23 06:53:13 +01:00
|
|
|
{#if prompt.title && prompt.title[0] !== ''}
|
2023-12-03 20:54:11 +01:00
|
|
|
<div class="text-sm font-medium dark:text-gray-300">{prompt.title[0]}</div>
|
|
|
|
<div class="text-sm text-gray-500">{prompt.title[1]}</div>
|
|
|
|
{:else}
|
2024-01-06 10:09:20 +01:00
|
|
|
<div class=" self-center text-sm font-medium dark:text-gray-300 line-clamp-2">
|
|
|
|
{prompt.content}
|
|
|
|
</div>
|
2023-12-03 20:54:11 +01:00
|
|
|
{/if}
|
|
|
|
</div>
|
2023-11-02 03:29:50 +01:00
|
|
|
|
2023-12-03 20:54:11 +01:00
|
|
|
<div
|
2024-02-08 02:55:19 +01:00
|
|
|
class="self-center p-1 rounded-lg text-white group-hover:bg-gray-100 group-hover:text-gray-800 dark:group-hover:bg-gray-800 dark:group-hover:text-gray-100 dark:text-gray-900 transition"
|
2023-12-03 20:54:11 +01:00
|
|
|
>
|
|
|
|
<svg
|
|
|
|
xmlns="http://www.w3.org/2000/svg"
|
2024-02-08 02:55:19 +01:00
|
|
|
viewBox="0 0 16 16"
|
2023-12-03 20:54:11 +01:00
|
|
|
fill="currentColor"
|
|
|
|
class="w-4 h-4"
|
|
|
|
>
|
|
|
|
<path
|
|
|
|
fill-rule="evenodd"
|
2024-02-08 02:55:19 +01:00
|
|
|
d="M8 14a.75.75 0 0 1-.75-.75V4.56L4.03 7.78a.75.75 0 0 1-1.06-1.06l4.5-4.5a.75.75 0 0 1 1.06 0l4.5 4.5a.75.75 0 0 1-1.06 1.06L8.75 4.56v8.69A.75.75 0 0 1 8 14Z"
|
2023-12-03 20:54:11 +01:00
|
|
|
clip-rule="evenodd"
|
|
|
|
/>
|
|
|
|
</svg>
|
|
|
|
</div>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
{/each}
|
2023-11-02 03:29:50 +01:00
|
|
|
</div>
|