mirror of
https://github.com/open-webui/open-webui
synced 2024-11-25 05:18:15 +00:00
refac: suggestion prompts
This commit is contained in:
parent
bbf5e37f6f
commit
0c7f0f4430
@ -386,11 +386,32 @@
|
||||
</div>
|
||||
|
||||
<div class="my-2">
|
||||
<div class="flex w-full justify-between mb-2">
|
||||
<div class="flex w-full justify-between items-center">
|
||||
<div class="flex w-full justify-between items-center">
|
||||
<div class=" self-center text-sm font-semibold">{$i18n.t('Prompt suggestions')}</div>
|
||||
|
||||
<button
|
||||
class="p-1 px-3 text-xs flex rounded transition"
|
||||
class="p-1 text-xs flex rounded transition"
|
||||
type="button"
|
||||
on:click={() => {
|
||||
if (info.meta.suggestion_prompts === null) {
|
||||
info.meta.suggestion_prompts = [{ content: '' }];
|
||||
} else {
|
||||
info.meta.suggestion_prompts = null;
|
||||
}
|
||||
}}
|
||||
>
|
||||
{#if info.meta.suggestion_prompts === null}
|
||||
<span class="ml-2 self-center">{$i18n.t('Default')}</span>
|
||||
{:else}
|
||||
<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
|
||||
{/if}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{#if info.meta.suggestion_prompts !== null}
|
||||
<button
|
||||
class="p-1 px-2 text-xs flex rounded transition"
|
||||
type="button"
|
||||
on:click={() => {
|
||||
if (
|
||||
@ -412,8 +433,12 @@
|
||||
/>
|
||||
</svg>
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="flex flex-col space-y-1">
|
||||
|
||||
{#if info.meta.suggestion_prompts}
|
||||
<div class="flex flex-col space-y-1 mt-2">
|
||||
{#if info.meta.suggestion_prompts.length > 0}
|
||||
{#each info.meta.suggestion_prompts as prompt, promptIdx}
|
||||
<div class=" flex border dark:border-gray-600 rounded-lg">
|
||||
<input
|
||||
@ -443,7 +468,11 @@
|
||||
</button>
|
||||
</div>
|
||||
{/each}
|
||||
{:else}
|
||||
<div class="text-xs text-center">No suggestion prompts</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="my-2">
|
||||
|
@ -44,8 +44,7 @@
|
||||
meta: {
|
||||
profile_image_url: '/favicon.png',
|
||||
description: '',
|
||||
content: '',
|
||||
suggestion_prompts: []
|
||||
suggestion_prompts: null
|
||||
},
|
||||
params: {
|
||||
system: ''
|
||||
@ -366,11 +365,32 @@
|
||||
</div>
|
||||
|
||||
<div class="my-2">
|
||||
<div class="flex w-full justify-between mb-2">
|
||||
<div class="flex w-full justify-between items-center">
|
||||
<div class="flex w-full justify-between items-center">
|
||||
<div class=" self-center text-sm font-semibold">{$i18n.t('Prompt suggestions')}</div>
|
||||
|
||||
<button
|
||||
class="p-1 px-3 text-xs flex rounded transition"
|
||||
class="p-1 text-xs flex rounded transition"
|
||||
type="button"
|
||||
on:click={() => {
|
||||
if (info.meta.suggestion_prompts === null) {
|
||||
info.meta.suggestion_prompts = [{ content: '' }];
|
||||
} else {
|
||||
info.meta.suggestion_prompts = null;
|
||||
}
|
||||
}}
|
||||
>
|
||||
{#if info.meta.suggestion_prompts === null}
|
||||
<span class="ml-2 self-center">{$i18n.t('Default')}</span>
|
||||
{:else}
|
||||
<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
|
||||
{/if}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{#if info.meta.suggestion_prompts !== null}
|
||||
<button
|
||||
class="p-1 px-2 text-xs flex rounded transition"
|
||||
type="button"
|
||||
on:click={() => {
|
||||
if (
|
||||
@ -392,8 +412,12 @@
|
||||
/>
|
||||
</svg>
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="flex flex-col space-y-1">
|
||||
|
||||
{#if info.meta.suggestion_prompts}
|
||||
<div class="flex flex-col space-y-1 mt-2">
|
||||
{#if info.meta.suggestion_prompts.length > 0}
|
||||
{#each info.meta.suggestion_prompts as prompt, promptIdx}
|
||||
<div class=" flex border dark:border-gray-600 rounded-lg">
|
||||
<input
|
||||
@ -423,7 +447,11 @@
|
||||
</button>
|
||||
</div>
|
||||
{/each}
|
||||
{:else}
|
||||
<div class="text-xs text-center">No suggestion prompts</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="my-2">
|
||||
|
Loading…
Reference in New Issue
Block a user