open-webui/src/lib/components/chat/Settings/Advanced/AdvancedParams.svelte

731 lines
18 KiB
Svelte
Raw Normal View History

2024-02-05 17:58:54 +08:00
<script lang="ts">
2024-05-25 13:21:57 +08:00
import { getContext, createEventDispatcher } from 'svelte';
const dispatch = createEventDispatcher();
const i18n = getContext('i18n');
2024-05-25 11:29:13 +08:00
export let params = {
2024-02-05 17:58:54 +08:00
// Advanced
seed: 0,
2024-05-25 17:26:26 +08:00
stop: null,
2024-02-05 17:58:54 +08:00
temperature: '',
frequency_penalty: '',
2024-02-05 17:58:54 +08:00
repeat_last_n: '',
mirostat: '',
mirostat_eta: '',
mirostat_tau: '',
top_k: '',
top_p: '',
tfs_z: '',
num_ctx: '',
max_tokens: '',
use_mmap: null,
use_mlock: null,
num_thread: null,
2024-05-25 11:29:13 +08:00
template: null
2024-02-05 17:58:54 +08:00
};
2024-05-25 11:29:13 +08:00
let customFieldName = '';
let customFieldValue = '';
2024-05-25 13:21:57 +08:00
$: if (params) {
dispatch('change', params);
}
2024-02-05 17:58:54 +08:00
</script>
2024-05-25 14:34:58 +08:00
<div class=" space-y-1 text-xs">
2024-05-25 11:29:13 +08:00
<div class=" py-0.5 w-full justify-between">
<div class="flex w-full justify-between">
<div class=" self-center text-xs font-medium">{$i18n.t('Seed')}</div>
<button
class="p-1 px-3 text-xs flex rounded transition"
type="button"
on:click={() => {
params.seed = (params?.seed ?? null) === null ? 0 : null;
}}
>
{#if (params?.seed ?? null) === null}
<span class="ml-2 self-center"> {$i18n.t('Default')} </span>
{:else}
<span class="ml-2 self-center"> {$i18n.t('Custom')} </span>
{/if}
</button>
2024-02-05 17:58:54 +08:00
</div>
2024-05-25 11:29:13 +08:00
{#if (params?.seed ?? null) !== null}
<div class="flex mt-0.5 space-x-2">
<div class=" flex-1">
<input
class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
type="number"
placeholder="Enter Seed"
bind:value={params.seed}
autocomplete="off"
min="0"
/>
</div>
2024-02-05 17:58:54 +08:00
</div>
2024-05-25 11:29:13 +08:00
{/if}
</div>
<div class=" py-0.5 w-full justify-between">
<div class="flex w-full justify-between">
<div class=" self-center text-xs font-medium">{$i18n.t('Stop Sequence')}</div>
<button
class="p-1 px-3 text-xs flex rounded transition"
type="button"
on:click={() => {
params.stop = (params?.stop ?? null) === null ? '' : null;
}}
>
{#if (params?.stop ?? null) === null}
<span class="ml-2 self-center"> {$i18n.t('Default')} </span>
{:else}
<span class="ml-2 self-center"> {$i18n.t('Custom')} </span>
{/if}
</button>
2024-02-05 17:58:54 +08:00
</div>
2024-05-25 11:29:13 +08:00
{#if (params?.stop ?? null) !== null}
<div class="flex mt-0.5 space-x-2">
<div class=" flex-1">
<input
class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
type="text"
placeholder={$i18n.t('Enter stop sequence')}
bind:value={params.stop}
autocomplete="off"
/>
</div>
</div>
{/if}
2024-02-05 17:58:54 +08:00
</div>
<div class=" py-0.5 w-full justify-between">
<div class="flex w-full justify-between">
<div class=" self-center text-xs font-medium">{$i18n.t('Temperature')}</div>
2024-02-05 17:58:54 +08:00
<button
class="p-1 px-3 text-xs flex rounded transition"
type="button"
on:click={() => {
2024-05-25 11:29:13 +08:00
params.temperature = (params?.temperature ?? '') === '' ? 0.8 : '';
2024-02-05 17:58:54 +08:00
}}
>
2024-05-25 11:29:13 +08:00
{#if (params?.temperature ?? '') === ''}
<span class="ml-2 self-center"> {$i18n.t('Default')} </span>
2024-02-05 17:58:54 +08:00
{:else}
<span class="ml-2 self-center"> {$i18n.t('Custom')} </span>
2024-02-05 17:58:54 +08:00
{/if}
</button>
</div>
2024-05-25 11:29:13 +08:00
{#if (params?.temperature ?? '') !== ''}
2024-02-05 17:58:54 +08:00
<div class="flex mt-0.5 space-x-2">
<div class=" flex-1">
<input
id="steps-range"
type="range"
min="0"
max="1"
step="0.05"
2024-05-25 11:29:13 +08:00
bind:value={params.temperature}
2024-02-05 17:58:54 +08:00
class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
/>
</div>
<div>
<input
2024-05-25 11:29:13 +08:00
bind:value={params.temperature}
2024-02-05 17:58:54 +08:00
type="number"
class=" bg-transparent text-center w-14"
min="0"
max="1"
step="0.05"
/>
</div>
</div>
{/if}
</div>
<div class=" py-0.5 w-full justify-between">
<div class="flex w-full justify-between">
<div class=" self-center text-xs font-medium">{$i18n.t('Mirostat')}</div>
2024-02-05 17:58:54 +08:00
<button
class="p-1 px-3 text-xs flex rounded transition"
type="button"
on:click={() => {
2024-05-25 11:29:13 +08:00
params.mirostat = (params?.mirostat ?? '') === '' ? 0 : '';
2024-02-05 17:58:54 +08:00
}}
>
2024-05-25 11:29:13 +08:00
{#if (params?.mirostat ?? '') === ''}
2024-03-03 19:22:29 +08:00
<span class="ml-2 self-center">{$i18n.t('Default')}</span>
2024-02-05 17:58:54 +08:00
{:else}
2024-05-25 11:29:13 +08:00
<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
2024-02-05 17:58:54 +08:00
{/if}
</button>
</div>
2024-05-25 11:29:13 +08:00
{#if (params?.mirostat ?? '') !== ''}
2024-02-05 17:58:54 +08:00
<div class="flex mt-0.5 space-x-2">
<div class=" flex-1">
<input
id="steps-range"
type="range"
min="0"
max="2"
step="1"
2024-05-25 11:29:13 +08:00
bind:value={params.mirostat}
2024-02-05 17:58:54 +08:00
class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
/>
</div>
<div>
<input
2024-05-25 11:29:13 +08:00
bind:value={params.mirostat}
2024-02-05 17:58:54 +08:00
type="number"
class=" bg-transparent text-center w-14"
min="0"
max="2"
step="1"
/>
</div>
</div>
{/if}
</div>
<div class=" py-0.5 w-full justify-between">
<div class="flex w-full justify-between">
<div class=" self-center text-xs font-medium">{$i18n.t('Mirostat Eta')}</div>
2024-02-05 17:58:54 +08:00
<button
class="p-1 px-3 text-xs flex rounded transition"
type="button"
on:click={() => {
2024-05-25 11:29:13 +08:00
params.mirostat_eta = (params?.mirostat_eta ?? '') === '' ? 0.1 : '';
2024-02-05 17:58:54 +08:00
}}
>
2024-05-25 11:29:13 +08:00
{#if (params?.mirostat_eta ?? '') === ''}
2024-03-03 19:22:29 +08:00
<span class="ml-2 self-center">{$i18n.t('Default')}</span>
2024-02-05 17:58:54 +08:00
{:else}
2024-05-25 11:29:13 +08:00
<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
2024-02-05 17:58:54 +08:00
{/if}
</button>
</div>
2024-05-25 11:29:13 +08:00
{#if (params?.mirostat_eta ?? '') !== ''}
2024-02-05 17:58:54 +08:00
<div class="flex mt-0.5 space-x-2">
<div class=" flex-1">
<input
id="steps-range"
type="range"
min="0"
max="1"
step="0.05"
2024-05-25 11:29:13 +08:00
bind:value={params.mirostat_eta}
2024-02-05 17:58:54 +08:00
class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
/>
</div>
<div>
<input
2024-05-25 11:29:13 +08:00
bind:value={params.mirostat_eta}
2024-02-05 17:58:54 +08:00
type="number"
class=" bg-transparent text-center w-14"
min="0"
max="1"
step="0.05"
/>
</div>
</div>
{/if}
</div>
<div class=" py-0.5 w-full justify-between">
<div class="flex w-full justify-between">
<div class=" self-center text-xs font-medium">{$i18n.t('Mirostat Tau')}</div>
2024-02-05 17:58:54 +08:00
<button
class="p-1 px-3 text-xs flex rounded transition"
type="button"
on:click={() => {
2024-05-25 11:29:13 +08:00
params.mirostat_tau = (params?.mirostat_tau ?? '') === '' ? 5.0 : '';
2024-02-05 17:58:54 +08:00
}}
>
2024-05-25 11:29:13 +08:00
{#if (params?.mirostat_tau ?? '') === ''}
2024-03-03 19:22:29 +08:00
<span class="ml-2 self-center">{$i18n.t('Default')}</span>
2024-02-05 17:58:54 +08:00
{:else}
2024-03-03 19:22:29 +08:00
<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
2024-02-05 17:58:54 +08:00
{/if}
</button>
</div>
2024-05-25 11:29:13 +08:00
{#if (params?.mirostat_tau ?? '') !== ''}
2024-02-05 17:58:54 +08:00
<div class="flex mt-0.5 space-x-2">
<div class=" flex-1">
<input
id="steps-range"
type="range"
min="0"
max="10"
step="0.5"
2024-05-25 11:29:13 +08:00
bind:value={params.mirostat_tau}
2024-02-05 17:58:54 +08:00
class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
/>
</div>
<div>
<input
2024-05-25 11:29:13 +08:00
bind:value={params.mirostat_tau}
2024-02-05 17:58:54 +08:00
type="number"
class=" bg-transparent text-center w-14"
min="0"
max="10"
step="0.5"
/>
</div>
</div>
{/if}
</div>
<div class=" py-0.5 w-full justify-between">
<div class="flex w-full justify-between">
<div class=" self-center text-xs font-medium">{$i18n.t('Top K')}</div>
2024-02-05 17:58:54 +08:00
<button
class="p-1 px-3 text-xs flex rounded transition"
type="button"
on:click={() => {
2024-05-25 11:29:13 +08:00
params.top_k = (params?.top_k ?? '') === '' ? 40 : '';
2024-02-05 17:58:54 +08:00
}}
>
2024-05-25 11:29:13 +08:00
{#if (params?.top_k ?? '') === ''}
2024-03-03 19:22:29 +08:00
<span class="ml-2 self-center">{$i18n.t('Default')}</span>
2024-02-05 17:58:54 +08:00
{:else}
2024-05-25 11:29:13 +08:00
<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
2024-02-05 17:58:54 +08:00
{/if}
</button>
</div>
2024-05-25 11:29:13 +08:00
{#if (params?.top_k ?? '') !== ''}
2024-02-05 17:58:54 +08:00
<div class="flex mt-0.5 space-x-2">
<div class=" flex-1">
<input
id="steps-range"
type="range"
min="0"
max="100"
step="0.5"
2024-05-25 11:29:13 +08:00
bind:value={params.top_k}
2024-02-05 17:58:54 +08:00
class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
/>
</div>
<div>
<input
2024-05-25 11:29:13 +08:00
bind:value={params.top_k}
2024-02-05 17:58:54 +08:00
type="number"
class=" bg-transparent text-center w-14"
min="0"
max="100"
step="0.5"
/>
</div>
</div>
{/if}
</div>
<div class=" py-0.5 w-full justify-between">
<div class="flex w-full justify-between">
<div class=" self-center text-xs font-medium">{$i18n.t('Top P')}</div>
2024-02-05 17:58:54 +08:00
<button
class="p-1 px-3 text-xs flex rounded transition"
type="button"
on:click={() => {
2024-05-25 11:29:13 +08:00
params.top_p = (params?.top_p ?? '') === '' ? 0.9 : '';
2024-02-05 17:58:54 +08:00
}}
>
2024-05-25 11:29:13 +08:00
{#if (params?.top_p ?? '') === ''}
2024-03-03 19:22:29 +08:00
<span class="ml-2 self-center">{$i18n.t('Default')}</span>
2024-02-05 17:58:54 +08:00
{:else}
2024-05-25 11:29:13 +08:00
<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
2024-02-05 17:58:54 +08:00
{/if}
</button>
</div>
2024-05-25 11:29:13 +08:00
{#if (params?.top_p ?? '') !== ''}
2024-02-05 17:58:54 +08:00
<div class="flex mt-0.5 space-x-2">
<div class=" flex-1">
<input
id="steps-range"
type="range"
min="0"
max="1"
step="0.05"
2024-05-25 11:29:13 +08:00
bind:value={params.top_p}
2024-02-05 17:58:54 +08:00
class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
/>
</div>
<div>
<input
2024-05-25 11:29:13 +08:00
bind:value={params.top_p}
2024-02-05 17:58:54 +08:00
type="number"
class=" bg-transparent text-center w-14"
min="0"
max="1"
step="0.05"
/>
</div>
</div>
{/if}
</div>
<div class=" py-0.5 w-full justify-between">
<div class="flex w-full justify-between">
2024-06-02 04:46:14 +08:00
<div class=" self-center text-xs font-medium">{$i18n.t('Frequency Penalty')}</div>
2024-02-05 17:58:54 +08:00
<button
class="p-1 px-3 text-xs flex rounded transition"
type="button"
on:click={() => {
params.frequency_penalty = (params?.frequency_penalty ?? '') === '' ? 1.1 : '';
2024-02-05 17:58:54 +08:00
}}
>
{#if (params?.frequency_penalty ?? '') === ''}
2024-03-03 19:22:29 +08:00
<span class="ml-2 self-center">{$i18n.t('Default')}</span>
2024-02-05 17:58:54 +08:00
{:else}
2024-05-25 11:29:13 +08:00
<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
2024-02-05 17:58:54 +08:00
{/if}
</button>
</div>
{#if (params?.frequency_penalty ?? '') !== ''}
2024-02-05 17:58:54 +08:00
<div class="flex mt-0.5 space-x-2">
<div class=" flex-1">
<input
id="steps-range"
type="range"
min="0"
max="2"
step="0.05"
bind:value={params.frequency_penalty}
2024-02-05 17:58:54 +08:00
class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
/>
</div>
<div>
<input
bind:value={params.frequency_penalty}
2024-02-05 17:58:54 +08:00
type="number"
class=" bg-transparent text-center w-14"
min="0"
max="2"
step="0.05"
/>
</div>
</div>
{/if}
</div>
<div class=" py-0.5 w-full justify-between">
<div class="flex w-full justify-between">
<div class=" self-center text-xs font-medium">{$i18n.t('Repeat Last N')}</div>
2024-02-05 17:58:54 +08:00
<button
class="p-1 px-3 text-xs flex rounded transition"
type="button"
on:click={() => {
2024-05-25 11:29:13 +08:00
params.repeat_last_n = (params?.repeat_last_n ?? '') === '' ? 64 : '';
2024-02-05 17:58:54 +08:00
}}
>
2024-05-25 11:29:13 +08:00
{#if (params?.repeat_last_n ?? '') === ''}
2024-03-03 19:22:29 +08:00
<span class="ml-2 self-center">{$i18n.t('Default')}</span>
2024-02-05 17:58:54 +08:00
{:else}
2024-05-25 11:29:13 +08:00
<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
2024-02-05 17:58:54 +08:00
{/if}
</button>
</div>
2024-05-25 11:29:13 +08:00
{#if (params?.repeat_last_n ?? '') !== ''}
2024-02-05 17:58:54 +08:00
<div class="flex mt-0.5 space-x-2">
<div class=" flex-1">
<input
id="steps-range"
type="range"
min="-1"
max="128"
step="1"
2024-05-25 11:29:13 +08:00
bind:value={params.repeat_last_n}
2024-02-05 17:58:54 +08:00
class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
/>
</div>
<div>
<input
2024-05-25 11:29:13 +08:00
bind:value={params.repeat_last_n}
2024-02-05 17:58:54 +08:00
type="number"
class=" bg-transparent text-center w-14"
min="-1"
max="128"
step="1"
/>
</div>
</div>
{/if}
</div>
<div class=" py-0.5 w-full justify-between">
<div class="flex w-full justify-between">
<div class=" self-center text-xs font-medium">{$i18n.t('Tfs Z')}</div>
2024-02-05 17:58:54 +08:00
<button
class="p-1 px-3 text-xs flex rounded transition"
type="button"
on:click={() => {
2024-05-25 11:29:13 +08:00
params.tfs_z = (params?.tfs_z ?? '') === '' ? 1 : '';
2024-02-05 17:58:54 +08:00
}}
>
2024-05-25 11:29:13 +08:00
{#if (params?.tfs_z ?? '') === ''}
2024-03-03 19:22:29 +08:00
<span class="ml-2 self-center">{$i18n.t('Default')}</span>
2024-02-05 17:58:54 +08:00
{:else}
2024-05-25 11:29:13 +08:00
<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
2024-02-05 17:58:54 +08:00
{/if}
</button>
</div>
2024-05-25 11:29:13 +08:00
{#if (params?.tfs_z ?? '') !== ''}
2024-02-05 17:58:54 +08:00
<div class="flex mt-0.5 space-x-2">
<div class=" flex-1">
<input
id="steps-range"
type="range"
min="0"
max="2"
step="0.05"
2024-05-25 11:29:13 +08:00
bind:value={params.tfs_z}
2024-02-05 17:58:54 +08:00
class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
/>
</div>
<div>
<input
2024-05-25 11:29:13 +08:00
bind:value={params.tfs_z}
2024-02-05 17:58:54 +08:00
type="number"
class=" bg-transparent text-center w-14"
min="0"
max="2"
step="0.05"
/>
</div>
</div>
{/if}
</div>
<div class=" py-0.5 w-full justify-between">
<div class="flex w-full justify-between">
<div class=" self-center text-xs font-medium">{$i18n.t('Context Length')}</div>
2024-02-05 17:58:54 +08:00
<button
class="p-1 px-3 text-xs flex rounded transition"
type="button"
on:click={() => {
2024-05-25 11:29:13 +08:00
params.num_ctx = (params?.num_ctx ?? '') === '' ? 2048 : '';
2024-02-05 17:58:54 +08:00
}}
>
2024-05-25 11:29:13 +08:00
{#if (params?.num_ctx ?? '') === ''}
2024-03-03 19:22:29 +08:00
<span class="ml-2 self-center">{$i18n.t('Default')}</span>
2024-02-05 17:58:54 +08:00
{:else}
2024-05-25 11:29:13 +08:00
<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
2024-02-05 17:58:54 +08:00
{/if}
</button>
</div>
2024-05-25 11:29:13 +08:00
{#if (params?.num_ctx ?? '') !== ''}
2024-02-05 17:58:54 +08:00
<div class="flex mt-0.5 space-x-2">
<div class=" flex-1">
<input
id="steps-range"
type="range"
2024-04-29 15:36:09 +08:00
min="-1"
2024-04-30 07:10:57 +08:00
max="10240000"
2024-02-05 17:58:54 +08:00
step="1"
2024-05-25 11:29:13 +08:00
bind:value={params.num_ctx}
2024-02-05 17:58:54 +08:00
class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
/>
</div>
<div class="">
<input
2024-05-25 11:29:13 +08:00
bind:value={params.num_ctx}
2024-02-05 17:58:54 +08:00
type="number"
class=" bg-transparent text-center w-14"
2024-04-29 15:36:09 +08:00
min="-1"
2024-04-30 07:10:57 +08:00
step="10"
2024-02-05 17:58:54 +08:00
/>
</div>
</div>
{/if}
</div>
2024-02-05 17:58:54 +08:00
<div class=" py-0.5 w-full justify-between">
<div class="flex w-full justify-between">
<div class=" self-center text-xs font-medium">{$i18n.t('Max Tokens (num_predict)')}</div>
2024-02-05 17:58:54 +08:00
<button
class="p-1 px-3 text-xs flex rounded transition"
type="button"
on:click={() => {
params.max_tokens = (params?.max_tokens ?? '') === '' ? 128 : '';
2024-02-05 17:58:54 +08:00
}}
>
{#if (params?.max_tokens ?? '') === ''}
2024-03-03 19:22:29 +08:00
<span class="ml-2 self-center">{$i18n.t('Default')}</span>
2024-02-05 17:58:54 +08:00
{:else}
2024-05-25 11:29:13 +08:00
<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
2024-02-05 17:58:54 +08:00
{/if}
</button>
</div>
{#if (params?.max_tokens ?? '') !== ''}
2024-02-05 17:58:54 +08:00
<div class="flex mt-0.5 space-x-2">
<div class=" flex-1">
<input
id="steps-range"
type="range"
min="-2"
max="16000"
step="1"
bind:value={params.max_tokens}
2024-02-05 17:58:54 +08:00
class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
/>
</div>
<div class="">
<input
bind:value={params.max_tokens}
2024-02-05 17:58:54 +08:00
type="number"
class=" bg-transparent text-center w-14"
min="-2"
max="16000"
step="1"
/>
</div>
</div>
{/if}
</div>
<div class=" py-0.5 w-full justify-between">
<div class="flex w-full justify-between">
<div class=" self-center text-xs font-medium">{$i18n.t('use_mmap (Ollama)')}</div>
<button
class="p-1 px-3 text-xs flex rounded transition"
type="button"
on:click={() => {
params.use_mmap = (params?.use_mmap ?? null) === null ? true : null;
}}
>
{#if (params?.use_mmap ?? null) === null}
<span class="ml-2 self-center">{$i18n.t('Default')}</span>
{:else}
<span class="ml-2 self-center">{$i18n.t('On')}</span>
{/if}
</button>
</div>
</div>
<div class=" py-0.5 w-full justify-between">
<div class="flex w-full justify-between">
<div class=" self-center text-xs font-medium">{$i18n.t('use_mlock (Ollama)')}</div>
<button
class="p-1 px-3 text-xs flex rounded transition"
type="button"
on:click={() => {
params.use_mlock = (params?.use_mlock ?? null) === null ? true : null;
}}
>
{#if (params?.use_mlock ?? null) === null}
<span class="ml-2 self-center">{$i18n.t('Default')}</span>
{:else}
<span class="ml-2 self-center">{$i18n.t('On')}</span>
{/if}
</button>
</div>
</div>
<div class=" py-0.5 w-full justify-between">
<div class="flex w-full justify-between">
<div class=" self-center text-xs font-medium">{$i18n.t('num_thread (Ollama)')}</div>
<button
class="p-1 px-3 text-xs flex rounded transition"
type="button"
on:click={() => {
params.num_thread = (params?.num_thread ?? null) === null ? 2 : null;
}}
>
{#if (params?.num_thread ?? null) === 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 (params?.num_thread ?? null) !== null}
<div class="flex mt-0.5 space-x-2">
<div class=" flex-1">
<input
id="steps-range"
type="range"
min="1"
max="256"
step="1"
bind:value={params.num_thread}
class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
/>
</div>
<div class="">
<input
bind:value={params.num_thread}
type="number"
class=" bg-transparent text-center w-14"
min="1"
max="256"
step="1"
/>
</div>
</div>
{/if}
</div>
2024-05-25 11:29:13 +08:00
<div class=" py-0.5 w-full justify-between">
<div class="flex w-full justify-between">
<div class=" self-center text-xs font-medium">{$i18n.t('Template')}</div>
<button
class="p-1 px-3 text-xs flex rounded transition"
type="button"
on:click={() => {
params.template = (params?.template ?? null) === null ? '' : null;
}}
>
{#if (params?.template ?? null) === 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 (params?.template ?? null) !== null}
<div class="flex mt-0.5 space-x-2">
<div class=" flex-1">
<textarea
class="px-3 py-1.5 text-sm w-full bg-transparent border dark:border-gray-600 outline-none rounded-lg -mb-1"
placeholder="Write your model template content here"
rows="4"
bind:value={params.template}
/>
</div>
</div>
{/if}
</div>
2024-02-05 17:58:54 +08:00
</div>