|
@@ -5,21 +5,23 @@
|
|
|
|
|
|
const i18n = getContext('i18n');
|
|
|
|
|
|
+ export let admin = false;
|
|
|
+
|
|
|
export let params = {
|
|
|
// Advanced
|
|
|
- seed: 0,
|
|
|
+ seed: null,
|
|
|
stop: null,
|
|
|
- temperature: '',
|
|
|
- frequency_penalty: '',
|
|
|
- repeat_last_n: '',
|
|
|
- mirostat: '',
|
|
|
- mirostat_eta: '',
|
|
|
- mirostat_tau: '',
|
|
|
- top_k: '',
|
|
|
- top_p: '',
|
|
|
- tfs_z: '',
|
|
|
- num_ctx: '',
|
|
|
- max_tokens: '',
|
|
|
+ temperature: null,
|
|
|
+ frequency_penalty: null,
|
|
|
+ repeat_last_n: null,
|
|
|
+ mirostat: null,
|
|
|
+ mirostat_eta: null,
|
|
|
+ mirostat_tau: null,
|
|
|
+ top_k: null,
|
|
|
+ top_p: null,
|
|
|
+ tfs_z: null,
|
|
|
+ num_ctx: null,
|
|
|
+ max_tokens: null,
|
|
|
use_mmap: null,
|
|
|
use_mlock: null,
|
|
|
num_thread: null,
|
|
@@ -112,10 +114,10 @@
|
|
|
class="p-1 px-3 text-xs flex rounded transition"
|
|
|
type="button"
|
|
|
on:click={() => {
|
|
|
- params.temperature = (params?.temperature ?? '') === '' ? 0.8 : '';
|
|
|
+ params.temperature = (params?.temperature ?? null) === null ? 0.8 : null;
|
|
|
}}
|
|
|
>
|
|
|
- {#if (params?.temperature ?? '') === ''}
|
|
|
+ {#if (params?.temperature ?? null) === null}
|
|
|
<span class="ml-2 self-center"> {$i18n.t('Default')} </span>
|
|
|
{:else}
|
|
|
<span class="ml-2 self-center"> {$i18n.t('Custom')} </span>
|
|
@@ -123,7 +125,7 @@
|
|
|
</button>
|
|
|
</div>
|
|
|
|
|
|
- {#if (params?.temperature ?? '') !== ''}
|
|
|
+ {#if (params?.temperature ?? null) !== null}
|
|
|
<div class="flex mt-0.5 space-x-2">
|
|
|
<div class=" flex-1">
|
|
|
<input
|
|
@@ -157,10 +159,10 @@
|
|
|
class="p-1 px-3 text-xs flex rounded transition"
|
|
|
type="button"
|
|
|
on:click={() => {
|
|
|
- params.mirostat = (params?.mirostat ?? '') === '' ? 0 : '';
|
|
|
+ params.mirostat = (params?.mirostat ?? null) === null ? 0 : null;
|
|
|
}}
|
|
|
>
|
|
|
- {#if (params?.mirostat ?? '') === ''}
|
|
|
+ {#if (params?.mirostat ?? null) === null}
|
|
|
<span class="ml-2 self-center">{$i18n.t('Default')}</span>
|
|
|
{:else}
|
|
|
<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
|
|
@@ -168,7 +170,7 @@
|
|
|
</button>
|
|
|
</div>
|
|
|
|
|
|
- {#if (params?.mirostat ?? '') !== ''}
|
|
|
+ {#if (params?.mirostat ?? null) !== null}
|
|
|
<div class="flex mt-0.5 space-x-2">
|
|
|
<div class=" flex-1">
|
|
|
<input
|
|
@@ -203,10 +205,10 @@
|
|
|
class="p-1 px-3 text-xs flex rounded transition"
|
|
|
type="button"
|
|
|
on:click={() => {
|
|
|
- params.mirostat_eta = (params?.mirostat_eta ?? '') === '' ? 0.1 : '';
|
|
|
+ params.mirostat_eta = (params?.mirostat_eta ?? null) === null ? 0.1 : null;
|
|
|
}}
|
|
|
>
|
|
|
- {#if (params?.mirostat_eta ?? '') === ''}
|
|
|
+ {#if (params?.mirostat_eta ?? null) === null}
|
|
|
<span class="ml-2 self-center">{$i18n.t('Default')}</span>
|
|
|
{:else}
|
|
|
<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
|
|
@@ -214,7 +216,7 @@
|
|
|
</button>
|
|
|
</div>
|
|
|
|
|
|
- {#if (params?.mirostat_eta ?? '') !== ''}
|
|
|
+ {#if (params?.mirostat_eta ?? null) !== null}
|
|
|
<div class="flex mt-0.5 space-x-2">
|
|
|
<div class=" flex-1">
|
|
|
<input
|
|
@@ -248,10 +250,10 @@
|
|
|
class="p-1 px-3 text-xs flex rounded transition"
|
|
|
type="button"
|
|
|
on:click={() => {
|
|
|
- params.mirostat_tau = (params?.mirostat_tau ?? '') === '' ? 5.0 : '';
|
|
|
+ params.mirostat_tau = (params?.mirostat_tau ?? null) === null ? 5.0 : null;
|
|
|
}}
|
|
|
>
|
|
|
- {#if (params?.mirostat_tau ?? '') === ''}
|
|
|
+ {#if (params?.mirostat_tau ?? null) === null}
|
|
|
<span class="ml-2 self-center">{$i18n.t('Default')}</span>
|
|
|
{:else}
|
|
|
<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
|
|
@@ -259,7 +261,7 @@
|
|
|
</button>
|
|
|
</div>
|
|
|
|
|
|
- {#if (params?.mirostat_tau ?? '') !== ''}
|
|
|
+ {#if (params?.mirostat_tau ?? null) !== null}
|
|
|
<div class="flex mt-0.5 space-x-2">
|
|
|
<div class=" flex-1">
|
|
|
<input
|
|
@@ -293,10 +295,10 @@
|
|
|
class="p-1 px-3 text-xs flex rounded transition"
|
|
|
type="button"
|
|
|
on:click={() => {
|
|
|
- params.top_k = (params?.top_k ?? '') === '' ? 40 : '';
|
|
|
+ params.top_k = (params?.top_k ?? null) === null ? 40 : null;
|
|
|
}}
|
|
|
>
|
|
|
- {#if (params?.top_k ?? '') === ''}
|
|
|
+ {#if (params?.top_k ?? null) === null}
|
|
|
<span class="ml-2 self-center">{$i18n.t('Default')}</span>
|
|
|
{:else}
|
|
|
<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
|
|
@@ -304,7 +306,7 @@
|
|
|
</button>
|
|
|
</div>
|
|
|
|
|
|
- {#if (params?.top_k ?? '') !== ''}
|
|
|
+ {#if (params?.top_k ?? null) !== null}
|
|
|
<div class="flex mt-0.5 space-x-2">
|
|
|
<div class=" flex-1">
|
|
|
<input
|
|
@@ -338,10 +340,10 @@
|
|
|
class="p-1 px-3 text-xs flex rounded transition"
|
|
|
type="button"
|
|
|
on:click={() => {
|
|
|
- params.top_p = (params?.top_p ?? '') === '' ? 0.9 : '';
|
|
|
+ params.top_p = (params?.top_p ?? null) === null ? 0.9 : null;
|
|
|
}}
|
|
|
>
|
|
|
- {#if (params?.top_p ?? '') === ''}
|
|
|
+ {#if (params?.top_p ?? null) === null}
|
|
|
<span class="ml-2 self-center">{$i18n.t('Default')}</span>
|
|
|
{:else}
|
|
|
<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
|
|
@@ -349,7 +351,7 @@
|
|
|
</button>
|
|
|
</div>
|
|
|
|
|
|
- {#if (params?.top_p ?? '') !== ''}
|
|
|
+ {#if (params?.top_p ?? null) !== null}
|
|
|
<div class="flex mt-0.5 space-x-2">
|
|
|
<div class=" flex-1">
|
|
|
<input
|
|
@@ -383,10 +385,10 @@
|
|
|
class="p-1 px-3 text-xs flex rounded transition"
|
|
|
type="button"
|
|
|
on:click={() => {
|
|
|
- params.frequency_penalty = (params?.frequency_penalty ?? '') === '' ? 1.1 : '';
|
|
|
+ params.frequency_penalty = (params?.frequency_penalty ?? null) === null ? 1.1 : null;
|
|
|
}}
|
|
|
>
|
|
|
- {#if (params?.frequency_penalty ?? '') === ''}
|
|
|
+ {#if (params?.frequency_penalty ?? null) === null}
|
|
|
<span class="ml-2 self-center">{$i18n.t('Default')}</span>
|
|
|
{:else}
|
|
|
<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
|
|
@@ -394,7 +396,7 @@
|
|
|
</button>
|
|
|
</div>
|
|
|
|
|
|
- {#if (params?.frequency_penalty ?? '') !== ''}
|
|
|
+ {#if (params?.frequency_penalty ?? null) !== null}
|
|
|
<div class="flex mt-0.5 space-x-2">
|
|
|
<div class=" flex-1">
|
|
|
<input
|
|
@@ -428,10 +430,10 @@
|
|
|
class="p-1 px-3 text-xs flex rounded transition"
|
|
|
type="button"
|
|
|
on:click={() => {
|
|
|
- params.repeat_last_n = (params?.repeat_last_n ?? '') === '' ? 64 : '';
|
|
|
+ params.repeat_last_n = (params?.repeat_last_n ?? null) === null ? 64 : null;
|
|
|
}}
|
|
|
>
|
|
|
- {#if (params?.repeat_last_n ?? '') === ''}
|
|
|
+ {#if (params?.repeat_last_n ?? null) === null}
|
|
|
<span class="ml-2 self-center">{$i18n.t('Default')}</span>
|
|
|
{:else}
|
|
|
<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
|
|
@@ -439,7 +441,7 @@
|
|
|
</button>
|
|
|
</div>
|
|
|
|
|
|
- {#if (params?.repeat_last_n ?? '') !== ''}
|
|
|
+ {#if (params?.repeat_last_n ?? null) !== null}
|
|
|
<div class="flex mt-0.5 space-x-2">
|
|
|
<div class=" flex-1">
|
|
|
<input
|
|
@@ -474,10 +476,10 @@
|
|
|
class="p-1 px-3 text-xs flex rounded transition"
|
|
|
type="button"
|
|
|
on:click={() => {
|
|
|
- params.tfs_z = (params?.tfs_z ?? '') === '' ? 1 : '';
|
|
|
+ params.tfs_z = (params?.tfs_z ?? null) === null ? 1 : null;
|
|
|
}}
|
|
|
>
|
|
|
- {#if (params?.tfs_z ?? '') === ''}
|
|
|
+ {#if (params?.tfs_z ?? null) === null}
|
|
|
<span class="ml-2 self-center">{$i18n.t('Default')}</span>
|
|
|
{:else}
|
|
|
<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
|
|
@@ -485,7 +487,7 @@
|
|
|
</button>
|
|
|
</div>
|
|
|
|
|
|
- {#if (params?.tfs_z ?? '') !== ''}
|
|
|
+ {#if (params?.tfs_z ?? null) !== null}
|
|
|
<div class="flex mt-0.5 space-x-2">
|
|
|
<div class=" flex-1">
|
|
|
<input
|
|
@@ -519,10 +521,10 @@
|
|
|
class="p-1 px-3 text-xs flex rounded transition"
|
|
|
type="button"
|
|
|
on:click={() => {
|
|
|
- params.num_ctx = (params?.num_ctx ?? '') === '' ? 2048 : '';
|
|
|
+ params.num_ctx = (params?.num_ctx ?? null) === null ? 2048 : null;
|
|
|
}}
|
|
|
>
|
|
|
- {#if (params?.num_ctx ?? '') === ''}
|
|
|
+ {#if (params?.num_ctx ?? null) === null}
|
|
|
<span class="ml-2 self-center">{$i18n.t('Default')}</span>
|
|
|
{:else}
|
|
|
<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
|
|
@@ -530,7 +532,7 @@
|
|
|
</button>
|
|
|
</div>
|
|
|
|
|
|
- {#if (params?.num_ctx ?? '') !== ''}
|
|
|
+ {#if (params?.num_ctx ?? null) !== null}
|
|
|
<div class="flex mt-0.5 space-x-2">
|
|
|
<div class=" flex-1">
|
|
|
<input
|
|
@@ -564,10 +566,10 @@
|
|
|
class="p-1 px-3 text-xs flex rounded transition"
|
|
|
type="button"
|
|
|
on:click={() => {
|
|
|
- params.max_tokens = (params?.max_tokens ?? '') === '' ? 128 : '';
|
|
|
+ params.max_tokens = (params?.max_tokens ?? null) === null ? 128 : null;
|
|
|
}}
|
|
|
>
|
|
|
- {#if (params?.max_tokens ?? '') === ''}
|
|
|
+ {#if (params?.max_tokens ?? null) === null}
|
|
|
<span class="ml-2 self-center">{$i18n.t('Default')}</span>
|
|
|
{:else}
|
|
|
<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
|
|
@@ -575,7 +577,7 @@
|
|
|
</button>
|
|
|
</div>
|
|
|
|
|
|
- {#if (params?.max_tokens ?? '') !== ''}
|
|
|
+ {#if (params?.max_tokens ?? null) !== null}
|
|
|
<div class="flex mt-0.5 space-x-2">
|
|
|
<div class=" flex-1">
|
|
|
<input
|
|
@@ -602,122 +604,124 @@
|
|
|
{/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>
|
|
|
+ {#if admin}
|
|
|
+ <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>
|
|
|
|
|
|
- <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 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>
|
|
|
|
|
|
- <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>
|
|
|
+ <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>
|
|
|
|
|
|
- <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>
|
|
|
+ {#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>
|
|
|
|
|
|
- {#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 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}
|
|
|
- </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('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}
|
|
|
- />
|
|
|
+ {#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>
|
|
|
- </div>
|
|
|
- {/if}
|
|
|
- </div>
|
|
|
+ {/if}
|
|
|
+ </div> -->
|
|
|
+ {/if}
|
|
|
</div>
|