AdvancedParams.svelte 18.2 KB
Newer Older
Timothy J. Baek's avatar
Timothy J. Baek committed
1
<script lang="ts">
Timothy J. Baek's avatar
Timothy J. Baek committed
2
3
4
	import { getContext, createEventDispatcher } from 'svelte';

	const dispatch = createEventDispatcher();
5
6
7

	const i18n = getContext('i18n');

Timothy J. Baek's avatar
Timothy J. Baek committed
8
9
	export let admin = false;

Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
10
	export let params = {
Timothy J. Baek's avatar
Timothy J. Baek committed
11
		// Advanced
Timothy J. Baek's avatar
Timothy J. Baek committed
12
		seed: null,
Timothy J. Baek's avatar
Timothy J. Baek committed
13
		stop: null,
Timothy J. Baek's avatar
Timothy J. Baek committed
14
15
16
17
18
19
20
21
22
23
24
		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,
25
26
27
		use_mmap: null,
		use_mlock: null,
		num_thread: null,
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
28
		template: null
Timothy J. Baek's avatar
Timothy J. Baek committed
29
	};
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
30
31
32

	let customFieldName = '';
	let customFieldValue = '';
Timothy J. Baek's avatar
Timothy J. Baek committed
33
34
35
36

	$: if (params) {
		dispatch('change', params);
	}
Timothy J. Baek's avatar
Timothy J. Baek committed
37
38
</script>

Timothy J. Baek's avatar
Timothy J. Baek committed
39
<div class=" space-y-1 text-xs">
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
	<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>
