AdvancedParams.svelte 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402
  1. <script lang="ts">
  2. import Switch from '$lib/components/common/Switch.svelte';
  3. import Tooltip from '$lib/components/common/Tooltip.svelte';
  4. import { getContext, createEventDispatcher } from 'svelte';
  5. const dispatch = createEventDispatcher();
  6. const i18n = getContext('i18n');
  7. export let admin = false;
  8. export let params = {
  9. // Advanced
  10. stream_response: null, // Set stream responses for this model individually
  11. function_calling: null,
  12. seed: null,
  13. stop: null,
  14. temperature: null,
  15. reasoning_effort: null,
  16. logit_bias: null,
  17. frequency_penalty: null,
  18. repeat_last_n: null,
  19. mirostat: null,
  20. mirostat_eta: null,
  21. mirostat_tau: null,
  22. top_k: null,
  23. top_p: null,
  24. min_p: null,
  25. tfs_z: null,
  26. num_ctx: null,
  27. num_batch: null,
  28. num_keep: null,
  29. max_tokens: null,
  30. use_mmap: null,
  31. use_mlock: null,
  32. num_thread: null,
  33. num_gpu: null,
  34. template: null
  35. };
  36. let customFieldName = '';
  37. let customFieldValue = '';
  38. $: if (params) {
  39. dispatch('change', params);
  40. }
  41. </script>
  42. <div class=" space-y-1 text-xs pb-safe-bottom">
  43. <div>
  44. <Tooltip
  45. content={$i18n.t(
  46. 'When enabled, the model will respond to each chat message in real-time, generating a response as soon as the user sends a message. This mode is useful for live chat applications, but may impact performance on slower hardware.'
  47. )}
  48. placement="top-start"
  49. className="inline-tooltip"
  50. >
  51. <div class=" py-0.5 flex w-full justify-between">
  52. <div class=" self-center text-xs font-medium">
  53. {$i18n.t('Stream Chat Response')}
  54. </div>
  55. <button
  56. class="p-1 px-3 text-xs flex rounded-sm transition"
  57. on:click={() => {
  58. params.stream_response =
  59. (params?.stream_response ?? null) === null
  60. ? true
  61. : params.stream_response
  62. ? false
  63. : null;
  64. }}
  65. type="button"
  66. >
  67. {#if params.stream_response === true}
  68. <span class="ml-2 self-center">{$i18n.t('On')}</span>
  69. {:else if params.stream_response === false}
  70. <span class="ml-2 self-center">{$i18n.t('Off')}</span>
  71. {:else}
  72. <span class="ml-2 self-center">{$i18n.t('Default')}</span>
  73. {/if}
  74. </button>
  75. </div>
  76. </Tooltip>
  77. </div>
  78. <div>
  79. <Tooltip
  80. content={$i18n.t(
  81. 'Default mode works with a wider range of models by calling tools once before execution. Native mode leverages the model’s built-in tool-calling capabilities, but requires the model to inherently support this feature.'
  82. )}
  83. placement="top-start"
  84. className="inline-tooltip"
  85. >
  86. <div class=" py-0.5 flex w-full justify-between">
  87. <div class=" self-center text-xs font-medium">
  88. {$i18n.t('Function Calling')}
  89. </div>
  90. <button
  91. class="p-1 px-3 text-xs flex rounded-sm transition"
  92. on:click={() => {
  93. params.function_calling = (params?.function_calling ?? null) === null ? 'native' : null;
  94. }}
  95. type="button"
  96. >
  97. {#if params.function_calling === 'native'}
  98. <span class="ml-2 self-center">{$i18n.t('Native')}</span>
  99. {:else}
  100. <span class="ml-2 self-center">{$i18n.t('Default')}</span>
  101. {/if}
  102. </button>
  103. </div>
  104. </Tooltip>
  105. </div>
  106. <div class=" py-0.5 w-full justify-between">
  107. <Tooltip
  108. content={$i18n.t(
  109. 'Sets the random number seed to use for generation. Setting this to a specific number will make the model generate the same text for the same prompt.'
  110. )}
  111. placement="top-start"
  112. className="inline-tooltip"
  113. >
  114. <div class="flex w-full justify-between">
  115. <div class=" self-center text-xs font-medium">
  116. {$i18n.t('Seed')}
  117. </div>
  118. <button
  119. class="p-1 px-3 text-xs flex rounded-sm transition shrink-0 outline-hidden"
  120. type="button"
  121. on:click={() => {
  122. params.seed = (params?.seed ?? null) === null ? 0 : null;
  123. }}
  124. >
  125. {#if (params?.seed ?? null) === null}
  126. <span class="ml-2 self-center"> {$i18n.t('Default')} </span>
  127. {:else}
  128. <span class="ml-2 self-center"> {$i18n.t('Custom')} </span>
  129. {/if}
  130. </button>
  131. </div>
  132. </Tooltip>
  133. {#if (params?.seed ?? null) !== null}
  134. <div class="flex mt-0.5 space-x-2">
  135. <div class=" flex-1">
  136. <input
  137. class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-hidden"
  138. type="number"
  139. placeholder={$i18n.t('Enter Seed')}
  140. bind:value={params.seed}
  141. autocomplete="off"
  142. min="0"
  143. />
  144. </div>
  145. </div>
  146. {/if}
  147. </div>
  148. <div class=" py-0.5 w-full justify-between">
  149. <Tooltip
  150. content={$i18n.t(
  151. 'Sets the stop sequences to use. When this pattern is encountered, the LLM will stop generating text and return. Multiple stop patterns may be set by specifying multiple separate stop parameters in a modelfile.'
  152. )}
  153. placement="top-start"
  154. className="inline-tooltip"
  155. >
  156. <div class="flex w-full justify-between">
  157. <div class=" self-center text-xs font-medium">
  158. {$i18n.t('Stop Sequence')}
  159. </div>
  160. <button
  161. class="p-1 px-3 text-xs flex rounded-sm transition shrink-0 outline-hidden"
  162. type="button"
  163. on:click={() => {
  164. params.stop = (params?.stop ?? null) === null ? '' : null;
  165. }}
  166. >
  167. {#if (params?.stop ?? null) === null}
  168. <span class="ml-2 self-center"> {$i18n.t('Default')} </span>
  169. {:else}
  170. <span class="ml-2 self-center"> {$i18n.t('Custom')} </span>
  171. {/if}
  172. </button>
  173. </div>
  174. </Tooltip>
  175. {#if (params?.stop ?? null) !== null}
  176. <div class="flex mt-0.5 space-x-2">
  177. <div class=" flex-1">
  178. <input
  179. class="w-full rounded-lg py-2 px-1 text-sm dark:text-gray-300 dark:bg-gray-850 outline-hidden"
  180. type="text"
  181. placeholder={$i18n.t('Enter stop sequence')}
  182. bind:value={params.stop}
  183. autocomplete="off"
  184. />
  185. </div>
  186. </div>
  187. {/if}
  188. </div>
  189. <div class=" py-0.5 w-full justify-between">
  190. <Tooltip
  191. content={$i18n.t(
  192. 'The temperature of the model. Increasing the temperature will make the model answer more creatively.'
  193. )}
  194. placement="top-start"
  195. className="inline-tooltip"
  196. >
  197. <div class="flex w-full justify-between">
  198. <div class=" self-center text-xs font-medium">
  199. {$i18n.t('Temperature')}
  200. </div>
  201. <button
  202. class="p-1 px-3 text-xs flex rounded-sm transition shrink-0 outline-hidden"
  203. type="button"
  204. on:click={() => {
  205. params.temperature = (params?.temperature ?? null) === null ? 0.8 : null;
  206. }}
  207. >
  208. {#if (params?.temperature ?? null) === null}
  209. <span class="ml-2 self-center"> {$i18n.t('Default')} </span>
  210. {:else}
  211. <span class="ml-2 self-center"> {$i18n.t('Custom')} </span>
  212. {/if}
  213. </button>
  214. </div>
  215. </Tooltip>
  216. {#if (params?.temperature ?? null) !== null}
  217. <div class="flex mt-0.5 space-x-2">
  218. <div class=" flex-1">
  219. <input
  220. id="steps-range"
  221. type="range"
  222. min="0"
  223. max="2"
  224. step="0.05"
  225. bind:value={params.temperature}
  226. class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
  227. />
  228. </div>
  229. <div>
  230. <input
  231. bind:value={params.temperature}
  232. type="number"
  233. class=" bg-transparent text-center w-14"
  234. min="0"
  235. max="2"
  236. step="any"
  237. />
  238. </div>
  239. </div>
  240. {/if}
  241. </div>
  242. <div class=" py-0.5 w-full justify-between">
  243. <Tooltip
  244. content={$i18n.t(
  245. 'Constrains effort on reasoning for reasoning models. Only applicable to reasoning models from specific providers that support reasoning effort.'
  246. )}
  247. placement="top-start"
  248. className="inline-tooltip"
  249. >
  250. <div class="flex w-full justify-between">
  251. <div class=" self-center text-xs font-medium">
  252. {$i18n.t('Reasoning Effort')}
  253. </div>
  254. <button
  255. class="p-1 px-3 text-xs flex rounded-sm transition shrink-0 outline-hidden"
  256. type="button"
  257. on:click={() => {
  258. params.reasoning_effort = (params?.reasoning_effort ?? null) === null ? 'medium' : null;
  259. }}
  260. >
  261. {#if (params?.reasoning_effort ?? null) === null}
  262. <span class="ml-2 self-center"> {$i18n.t('Default')} </span>
  263. {:else}
  264. <span class="ml-2 self-center"> {$i18n.t('Custom')} </span>
  265. {/if}
  266. </button>
  267. </div>
  268. </Tooltip>
  269. {#if (params?.reasoning_effort ?? null) !== null}
  270. <div class="flex mt-0.5 space-x-2">
  271. <div class=" flex-1">
  272. <input
  273. class="w-full rounded-lg py-2 px-1 text-sm dark:text-gray-300 dark:bg-gray-850 outline-hidden"
  274. type="text"
  275. placeholder={$i18n.t('Enter reasoning effort')}
  276. bind:value={params.reasoning_effort}
  277. autocomplete="off"
  278. />
  279. </div>
  280. </div>
  281. {/if}
  282. </div>
  283. <div class=" py-0.5 w-full justify-between">
  284. <Tooltip
  285. content={$i18n.t(
  286. 'Boosting or penalizing specific tokens for constrained responses. Bias values will be clamped between -100 and 100 (inclusive). (Default: none)'
  287. )}
  288. placement="top-start"
  289. className="inline-tooltip"
  290. >
  291. <div class="flex w-full justify-between">
  292. <div class=" self-center text-xs font-medium">
  293. {$i18n.t('Logit Bias')}
  294. </div>
  295. <button
  296. class="p-1 px-3 text-xs flex rounded-sm transition shrink-0 outline-hidden"
  297. type="button"
  298. on:click={() => {
  299. params.logit_bias = (params?.logit_bias ?? null) === null ? '' : null;
  300. }}
  301. >
  302. {#if (params?.logit_bias ?? null) === null}
  303. <span class="ml-2 self-center"> {$i18n.t('Default')} </span>
  304. {:else}
  305. <span class="ml-2 self-center"> {$i18n.t('Custom')} </span>
  306. {/if}
  307. </button>
  308. </div>
  309. </Tooltip>
  310. {#if (params?.logit_bias ?? null) !== null}
  311. <div class="flex mt-0.5 space-x-2">
  312. <div class=" flex-1">
  313. <input
  314. class="w-full rounded-lg pl-2 py-2 px-1 text-sm dark:text-gray-300 dark:bg-gray-850 outline-hidden"
  315. type="text"
  316. placeholder={$i18n.t(
  317. 'Enter comma-separated "token:bias_value" pairs (example: 5432:100, 413:-100)'
  318. )}
  319. bind:value={params.logit_bias}
  320. autocomplete="off"
  321. />
  322. </div>
  323. </div>
  324. {/if}
  325. </div>
  326. <div class=" py-0.5 w-full justify-between">
  327. <Tooltip
  328. content={$i18n.t('Enable Mirostat sampling for controlling perplexity.')}
  329. placement="top-start"
  330. className="inline-tooltip"
  331. >
  332. <div class="flex w-full justify-between">
  333. <div class=" self-center text-xs font-medium">
  334. {$i18n.t('Mirostat')}
  335. </div>
  336. <button
  337. class="p-1 px-3 text-xs flex rounded-sm transition shrink-0 outline-hidden"
  338. type="button"
  339. on:click={() => {
  340. params.mirostat = (params?.mirostat ?? null) === null ? 0 : null;
  341. }}
  342. >
  343. {#if (params?.mirostat ?? null) === null}
  344. <span class="ml-2 self-center">{$i18n.t('Default')}</span>
  345. {:else}
  346. <span class="ml-2 self-center">{$i18n.t('Custom')}</span>
  347. {/if}
  348. </button>
  349. </div>
  350. </Tooltip>
  351. {#if (params?.mirostat ?? null) !== null}
  352. <div class="flex mt-0.5 space-x-2">
  353. <div class=" flex-1">
  354. <input
  355. id="steps-range"
  356. type="range"
  357. min="0"
  358. max="2"
  359. step="1"
  360. bind:value={params.mirostat}
  361. class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
  362. />
  363. </div>
  364. <div>
  365. <input
  366. bind:value={params.mirostat}
  367. type="number"
  368. class=" bg-transparent text-center w-14"
  369. min="0"
  370. max="2"
  371. step="1"
  372. />
  373. </div>
  374. </div>
  375. {/if}
  376. </div>
  377. <div class=" py-0.5 w-full justify-between">
  378. <Tooltip
  379. content={$i18n.t(
  380. 'Influences how quickly the algorithm responds to feedback from the generated text. A lower learning rate will result in slower adjustments, while a higher learning rate will make the algorithm more responsive.'
  381. )}
  382. placement="top-start"
  383. className="inline-tooltip"
  384. >
  385. <div class="flex w-full justify-between">
  386. <div class=" self-center text-xs font-medium">
  387. {$i18n.t('Mirostat Eta')}
  388. </div>
  389. <button
  390. class="p-1 px-3 text-xs flex rounded-sm transition shrink-0 outline-hidden"
  391. type="button"
  392. on:click={() => {
  393. params.mirostat_eta = (params?.mirostat_eta ?? null) === null ? 0.1 : null;
  394. }}
  395. >
  396. {#if (params?.mirostat_eta ?? null) === null}
  397. <span class="ml-2 self-center">{$i18n.t('Default')}</span>
  398. {:else}
  399. <span class="ml-2 self-center">{$i18n.t('Custom')}</span>
  400. {/if}
  401. </button>
  402. </div>
  403. </Tooltip>
  404. {#if (params?.mirostat_eta ?? null) !== null}
  405. <div class="flex mt-0.5 space-x-2">
  406. <div class=" flex-1">
  407. <input
  408. id="steps-range"
  409. type="range"
  410. min="0"
  411. max="1"
  412. step="0.05"
  413. bind:value={params.mirostat_eta}
  414. class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
  415. />
  416. </div>
  417. <div>
  418. <input
  419. bind:value={params.mirostat_eta}
  420. type="number"
  421. class=" bg-transparent text-center w-14"
  422. min="0"
  423. max="1"
  424. step="any"
  425. />
  426. </div>
  427. </div>
  428. {/if}
  429. </div>
  430. <div class=" py-0.5 w-full justify-between">
  431. <Tooltip
  432. content={$i18n.t(
  433. 'Controls the balance between coherence and diversity of the output. A lower value will result in more focused and coherent text.'
  434. )}
  435. placement="top-start"
  436. className="inline-tooltip"
  437. >
  438. <div class="flex w-full justify-between">
  439. <div class=" self-center text-xs font-medium">
  440. {$i18n.t('Mirostat Tau')}
  441. </div>
  442. <button
  443. class="p-1 px-3 text-xs flex rounded-sm transition shrink-0 outline-hidden"
  444. type="button"
  445. on:click={() => {
  446. params.mirostat_tau = (params?.mirostat_tau ?? null) === null ? 5.0 : null;
  447. }}
  448. >
  449. {#if (params?.mirostat_tau ?? null) === null}
  450. <span class="ml-2 self-center">{$i18n.t('Default')}</span>
  451. {:else}
  452. <span class="ml-2 self-center">{$i18n.t('Custom')}</span>
  453. {/if}
  454. </button>
  455. </div>
  456. </Tooltip>
  457. {#if (params?.mirostat_tau ?? null) !== null}
  458. <div class="flex mt-0.5 space-x-2">
  459. <div class=" flex-1">
  460. <input
  461. id="steps-range"
  462. type="range"
  463. min="0"
  464. max="10"
  465. step="0.5"
  466. bind:value={params.mirostat_tau}
  467. class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
  468. />
  469. </div>
  470. <div>
  471. <input
  472. bind:value={params.mirostat_tau}
  473. type="number"
  474. class=" bg-transparent text-center w-14"
  475. min="0"
  476. max="10"
  477. step="any"
  478. />
  479. </div>
  480. </div>
  481. {/if}
  482. </div>
  483. <div class=" py-0.5 w-full justify-between">
  484. <Tooltip
  485. content={$i18n.t(
  486. 'Reduces the probability of generating nonsense. A higher value (e.g. 100) will give more diverse answers, while a lower value (e.g. 10) will be more conservative.'
  487. )}
  488. placement="top-start"
  489. className="inline-tooltip"
  490. >
  491. <div class="flex w-full justify-between">
  492. <div class=" self-center text-xs font-medium">
  493. {$i18n.t('Top K')}
  494. </div>
  495. <button
  496. class="p-1 px-3 text-xs flex rounded-sm transition shrink-0 outline-hidden"
  497. type="button"
  498. on:click={() => {
  499. params.top_k = (params?.top_k ?? null) === null ? 40 : null;
  500. }}
  501. >
  502. {#if (params?.top_k ?? null) === null}
  503. <span class="ml-2 self-center">{$i18n.t('Default')}</span>
  504. {:else}
  505. <span class="ml-2 self-center">{$i18n.t('Custom')}</span>
  506. {/if}
  507. </button>
  508. </div>
  509. </Tooltip>
  510. {#if (params?.top_k ?? null) !== null}
  511. <div class="flex mt-0.5 space-x-2">
  512. <div class=" flex-1">
  513. <input
  514. id="steps-range"
  515. type="range"
  516. min="0"
  517. max="1000"
  518. step="0.5"
  519. bind:value={params.top_k}
  520. class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
  521. />
  522. </div>
  523. <div>
  524. <input
  525. bind:value={params.top_k}
  526. type="number"
  527. class=" bg-transparent text-center w-14"
  528. min="0"
  529. max="100"
  530. step="any"
  531. />
  532. </div>
  533. </div>
  534. {/if}
  535. </div>
  536. <div class=" py-0.5 w-full justify-between">
  537. <Tooltip
  538. content={$i18n.t(
  539. 'Works together with top-k. A higher value (e.g., 0.95) will lead to more diverse text, while a lower value (e.g., 0.5) will generate more focused and conservative text.'
  540. )}
  541. placement="top-start"
  542. className="inline-tooltip"
  543. >
  544. <div class="flex w-full justify-between">
  545. <div class=" self-center text-xs font-medium">
  546. {$i18n.t('Top P')}
  547. </div>
  548. <button
  549. class="p-1 px-3 text-xs flex rounded-sm transition shrink-0 outline-hidden"
  550. type="button"
  551. on:click={() => {
  552. params.top_p = (params?.top_p ?? null) === null ? 0.9 : null;
  553. }}
  554. >
  555. {#if (params?.top_p ?? null) === null}
  556. <span class="ml-2 self-center">{$i18n.t('Default')}</span>
  557. {:else}
  558. <span class="ml-2 self-center">{$i18n.t('Custom')}</span>
  559. {/if}
  560. </button>
  561. </div>
  562. </Tooltip>
  563. {#if (params?.top_p ?? null) !== null}
  564. <div class="flex mt-0.5 space-x-2">
  565. <div class=" flex-1">
  566. <input
  567. id="steps-range"
  568. type="range"
  569. min="0"
  570. max="1"
  571. step="0.05"
  572. bind:value={params.top_p}
  573. class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
  574. />
  575. </div>
  576. <div>
  577. <input
  578. bind:value={params.top_p}
  579. type="number"
  580. class=" bg-transparent text-center w-14"
  581. min="0"
  582. max="1"
  583. step="any"
  584. />
  585. </div>
  586. </div>
  587. {/if}
  588. </div>
  589. <div class=" py-0.5 w-full justify-between">
  590. <Tooltip
  591. content={$i18n.t(
  592. 'Alternative to the top_p, and aims to ensure a balance of quality and variety. The parameter p represents the minimum probability for a token to be considered, relative to the probability of the most likely token. For example, with p=0.05 and the most likely token having a probability of 0.9, logits with a value less than 0.045 are filtered out.'
  593. )}
  594. placement="top-start"
  595. className="inline-tooltip"
  596. >
  597. <div class="flex w-full justify-between">
  598. <div class=" self-center text-xs font-medium">
  599. {$i18n.t('Min P')}
  600. </div>
  601. <button
  602. class="p-1 px-3 text-xs flex rounded-sm transition shrink-0 outline-hidden"
  603. type="button"
  604. on:click={() => {
  605. params.min_p = (params?.min_p ?? null) === null ? 0.0 : null;
  606. }}
  607. >
  608. {#if (params?.min_p ?? null) === null}
  609. <span class="ml-2 self-center">{$i18n.t('Default')}</span>
  610. {:else}
  611. <span class="ml-2 self-center">{$i18n.t('Custom')}</span>
  612. {/if}
  613. </button>
  614. </div>
  615. </Tooltip>
  616. {#if (params?.min_p ?? null) !== null}
  617. <div class="flex mt-0.5 space-x-2">
  618. <div class=" flex-1">
  619. <input
  620. id="steps-range"
  621. type="range"
  622. min="0"
  623. max="1"
  624. step="0.05"
  625. bind:value={params.min_p}
  626. class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
  627. />
  628. </div>
  629. <div>
  630. <input
  631. bind:value={params.min_p}
  632. type="number"
  633. class=" bg-transparent text-center w-14"
  634. min="0"
  635. max="1"
  636. step="any"
  637. />
  638. </div>
  639. </div>
  640. {/if}
  641. </div>
  642. <div class=" py-0.5 w-full justify-between">
  643. <Tooltip
  644. content={$i18n.t(
  645. 'Sets a scaling bias against tokens to penalize repetitions, based on how many times they have appeared. A higher value (e.g., 1.5) will penalize repetitions more strongly, while a lower value (e.g., 0.9) will be more lenient. At 0, it is disabled.'
  646. )}
  647. placement="top-start"
  648. className="inline-tooltip"
  649. >
  650. <div class="flex w-full justify-between">
  651. <div class=" self-center text-xs font-medium">
  652. {$i18n.t('Frequency Penalty')}
  653. </div>
  654. <button
  655. class="p-1 px-3 text-xs flex rounded-sm transition shrink-0 outline-hidden"
  656. type="button"
  657. on:click={() => {
  658. params.frequency_penalty = (params?.frequency_penalty ?? null) === null ? 1.1 : null;
  659. }}
  660. >
  661. {#if (params?.frequency_penalty ?? null) === null}
  662. <span class="ml-2 self-center">{$i18n.t('Default')}</span>
  663. {:else}
  664. <span class="ml-2 self-center">{$i18n.t('Custom')}</span>
  665. {/if}
  666. </button>
  667. </div>
  668. </Tooltip>
  669. {#if (params?.frequency_penalty ?? null) !== null}
  670. <div class="flex mt-0.5 space-x-2">
  671. <div class=" flex-1">
  672. <input
  673. id="steps-range"
  674. type="range"
  675. min="-2"
  676. max="2"
  677. step="0.05"
  678. bind:value={params.frequency_penalty}
  679. class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
  680. />
  681. </div>
  682. <div>
  683. <input
  684. bind:value={params.frequency_penalty}
  685. type="number"
  686. class=" bg-transparent text-center w-14"
  687. min="-2"
  688. max="2"
  689. step="any"
  690. />
  691. </div>
  692. </div>
  693. {/if}
  694. </div>
  695. <div class=" py-0.5 w-full justify-between">
  696. <Tooltip
  697. content={$i18n.t(
  698. 'Sets a flat bias against tokens that have appeared at least once. A higher value (e.g., 1.5) will penalize repetitions more strongly, while a lower value (e.g., 0.9) will be more lenient. At 0, it is disabled.'
  699. )}
  700. placement="top-start"
  701. className="inline-tooltip"
  702. >
  703. <div class="flex w-full justify-between">
  704. <div class=" self-center text-xs font-medium">
  705. {$i18n.t('Presence Penalty')}
  706. </div>
  707. <button
  708. class="p-1 px-3 text-xs flex rounded transition flex-shrink-0 outline-none"
  709. type="button"
  710. on:click={() => {
  711. params.presence_penalty = (params?.presence_penalty ?? null) === null ? 0.0 : null;
  712. }}
  713. >
  714. {#if (params?.presence_penalty ?? null) === null}
  715. <span class="ml-2 self-center">{$i18n.t('Default')}</span>
  716. {:else}
  717. <span class="ml-2 self-center">{$i18n.t('Custom')}</span>
  718. {/if}
  719. </button>
  720. </div>
  721. </Tooltip>
  722. {#if (params?.presence_penalty ?? null) !== null}
  723. <div class="flex mt-0.5 space-x-2">
  724. <div class=" flex-1">
  725. <input
  726. id="steps-range"
  727. type="range"
  728. min="-2"
  729. max="2"
  730. step="0.05"
  731. bind:value={params.presence_penalty}
  732. class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
  733. />
  734. </div>
  735. <div>
  736. <input
  737. bind:value={params.presence_penalty}
  738. type="number"
  739. class=" bg-transparent text-center w-14"
  740. min="-2"
  741. max="2"
  742. step="any"
  743. />
  744. </div>
  745. </div>
  746. {/if}
  747. </div>
  748. <div class=" py-0.5 w-full justify-between">
  749. <Tooltip
  750. content={$i18n.t('Sets how far back for the model to look back to prevent repetition.')}
  751. placement="top-start"
  752. className="inline-tooltip"
  753. >
  754. <div class="flex w-full justify-between">
  755. <div class=" self-center text-xs font-medium">
  756. {$i18n.t('Repeat Last N')}
  757. </div>
  758. <button
  759. class="p-1 px-3 text-xs flex rounded-sm transition shrink-0 outline-hidden"
  760. type="button"
  761. on:click={() => {
  762. params.repeat_last_n = (params?.repeat_last_n ?? null) === null ? 64 : null;
  763. }}
  764. >
  765. {#if (params?.repeat_last_n ?? null) === null}
  766. <span class="ml-2 self-center">{$i18n.t('Default')}</span>
  767. {:else}
  768. <span class="ml-2 self-center">{$i18n.t('Custom')}</span>
  769. {/if}
  770. </button>
  771. </div>
  772. </Tooltip>
  773. {#if (params?.repeat_last_n ?? null) !== null}
  774. <div class="flex mt-0.5 space-x-2">
  775. <div class=" flex-1">
  776. <input
  777. id="steps-range"
  778. type="range"
  779. min="-1"
  780. max="128"
  781. step="1"
  782. bind:value={params.repeat_last_n}
  783. class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
  784. />
  785. </div>
  786. <div>
  787. <input
  788. bind:value={params.repeat_last_n}
  789. type="number"
  790. class=" bg-transparent text-center w-14"
  791. min="-1"
  792. max="128"
  793. step="1"
  794. />
  795. </div>
  796. </div>
  797. {/if}
  798. </div>
  799. <div class=" py-0.5 w-full justify-between">
  800. <Tooltip
  801. content={$i18n.t(
  802. 'Tail free sampling is used to reduce the impact of less probable tokens from the output. A higher value (e.g., 2.0) will reduce the impact more, while a value of 1.0 disables this setting.'
  803. )}
  804. placement="top-start"
  805. className="inline-tooltip"
  806. >
  807. <div class="flex w-full justify-between">
  808. <div class=" self-center text-xs font-medium">
  809. {$i18n.t('Tfs Z')}
  810. </div>
  811. <button
  812. class="p-1 px-3 text-xs flex rounded-sm transition shrink-0 outline-hidden"
  813. type="button"
  814. on:click={() => {
  815. params.tfs_z = (params?.tfs_z ?? null) === null ? 1 : null;
  816. }}
  817. >
  818. {#if (params?.tfs_z ?? null) === null}
  819. <span class="ml-2 self-center">{$i18n.t('Default')}</span>
  820. {:else}
  821. <span class="ml-2 self-center">{$i18n.t('Custom')}</span>
  822. {/if}
  823. </button>
  824. </div>
  825. </Tooltip>
  826. {#if (params?.tfs_z ?? null) !== null}
  827. <div class="flex mt-0.5 space-x-2">
  828. <div class=" flex-1">
  829. <input
  830. id="steps-range"
  831. type="range"
  832. min="0"
  833. max="2"
  834. step="0.05"
  835. bind:value={params.tfs_z}
  836. class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
  837. />
  838. </div>
  839. <div>
  840. <input
  841. bind:value={params.tfs_z}
  842. type="number"
  843. class=" bg-transparent text-center w-14"
  844. min="0"
  845. max="2"
  846. step="any"
  847. />
  848. </div>
  849. </div>
  850. {/if}
  851. </div>
  852. <div class=" py-0.5 w-full justify-between">
  853. <Tooltip
  854. content={$i18n.t(
  855. 'This option controls how many tokens are preserved when refreshing the context. For example, if set to 2, the last 2 tokens of the conversation context will be retained. Preserving context can help maintain the continuity of a conversation, but it may reduce the ability to respond to new topics.'
  856. )}
  857. placement="top-start"
  858. className="inline-tooltip"
  859. >
  860. <div class="flex w-full justify-between">
  861. <div class=" self-center text-xs font-medium">
  862. {$i18n.t('Tokens To Keep On Context Refresh (num_keep)')}
  863. </div>
  864. <button
  865. class="p-1 px-3 text-xs flex rounded-sm transition shrink-0 outline-hidden"
  866. type="button"
  867. on:click={() => {
  868. params.num_keep = (params?.num_keep ?? null) === null ? 24 : null;
  869. }}
  870. >
  871. {#if (params?.num_keep ?? null) === null}
  872. <span class="ml-2 self-center">{$i18n.t('Default')}</span>
  873. {:else}
  874. <span class="ml-2 self-center">{$i18n.t('Custom')}</span>
  875. {/if}
  876. </button>
  877. </div>
  878. </Tooltip>
  879. {#if (params?.num_keep ?? null) !== null}
  880. <div class="flex mt-0.5 space-x-2">
  881. <div class=" flex-1">
  882. <input
  883. id="steps-range"
  884. type="range"
  885. min="-1"
  886. max="10240000"
  887. step="1"
  888. bind:value={params.num_keep}
  889. class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
  890. />
  891. </div>
  892. <div class="">
  893. <input
  894. bind:value={params.num_keep}
  895. type="number"
  896. class=" bg-transparent text-center w-14"
  897. min="-1"
  898. step="1"
  899. />
  900. </div>
  901. </div>
  902. {/if}
  903. </div>
  904. <div class=" py-0.5 w-full justify-between">
  905. <Tooltip
  906. content={$i18n.t(
  907. 'This option sets the maximum number of tokens the model can generate in its response. Increasing this limit allows the model to provide longer answers, but it may also increase the likelihood of unhelpful or irrelevant content being generated.'
  908. )}
  909. placement="top-start"
  910. className="inline-tooltip"
  911. >
  912. <div class="flex w-full justify-between">
  913. <div class=" self-center text-xs font-medium">
  914. {$i18n.t('Max Tokens (num_predict)')}
  915. </div>
  916. <button
  917. class="p-1 px-3 text-xs flex rounded-sm transition shrink-0 outline-hidden"
  918. type="button"
  919. on:click={() => {
  920. params.max_tokens = (params?.max_tokens ?? null) === null ? 128 : null;
  921. }}
  922. >
  923. {#if (params?.max_tokens ?? null) === null}
  924. <span class="ml-2 self-center">{$i18n.t('Default')}</span>
  925. {:else}
  926. <span class="ml-2 self-center">{$i18n.t('Custom')}</span>
  927. {/if}
  928. </button>
  929. </div>
  930. </Tooltip>
  931. {#if (params?.max_tokens ?? null) !== null}
  932. <div class="flex mt-0.5 space-x-2">
  933. <div class=" flex-1">
  934. <input
  935. id="steps-range"
  936. type="range"
  937. min="-2"
  938. max="131072"
  939. step="1"
  940. bind:value={params.max_tokens}
  941. class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
  942. />
  943. </div>
  944. <div>
  945. <input
  946. bind:value={params.max_tokens}
  947. type="number"
  948. class=" bg-transparent text-center w-14"
  949. min="-2"
  950. step="1"
  951. />
  952. </div>
  953. </div>
  954. {/if}
  955. </div>
  956. <div class=" py-0.5 w-full justify-between">
  957. <Tooltip
  958. content={$i18n.t(
  959. 'Control the repetition of token sequences in the generated text. A higher value (e.g., 1.5) will penalize repetitions more strongly, while a lower value (e.g., 1.1) will be more lenient. At 1, it is disabled.'
  960. )}
  961. placement="top-start"
  962. className="inline-tooltip"
  963. >
  964. <div class="flex w-full justify-between">
  965. <div class=" self-center text-xs font-medium">
  966. {$i18n.t('Repeat Penalty (Ollama)')}
  967. </div>
  968. <button
  969. class="p-1 px-3 text-xs flex rounded transition flex-shrink-0 outline-none"
  970. type="button"
  971. on:click={() => {
  972. params.repeat_penalty = (params?.repeat_penalty ?? null) === null ? 1.1 : null;
  973. }}
  974. >
  975. {#if (params?.repeat_penalty ?? null) === null}
  976. <span class="ml-2 self-center">{$i18n.t('Default')}</span>
  977. {:else}
  978. <span class="ml-2 self-center">{$i18n.t('Custom')}</span>
  979. {/if}
  980. </button>
  981. </div>
  982. </Tooltip>
  983. {#if (params?.repeat_penalty ?? null) !== null}
  984. <div class="flex mt-0.5 space-x-2">
  985. <div class=" flex-1">
  986. <input
  987. id="steps-range"
  988. type="range"
  989. min="-2"
  990. max="2"
  991. step="0.05"
  992. bind:value={params.repeat_penalty}
  993. class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
  994. />
  995. </div>
  996. <div>
  997. <input
  998. bind:value={params.repeat_penalty}
  999. type="number"
  1000. class=" bg-transparent text-center w-14"
  1001. min="-2"
  1002. max="2"
  1003. step="any"
  1004. />
  1005. </div>
  1006. </div>
  1007. {/if}
  1008. </div>
  1009. <div class=" py-0.5 w-full justify-between">
  1010. <Tooltip
  1011. content={$i18n.t('Sets the size of the context window used to generate the next token.')}
  1012. placement="top-start"
  1013. className="inline-tooltip"
  1014. >
  1015. <div class="flex w-full justify-between">
  1016. <div class=" self-center text-xs font-medium">
  1017. {$i18n.t('Context Length')}
  1018. {$i18n.t('(Ollama)')}
  1019. </div>
  1020. <button
  1021. class="p-1 px-3 text-xs flex rounded-sm transition shrink-0 outline-hidden"
  1022. type="button"
  1023. on:click={() => {
  1024. params.num_ctx = (params?.num_ctx ?? null) === null ? 2048 : null;
  1025. }}
  1026. >
  1027. {#if (params?.num_ctx ?? null) === null}
  1028. <span class="ml-2 self-center">{$i18n.t('Default')}</span>
  1029. {:else}
  1030. <span class="ml-2 self-center">{$i18n.t('Custom')}</span>
  1031. {/if}
  1032. </button>
  1033. </div>
  1034. </Tooltip>
  1035. {#if (params?.num_ctx ?? null) !== null}
  1036. <div class="flex mt-0.5 space-x-2">
  1037. <div class=" flex-1">
  1038. <input
  1039. id="steps-range"
  1040. type="range"
  1041. min="-1"
  1042. max="10240000"
  1043. step="1"
  1044. bind:value={params.num_ctx}
  1045. class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
  1046. />
  1047. </div>
  1048. <div class="">
  1049. <input
  1050. bind:value={params.num_ctx}
  1051. type="number"
  1052. class=" bg-transparent text-center w-14"
  1053. min="-1"
  1054. step="1"
  1055. />
  1056. </div>
  1057. </div>
  1058. {/if}
  1059. </div>
  1060. <div class=" py-0.5 w-full justify-between">
  1061. <Tooltip
  1062. content={$i18n.t(
  1063. 'The batch size determines how many text requests are processed together at once. A higher batch size can increase the performance and speed of the model, but it also requires more memory.'
  1064. )}
  1065. placement="top-start"
  1066. className="inline-tooltip"
  1067. >
  1068. <div class="flex w-full justify-between">
  1069. <div class=" self-center text-xs font-medium">
  1070. {$i18n.t('Batch Size (num_batch)')}
  1071. </div>
  1072. <button
  1073. class="p-1 px-3 text-xs flex rounded-sm transition shrink-0 outline-hidden"
  1074. type="button"
  1075. on:click={() => {
  1076. params.num_batch = (params?.num_batch ?? null) === null ? 512 : null;
  1077. }}
  1078. >
  1079. {#if (params?.num_batch ?? null) === null}
  1080. <span class="ml-2 self-center">{$i18n.t('Default')}</span>
  1081. {:else}
  1082. <span class="ml-2 self-center">{$i18n.t('Custom')}</span>
  1083. {/if}
  1084. </button>
  1085. </div>
  1086. </Tooltip>
  1087. {#if (params?.num_batch ?? null) !== null}
  1088. <div class="flex mt-0.5 space-x-2">
  1089. <div class=" flex-1">
  1090. <input
  1091. id="steps-range"
  1092. type="range"
  1093. min="256"
  1094. max="8192"
  1095. step="256"
  1096. bind:value={params.num_batch}
  1097. class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
  1098. />
  1099. </div>
  1100. <div>
  1101. <input
  1102. bind:value={params.num_batch}
  1103. type="number"
  1104. class=" bg-transparent text-center w-14"
  1105. min="256"
  1106. step="256"
  1107. />
  1108. </div>
  1109. </div>
  1110. {/if}
  1111. </div>
  1112. {#if admin}
  1113. <div class=" py-0.5 w-full justify-between">
  1114. <Tooltip
  1115. content={$i18n.t(
  1116. 'Enable Memory Mapping (mmap) to load model data. This option allows the system to use disk storage as an extension of RAM by treating disk files as if they were in RAM. This can improve model performance by allowing for faster data access. However, it may not work correctly with all systems and can consume a significant amount of disk space.'
  1117. )}
  1118. placement="top-start"
  1119. className="inline-tooltip"
  1120. >
  1121. <div class="flex w-full justify-between">
  1122. <div class=" self-center text-xs font-medium">
  1123. {$i18n.t('use_mmap (Ollama)')}
  1124. </div>
  1125. <button
  1126. class="p-1 px-3 text-xs flex rounded-sm transition shrink-0 outline-hidden"
  1127. type="button"
  1128. on:click={() => {
  1129. params.use_mmap = (params?.use_mmap ?? null) === null ? true : null;
  1130. }}
  1131. >
  1132. {#if (params?.use_mmap ?? null) === null}
  1133. <span class="ml-2 self-center">{$i18n.t('Default')}</span>
  1134. {:else}
  1135. <span class="ml-2 self-center">{$i18n.t('Custom')}</span>
  1136. {/if}
  1137. </button>
  1138. </div>
  1139. </Tooltip>
  1140. {#if (params?.use_mmap ?? null) !== null}
  1141. <div class="flex justify-between items-center mt-1">
  1142. <div class="text-xs text-gray-500">
  1143. {params.use_mmap ? 'Enabled' : 'Disabled'}
  1144. </div>
  1145. <div class=" pr-2">
  1146. <Switch bind:state={params.use_mmap} />
  1147. </div>
  1148. </div>
  1149. {/if}
  1150. </div>
  1151. <div class=" py-0.5 w-full justify-between">
  1152. <Tooltip
  1153. content={$i18n.t(
  1154. "Enable Memory Locking (mlock) to prevent model data from being swapped out of RAM. This option locks the model's working set of pages into RAM, ensuring that they will not be swapped out to disk. This can help maintain performance by avoiding page faults and ensuring fast data access."
  1155. )}
  1156. placement="top-start"
  1157. className="inline-tooltip"
  1158. >
  1159. <div class="flex w-full justify-between">
  1160. <div class=" self-center text-xs font-medium">
  1161. {$i18n.t('use_mlock (Ollama)')}
  1162. </div>
  1163. <button
  1164. class="p-1 px-3 text-xs flex rounded-sm transition shrink-0 outline-hidden"
  1165. type="button"
  1166. on:click={() => {
  1167. params.use_mlock = (params?.use_mlock ?? null) === null ? true : null;
  1168. }}
  1169. >
  1170. {#if (params?.use_mlock ?? null) === null}
  1171. <span class="ml-2 self-center">{$i18n.t('Default')}</span>
  1172. {:else}
  1173. <span class="ml-2 self-center">{$i18n.t('Custom')}</span>
  1174. {/if}
  1175. </button>
  1176. </div>
  1177. </Tooltip>
  1178. {#if (params?.use_mlock ?? null) !== null}
  1179. <div class="flex justify-between items-center mt-1">
  1180. <div class="text-xs text-gray-500">
  1181. {params.use_mlock ? 'Enabled' : 'Disabled'}
  1182. </div>
  1183. <div class=" pr-2">
  1184. <Switch bind:state={params.use_mlock} />
  1185. </div>
  1186. </div>
  1187. {/if}
  1188. </div>
  1189. <div class=" py-0.5 w-full justify-between">
  1190. <Tooltip
  1191. content={$i18n.t(
  1192. 'Set the number of worker threads used for computation. This option controls how many threads are used to process incoming requests concurrently. Increasing this value can improve performance under high concurrency workloads but may also consume more CPU resources.'
  1193. )}
  1194. placement="top-start"
  1195. className="inline-tooltip"
  1196. >
  1197. <div class="flex w-full justify-between">
  1198. <div class=" self-center text-xs font-medium">
  1199. {$i18n.t('num_thread (Ollama)')}
  1200. </div>
  1201. <button
  1202. class="p-1 px-3 text-xs flex rounded-sm transition shrink-0 outline-hidden"
  1203. type="button"
  1204. on:click={() => {
  1205. params.num_thread = (params?.num_thread ?? null) === null ? 2 : null;
  1206. }}
  1207. >
  1208. {#if (params?.num_thread ?? null) === null}
  1209. <span class="ml-2 self-center">{$i18n.t('Default')}</span>
  1210. {:else}
  1211. <span class="ml-2 self-center">{$i18n.t('Custom')}</span>
  1212. {/if}
  1213. </button>
  1214. </div>
  1215. </Tooltip>
  1216. {#if (params?.num_thread ?? null) !== null}
  1217. <div class="flex mt-0.5 space-x-2">
  1218. <div class=" flex-1">
  1219. <input
  1220. id="steps-range"
  1221. type="range"
  1222. min="1"
  1223. max="256"
  1224. step="1"
  1225. bind:value={params.num_thread}
  1226. class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
  1227. />
  1228. </div>
  1229. <div class="">
  1230. <input
  1231. bind:value={params.num_thread}
  1232. type="number"
  1233. class=" bg-transparent text-center w-14"
  1234. min="1"
  1235. max="256"
  1236. step="1"
  1237. />
  1238. </div>
  1239. </div>
  1240. {/if}
  1241. </div>
  1242. <div class=" py-0.5 w-full justify-between">
  1243. <Tooltip
  1244. content={$i18n.t(
  1245. 'Set the number of layers, which will be off-loaded to GPU. Increasing this value can significantly improve performance for models that are optimized for GPU acceleration but may also consume more power and GPU resources.'
  1246. )}
  1247. placement="top-start"
  1248. className="inline-tooltip"
  1249. >
  1250. <div class="flex w-full justify-between">
  1251. <div class=" self-center text-xs font-medium">
  1252. {$i18n.t('num_gpu (Ollama)')}
  1253. </div>
  1254. <button
  1255. class="p-1 px-3 text-xs flex rounded-sm transition shrink-0 outline-hidden"
  1256. type="button"
  1257. on:click={() => {
  1258. params.num_gpu = (params?.num_gpu ?? null) === null ? 0 : null;
  1259. }}
  1260. >
  1261. {#if (params?.num_gpu ?? null) === null}
  1262. <span class="ml-2 self-center">{$i18n.t('Default')}</span>
  1263. {:else}
  1264. <span class="ml-2 self-center">{$i18n.t('Custom')}</span>
  1265. {/if}
  1266. </button>
  1267. </div>
  1268. </Tooltip>
  1269. {#if (params?.num_gpu ?? null) !== null}
  1270. <div class="flex mt-0.5 space-x-2">
  1271. <div class=" flex-1">
  1272. <input
  1273. id="steps-range"
  1274. type="range"
  1275. min="0"
  1276. max="256"
  1277. step="1"
  1278. bind:value={params.num_gpu}
  1279. class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
  1280. />
  1281. </div>
  1282. <div class="">
  1283. <input
  1284. bind:value={params.num_gpu}
  1285. type="number"
  1286. class=" bg-transparent text-center w-14"
  1287. min="0"
  1288. max="256"
  1289. step="1"
  1290. />
  1291. </div>
  1292. </div>
  1293. {/if}
  1294. </div>
  1295. <!-- <div class=" py-0.5 w-full justify-between">
  1296. <div class="flex w-full justify-between">
  1297. <div class=" self-center text-xs font-medium">{$i18n.t('Template')}</div>
  1298. <button
  1299. class="p-1 px-3 text-xs flex rounded-sm transition shrink-0 outline-hidden"
  1300. type="button"
  1301. on:click={() => {
  1302. params.template = (params?.template ?? null) === null ? '' : null;
  1303. }}
  1304. >
  1305. {#if (params?.template ?? null) === null}
  1306. <span class="ml-2 self-center">{$i18n.t('Default')}</span>
  1307. {:else}
  1308. <span class="ml-2 self-center">{$i18n.t('Custom')}</span>
  1309. {/if}
  1310. </button>
  1311. </div>
  1312. {#if (params?.template ?? null) !== null}
  1313. <div class="flex mt-0.5 space-x-2">
  1314. <div class=" flex-1">
  1315. <textarea
  1316. class="px-3 py-1.5 text-sm w-full bg-transparent border dark:border-gray-600 outline-hidden rounded-lg -mb-1"
  1317. placeholder={$i18n.t('Write your model template content here')}
  1318. rows="4"
  1319. bind:value={params.template}
  1320. />
  1321. </div>
  1322. </div>
  1323. {/if}
  1324. </div> -->
  1325. {/if}
  1326. </div>