Timothy J. Baek's avatar
Timothy J. Baek committed
57
58
		</div>

Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
59
60
61
62
63
64
65
66
67
68
69
70
		{#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>
Timothy J. Baek's avatar
Timothy J. Baek committed
71
			</div>
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
		{/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>
Timothy J. Baek's avatar
Timothy J. Baek committed
92
		</div>
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
93
94
95
96
97
98
99
100
101
102
103
104
105
106

		{#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}
Timothy J. Baek's avatar
Timothy J. Baek committed
107
108
109
110
	</div>

	<div class=" py-0.5 w-full justify-between">
		<div class="flex w-full justify-between">
111
			<div class=" self-center text-xs font-medium">{$i18n.t('Temperature')}</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
112
113
114
115
116

			<button
				class="p-1 px-3 text-xs flex rounded transition"
				type="button"
				on:click={() => {
Timothy J. Baek's avatar
Timothy J. Baek committed
117
					params.temperature = (params?.temperature ?? null) === null ? 0.8 : null;
Timothy J. Baek's avatar
Timothy J. Baek committed
118
119
				}}
			>
Timothy J. Baek's avatar
Timothy J. Baek committed
120
				{#if (params?.temperature ?? null) === null}
121
					<span class="ml-2 self-center"> {$i18n.t('Default')} </span>
Timothy J. Baek's avatar
Timothy J. Baek committed
122
				{:else}
123
					<span class="ml-2 self-center"> {$i18n.t('Custom')} </span>
Timothy J. Baek's avatar
Timothy J. Baek committed
124
125
126
127
				{/if}
			</button>
		</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
128
		{#if (params?.temperature ?? null) !== null}
Timothy J. Baek's avatar
Timothy J. Baek committed
129
130
131
132
133
134
135
136
			<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"
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
137
						bind:value={params.temperature}
Timothy J. Baek's avatar
Timothy J. Baek committed
138
139
140
141
142
						class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
					/>
				</div>
				<div>
					<input
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
143
						bind:value={params.temperature}
Timothy J. Baek's avatar
Timothy J. Baek committed
144
145
146
147
148
149
150
151
152
153
154
155
						type="number"
						class=" bg-transparent text-center w-14"
						min="0"
						max="1"
					/>
				</div>
			</div>
		{/if}
	</div>

	<div class=" py-0.5 w-full justify-between">
		<div class="flex w-full justify-between">
156
			<div class=" self-center text-xs font-medium">{$i18n.t('Mirostat')}</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
157
158
159
160
161

			<button
				class="p-1 px-3 text-xs flex rounded transition"
				type="button"
				on:click={() => {
Timothy J. Baek's avatar
Timothy J. Baek committed
162
					params.mirostat = (params?.mirostat ?? null) === null ? 0 : null;
Timothy J. Baek's avatar
Timothy J. Baek committed
163
164
				}}
			>
Timothy J. Baek's avatar
Timothy J. Baek committed
165
				{#if (params?.mirostat ?? null) === null}
166
					<span class="ml-2 self-center">{$i18n.t('Default')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
167
				{:else}
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
168
					<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
169
170
171
172
				{/if}
			</button>
		</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
173
		{#if (params?.mirostat ?? null) !== null}
Timothy J. Baek's avatar
Timothy J. Baek committed
174
175
176
177
178
179
180
181
			<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"
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
182
						bind:value={params.mirostat}
Timothy J. Baek's avatar
Timothy J. Baek committed
183
184
185
186
187
						class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
					/>
				</div>
				<div>
					<input
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
188
						bind:value={params.mirostat}
Timothy J. Baek's avatar
Timothy J. Baek committed
189
190
191
192
193
194
195
196
197
198
199
200
201
						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">
202
			<div class=" self-center text-xs font-medium">{$i18n.t('Mirostat Eta')}</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
203
204
205
206
207

			<button
				class="p-1 px-3 text-xs flex rounded transition"
				type="button"
				on:click={() => {
Timothy J. Baek's avatar
Timothy J. Baek committed
208
					params.mirostat_eta = (params?.mirostat_eta ?? null) === null ? 0.1 : null;
Timothy J. Baek's avatar
Timothy J. Baek committed
209
210
				}}
			>
Timothy J. Baek's avatar
Timothy J. Baek committed
211
				{#if (params?.mirostat_eta ?? null) === null}
212
					<span class="ml-2 self-center">{$i18n.t('Default')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
213
				{:else}
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
214
					<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
215
216
217
218
				{/if}
			</button>
		</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
219
		{#if (params?.mirostat_eta ?? null) !== null}
Timothy J. Baek's avatar
Timothy J. Baek committed
220
221
222
223
224
225
226
227
			<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"
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
228
						bind:value={params.mirostat_eta}
Timothy J. Baek's avatar
Timothy J. Baek committed
229
230
231
232
233
						class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
					/>
				</div>
				<div>
					<input
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
234
						bind:value={params.mirostat_eta}
Timothy J. Baek's avatar
Timothy J. Baek committed
235
236
237
238
239
240
241
242
243
244
245
246
						type="number"
						class=" bg-transparent text-center w-14"
						min="0"
						max="1"
					/>
				</div>
			</div>
		{/if}
	</div>

	<div class=" py-0.5 w-full justify-between">
		<div class="flex w-full justify-between">
247
			<div class=" self-center text-xs font-medium">{$i18n.t('Mirostat Tau')}</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
248
249
250
251
252

			<button
				class="p-1 px-3 text-xs flex rounded transition"
				type="button"
				on:click={() => {
Timothy J. Baek's avatar
Timothy J. Baek committed
253
					params.mirostat_tau = (params?.mirostat_tau ?? null) === null ? 5.0 : null;
Timothy J. Baek's avatar
Timothy J. Baek committed
254
255
				}}
			>
Timothy J. Baek's avatar
Timothy J. Baek committed
256
				{#if (params?.mirostat_tau ?? null) === null}
257
					<span class="ml-2 self-center">{$i18n.t('Default')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
258
				{:else}
259
					<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
260
261
262
263
				{/if}
			</button>
		</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
264
		{#if (params?.mirostat_tau ?? null) !== null}
Timothy J. Baek's avatar
Timothy J. Baek committed
265
266
267
268
269
270
271
272
			<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"
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
273
						bind:value={params.mirostat_tau}
Timothy J. Baek's avatar
Timothy J. Baek committed
274
275
276
277
278
						class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
					/>
				</div>
				<div>
					<input
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
279
						bind:value={params.mirostat_tau}
Timothy J. Baek's avatar
Timothy J. Baek committed
280
281
282
283
284
285
286
287
288
289
290
291
						type="number"
						class=" bg-transparent text-center w-14"
						min="0"
						max="10"
					/>
				</div>
			</div>
		{/if}
	</div>

	<div class=" py-0.5 w-full justify-between">
		<div class="flex w-full justify-between">
292
			<div class=" self-center text-xs font-medium">{$i18n.t('Top K')}</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
293
294
295
296
297

			<button
				class="p-1 px-3 text-xs flex rounded transition"
				type="button"
				on:click={() => {
Timothy J. Baek's avatar
Timothy J. Baek committed
298
					params.top_k = (params?.top_k ?? null) === null ? 40 : null;
Timothy J. Baek's avatar
Timothy J. Baek committed
299
300
				}}
			>
Timothy J. Baek's avatar
Timothy J. Baek committed
301
				{#if (params?.top_k ?? null) === null}
302
					<span class="ml-2 self-center">{$i18n.t('Default')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
303
				{:else}
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
304
					<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
305
306
307
308
				{/if}
			</button>
		</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
309
		{#if (params?.top_k ?? null) !== null}
Timothy J. Baek's avatar
Timothy J. Baek committed
310
311
312
313
314
315
316
317
			<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"
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
318
						bind:value={params.top_k}
Timothy J. Baek's avatar
Timothy J. Baek committed
319
320
321
322
323
						class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
					/>
				</div>
				<div>
					<input
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
324
						bind:value={params.top_k}
Timothy J. Baek's avatar
Timothy J. Baek committed
325
326
327
328
329
330
331
332
333
334
335
336
						type="number"
						class=" bg-transparent text-center w-14"
						min="0"
						max="100"
					/>
				</div>
			</div>
		{/if}
	</div>

	<div class=" py-0.5 w-full justify-between">
		<div class="flex w-full justify-between">
337
			<div class=" self-center text-xs font-medium">{$i18n.t('Top P')}</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
338
339
340
341
342

			<button
				class="p-1 px-3 text-xs flex rounded transition"
				type="button"
				on:click={() => {
Timothy J. Baek's avatar
Timothy J. Baek committed
343
					params.top_p = (params?.top_p ?? null) === null ? 0.9 : null;
Timothy J. Baek's avatar
Timothy J. Baek committed
344
345
				}}
			>
Timothy J. Baek's avatar
Timothy J. Baek committed
346
				{#if (params?.top_p ?? null) === null}
347
					<span class="ml-2 self-center">{$i18n.t('Default')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
348
				{:else}
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
349
					<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
350
351
352
353
				{/if}
			</button>
		</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
354
		{#if (params?.top_p ?? null) !== null}
Timothy J. Baek's avatar
Timothy J. Baek committed
355
356
357
358
359
360
361
362
			<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"
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
363
						bind:value={params.top_p}
Timothy J. Baek's avatar
Timothy J. Baek committed
364
365
366
367
368
						class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
					/>
				</div>
				<div>
					<input
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
369
						bind:value={params.top_p}
Timothy J. Baek's avatar
Timothy J. Baek committed
370
371
372
373
374
375
376
377
378
379
380
381
						type="number"
						class=" bg-transparent text-center w-14"
						min="0"
						max="1"
					/>
				</div>
			</div>
		{/if}
	</div>

	<div class=" py-0.5 w-full justify-between">
		<div class="flex w-full justify-between">
Timothy J. Baek's avatar
Timothy J. Baek committed
382
			<div class=" self-center text-xs font-medium">{$i18n.t('Frequency Penalty')}</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
383
384
385
386
387

			<button
				class="p-1 px-3 text-xs flex rounded transition"
				type="button"
				on:click={() => {
Timothy J. Baek's avatar
Timothy J. Baek committed
388
					params.frequency_penalty = (params?.frequency_penalty ?? null) === null ? 1.1 : null;
Timothy J. Baek's avatar
Timothy J. Baek committed
389
390
				}}
			>
Timothy J. Baek's avatar
Timothy J. Baek committed
391
				{#if (params?.frequency_penalty ?? null) === null}
392
					<span class="ml-2 self-center">{$i18n.t('Default')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
393
				{:else}
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
394
					<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
395
396
397
398
				{/if}
			</button>
		</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
399
		{#if (params?.frequency_penalty ?? null) !== null}
Timothy J. Baek's avatar
Timothy J. Baek committed
400
401
402
403
404
405
406
407
			<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"
408
						bind:value={params.frequency_penalty}
Timothy J. Baek's avatar
Timothy J. Baek committed
409
410
411
412
413
						class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
					/>
				</div>
				<div>
					<input
414
						bind:value={params.frequency_penalty}
Timothy J. Baek's avatar
Timothy J. Baek committed
415
416
417
418
419
420
421
422
423
424
425
426
						type="number"
						class=" bg-transparent text-center w-14"
						min="0"
						max="2"
					/>
				</div>
			</div>
		{/if}
	</div>

	<div class=" py-0.5 w-full justify-between">
		<div class="flex w-full justify-between">
427
			<div class=" self-center text-xs font-medium">{$i18n.t('Repeat Last N')}</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
428
429
430
431
432

			<button
				class="p-1 px-3 text-xs flex rounded transition"
				type="button"
				on:click={() => {
Timothy J. Baek's avatar
Timothy J. Baek committed
433
					params.repeat_last_n = (params?.repeat_last_n ?? null) === null ? 64 : null;
Timothy J. Baek's avatar
Timothy J. Baek committed
434
435
				}}
			>
Timothy J. Baek's avatar
Timothy J. Baek committed
436
				{#if (params?.repeat_last_n ?? null) === null}
437
					<span class="ml-2 self-center">{$i18n.t('Default')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
438
				{:else}
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
439
					<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
440
441
442
443
				{/if}
			</button>
		</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
444
		{#if (params?.repeat_last_n ?? null) !== null}
Timothy J. Baek's avatar
Timothy J. Baek committed
445
446
447
448
449
450
451
452
			<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"
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
453
						bind:value={params.repeat_last_n}
Timothy J. Baek's avatar
Timothy J. Baek committed
454
455
456
457
458
						class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
					/>
				</div>
				<div>
					<input
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
459
						bind:value={params.repeat_last_n}
Timothy J. Baek's avatar
Timothy J. Baek committed
460
461
462
463
464
465
466
467
468
469
470
471
472
						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">
473
			<div class=" self-center text-xs font-medium">{$i18n.t('Tfs Z')}</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
474
475
476
477
478

			<button
				class="p-1 px-3 text-xs flex rounded transition"
				type="button"
				on:click={() => {
Timothy J. Baek's avatar
Timothy J. Baek committed
479
					params.tfs_z = (params?.tfs_z ?? null) === null ? 1 : null;
Timothy J. Baek's avatar
Timothy J. Baek committed
480
481
				}}
			>
Timothy J. Baek's avatar
Timothy J. Baek committed
482
				{#if (params?.tfs_z ?? null) === null}
483
					<span class="ml-2 self-center">{$i18n.t('Default')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
484
				{:else}
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
485
					<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
486
487
488
489
				{/if}
			</button>
		</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
490
		{#if (params?.tfs_z ?? null) !== null}
Timothy J. Baek's avatar
Timothy J. Baek committed
491
492
493
494
495
496
497
498
			<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"
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
499
						bind:value={params.tfs_z}
Timothy J. Baek's avatar
Timothy J. Baek committed
500
501
502
503
504
						class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
					/>
				</div>
				<div>
					<input
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
505
						bind:value={params.tfs_z}
Timothy J. Baek's avatar
Timothy J. Baek committed
506
507
508
509
510
511
512
513
514
515
516
517
						type="number"
						class=" bg-transparent text-center w-14"
						min="0"
						max="2"
					/>
				</div>
			</div>
		{/if}
	</div>

	<div class=" py-0.5 w-full justify-between">
		<div class="flex w-full justify-between">
518
			<div class=" self-center text-xs font-medium">{$i18n.t('Context Length')}</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
519
520
521
522
523

			<button
				class="p-1 px-3 text-xs flex rounded transition"
				type="button"
				on:click={() => {
Timothy J. Baek's avatar
Timothy J. Baek committed
524
					params.num_ctx = (params?.num_ctx ?? null) === null ? 2048 : null;
Timothy J. Baek's avatar
Timothy J. Baek committed
525
526
				}}
			>
Timothy J. Baek's avatar
Timothy J. Baek committed
527
				{#if (params?.num_ctx ?? null) === null}
528
					<span class="ml-2 self-center">{$i18n.t('Default')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
529
				{:else}
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
530
					<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
531
532
533
534
				{/if}
			</button>
		</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
535
		{#if (params?.num_ctx ?? null) !== null}
Timothy J. Baek's avatar
Timothy J. Baek committed
536
537
538
539
540
			<div class="flex mt-0.5 space-x-2">
				<div class=" flex-1">
					<input
						id="steps-range"
						type="range"
Timothy J. Baek's avatar
Timothy J. Baek committed
541
						min="-1"
Timothy J. Baek's avatar
Timothy J. Baek committed
542
						max="10240000"
Timothy J. Baek's avatar
Timothy J. Baek committed
543
						step="1"
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
544
						bind:value={params.num_ctx}
Timothy J. Baek's avatar
Timothy J. Baek committed
545
546
547
548
549
						class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
					/>
				</div>
				<div class="">
					<input
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
550
						bind:value={params.num_ctx}
Timothy J. Baek's avatar
Timothy J. Baek committed
551
552
						type="number"
						class=" bg-transparent text-center w-14"
Timothy J. Baek's avatar
Timothy J. Baek committed
553
						min="-1"
Timothy J. Baek's avatar
Timothy J. Baek committed
554
						step="1"
Timothy J. Baek's avatar
Timothy J. Baek committed
555
556
557
558
559
					/>
				</div>
			</div>
		{/if}
	</div>
560

Timothy J. Baek's avatar
Timothy J. Baek committed
561
562
	<div class=" py-0.5 w-full justify-between">
		<div class="flex w-full justify-between">
563
			<div class=" self-center text-xs font-medium">{$i18n.t('Max Tokens (num_predict)')}</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
564
565
566
567
568

			<button
				class="p-1 px-3 text-xs flex rounded transition"
				type="button"
				on:click={() => {
Timothy J. Baek's avatar
Timothy J. Baek committed
569
					params.max_tokens = (params?.max_tokens ?? null) === null ? 128 : null;
Timothy J. Baek's avatar
Timothy J. Baek committed
570
571
				}}
			>
Timothy J. Baek's avatar
Timothy J. Baek committed
572
				{#if (params?.max_tokens ?? null) === null}
573
					<span class="ml-2 self-center">{$i18n.t('Default')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
574
				{:else}
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
575
					<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
576
577
578
579
				{/if}
			</button>
		</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
580
		{#if (params?.max_tokens ?? null) !== null}
Timothy J. Baek's avatar
Timothy J. Baek committed
581
582
583
584
585
586
587
588
			<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"
589
						bind:value={params.max_tokens}
Timothy J. Baek's avatar
Timothy J. Baek committed
590
591
592
593
594
						class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
					/>
				</div>
				<div class="">
					<input
595
						bind:value={params.max_tokens}
Timothy J. Baek's avatar
Timothy J. Baek committed
596
597
598
599
600
601
602
603
604
605
						type="number"
						class=" bg-transparent text-center w-14"
						min="-2"
						max="16000"
						step="1"
					/>
				</div>
			</div>
		{/if}
	</div>
606

Timothy J. Baek's avatar
Timothy J. Baek committed
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
	{#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>
626
627
		</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
		<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>
646
647
		</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
		<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>
666

Timothy J. Baek's avatar
Timothy J. Baek committed
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
			{#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}
692
693
		</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
		<!-- <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>
711
712
			</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
713
714
715
716
717
718
719
720
721
722
			{#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>
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
723
				</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
724
725
726
			{/if}
		</div> -->
	{/if}
Timothy J. Baek's avatar
Timothy J. Baek committed
727
</div>