AdvancedParams.svelte 17.9 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
refac  
Timothy J. Baek committed
8
	export let params = {
Timothy J. Baek's avatar
Timothy J. Baek committed
9
10
		// Advanced
		seed: 0,
Timothy J. Baek's avatar
Timothy J. Baek committed
11
		stop: null,
Timothy J. Baek's avatar
Timothy J. Baek committed
12
		temperature: '',
13
		frequency_penalty: '',
Timothy J. Baek's avatar
Timothy J. Baek committed
14
15
16
17
18
19
20
21
		repeat_last_n: '',
		mirostat: '',
		mirostat_eta: '',
		mirostat_tau: '',
		top_k: '',
		top_p: '',
		tfs_z: '',
		num_ctx: '',
22
		max_tokens: '',
23
24
25
		use_mmap: null,
		use_mlock: null,
		num_thread: null,
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
26
		template: null
Timothy J. Baek's avatar
Timothy J. Baek committed
27
	};
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
28
29
30

	let customFieldName = '';
	let customFieldValue = '';
Timothy J. Baek's avatar
Timothy J. Baek committed
31
32
33
34

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

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

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

		{#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
105
106
107
108
	</div>

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

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

Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
126
		{#if (params?.temperature ?? '') !== ''}
Timothy J. Baek's avatar
Timothy J. Baek committed
127
128
129
130
131
132
133
134
			<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
135
						bind:value={params.temperature}
Timothy J. Baek's avatar
Timothy J. Baek committed
136
137
138
139
140
						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
141
						bind:value={params.temperature}
Timothy J. Baek's avatar
Timothy J. Baek committed
142
143
144
145
146
147
148
149
150
151
152
153
154
						type="number"
						class=" bg-transparent text-center w-14"
						min="0"
						max="1"
						step="0.05"
					/>
				</div>
			</div>
		{/if}
	</div>

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

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

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

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

Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
218
		{#if (params?.mirostat_eta ?? '') !== ''}
Timothy J. Baek's avatar
Timothy J. Baek committed
219
220
221
222
223
224
225
226
			<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
227
						bind:value={params.mirostat_eta}
Timothy J. Baek's avatar
Timothy J. Baek committed
228
229
230
231
232
						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
233
						bind:value={params.mirostat_eta}
Timothy J. Baek's avatar
Timothy J. Baek committed
234
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"
						step="0.05"
					/>
				</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
refac  
Timothy J. Baek committed
253
					params.mirostat_tau = (params?.mirostat_tau ?? '') === '' ? 5.0 : '';
Timothy J. Baek's avatar
Timothy J. Baek committed
254
255
				}}
			>
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
256
				{#if (params?.mirostat_tau ?? '') === ''}
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
refac  
Timothy J. Baek committed
264
		{#if (params?.mirostat_tau ?? '') !== ''}
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
292
						type="number"
						class=" bg-transparent text-center w-14"
						min="0"
						max="10"
						step="0.5"
					/>
				</div>
			</div>
		{/if}
	</div>

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

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

Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
310
		{#if (params?.top_k ?? '') !== ''}
Timothy J. Baek's avatar
Timothy J. Baek committed
311
312
313
314
315
316
317
318
			<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
319
						bind:value={params.top_k}
Timothy J. Baek's avatar
Timothy J. Baek committed
320
321
322
323
324
						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
325
						bind:value={params.top_k}
Timothy J. Baek's avatar
Timothy J. Baek committed
326
327
328
329
330
331
332
333
334
335
336
337
338
						type="number"
						class=" bg-transparent text-center w-14"
						min="0"
						max="100"
						step="0.5"
					/>
				</div>
			</div>
		{/if}
	</div>

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

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

Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
356
		{#if (params?.top_p ?? '') !== ''}
Timothy J. Baek's avatar
Timothy J. Baek committed
357
358
359
360
361
362
363
364
			<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
365
						bind:value={params.top_p}
Timothy J. Baek's avatar
Timothy J. Baek committed
366
367
368
369
370
						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
371
						bind:value={params.top_p}
Timothy J. Baek's avatar
Timothy J. Baek committed
372
373
374
375
376
377
378
379
380
381
382
383
384
						type="number"
						class=" bg-transparent text-center w-14"
						min="0"
						max="1"
						step="0.05"
					/>
				</div>
			</div>
		{/if}
	</div>

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

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

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

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

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

Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
448
		{#if (params?.repeat_last_n ?? '') !== ''}
Timothy J. Baek's avatar
Timothy J. Baek committed
449
450
451
452
453
454
455
456
			<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
457
						bind:value={params.repeat_last_n}
Timothy J. Baek's avatar
Timothy J. Baek committed
458
459
460
461
462
						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
463
						bind:value={params.repeat_last_n}
Timothy J. Baek's avatar
Timothy J. Baek committed
464
465
466
467
468
469
470
471
472
473
474
475
476
						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">
477
			<div class=" self-center text-xs font-medium">{$i18n.t('Tfs Z')}</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
478
479
480
481
482

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

Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
494
		{#if (params?.tfs_z ?? '') !== ''}
Timothy J. Baek's avatar
Timothy J. Baek committed
495
496
497
498
499
500
501
502
			<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
503
						bind:value={params.tfs_z}
Timothy J. Baek's avatar
Timothy J. Baek committed
504
505
506
507
508
						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
509
						bind:value={params.tfs_z}
Timothy J. Baek's avatar
Timothy J. Baek committed
510
511
512
513
514
515
516
517
518
519
520
521
522
						type="number"
						class=" bg-transparent text-center w-14"
						min="0"
						max="2"
						step="0.05"
					/>
				</div>
			</div>
		{/if}
	</div>

	<div class=" py-0.5 w-full justify-between">
		<div class="flex w-full justify-between">
523
			<div class=" self-center text-xs font-medium">{$i18n.t('Context Length')}</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
524
525
526
527
528

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

Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
540
		{#if (params?.num_ctx ?? '') !== ''}
Timothy J. Baek's avatar
Timothy J. Baek committed
541
542
543
544
545
			<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
546
						min="-1"
Timothy J. Baek's avatar
Timothy J. Baek committed
547
						max="10240000"
Timothy J. Baek's avatar
Timothy J. Baek committed
548
						step="1"
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
549
						bind:value={params.num_ctx}
Timothy J. Baek's avatar
Timothy J. Baek committed
550
551
552
553
554
						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
555
						bind:value={params.num_ctx}
Timothy J. Baek's avatar
Timothy J. Baek committed
556
557
						type="number"
						class=" bg-transparent text-center w-14"
Timothy J. Baek's avatar
Timothy J. Baek committed
558
						min="-1"
Timothy J. Baek's avatar
Timothy J. Baek committed
559
						step="1"
Timothy J. Baek's avatar
Timothy J. Baek committed
560
561
562
563
564
					/>
				</div>
			</div>
		{/if}
	</div>
565

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

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

585
		{#if (params?.max_tokens ?? '') !== ''}
Timothy J. Baek's avatar
Timothy J. Baek committed
586
587
588
589
590
591
592
593
			<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"
594
						bind:value={params.max_tokens}
Timothy J. Baek's avatar
Timothy J. Baek committed
595
596
597
598
599
						class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
					/>
				</div>
				<div class="">
					<input
600
						bind:value={params.max_tokens}
Timothy J. Baek's avatar
Timothy J. Baek committed
601
602
603
604
605
606
607
608
609
610
						type="number"
						class=" bg-transparent text-center w-14"
						min="-2"
						max="16000"
						step="1"
					/>
				</div>
			</div>
		{/if}
	</div>
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
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
692
693
694
695
696
697

	<div class=" py-0.5 w-full justify-between">
		<div class="flex w-full justify-between">
			<div class=" self-center text-xs font-medium">{$i18n.t('use_mmap (Ollama)')}</div>

			<button
				class="p-1 px-3 text-xs flex rounded transition"
				type="button"
				on:click={() => {
					params.use_mmap = (params?.use_mmap ?? null) === null ? true : null;
				}}
			>
				{#if (params?.use_mmap ?? null) === null}
					<span class="ml-2 self-center">{$i18n.t('Default')}</span>
				{:else}
					<span class="ml-2 self-center">{$i18n.t('On')}</span>
				{/if}
			</button>
		</div>
	</div>

	<div class=" py-0.5 w-full justify-between">
		<div class="flex w-full justify-between">
			<div class=" self-center text-xs font-medium">{$i18n.t('use_mlock (Ollama)')}</div>

			<button
				class="p-1 px-3 text-xs flex rounded transition"
				type="button"
				on:click={() => {
					params.use_mlock = (params?.use_mlock ?? null) === null ? true : null;
				}}
			>
				{#if (params?.use_mlock ?? null) === null}
					<span class="ml-2 self-center">{$i18n.t('Default')}</span>
				{:else}
					<span class="ml-2 self-center">{$i18n.t('On')}</span>
				{/if}
			</button>
		</div>
	</div>

	<div class=" py-0.5 w-full justify-between">
		<div class="flex w-full justify-between">
			<div class=" self-center text-xs font-medium">{$i18n.t('num_thread (Ollama)')}</div>

			<button
				class="p-1 px-3 text-xs flex rounded transition"
				type="button"
				on:click={() => {
					params.num_thread = (params?.num_thread ?? null) === null ? 2 : null;
				}}
			>
				{#if (params?.num_thread ?? null) === null}
					<span class="ml-2 self-center">{$i18n.t('Default')}</span>
				{:else}
					<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
				{/if}
			</button>
		</div>

		{#if (params?.num_thread ?? null) !== null}
			<div class="flex mt-0.5 space-x-2">
				<div class=" flex-1">
					<input
						id="steps-range"
						type="range"
						min="1"
						max="256"
						step="1"
						bind:value={params.num_thread}
						class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
					/>
				</div>
				<div class="">
					<input
						bind:value={params.num_thread}
						type="number"
						class=" bg-transparent text-center w-14"
						min="1"
						max="256"
						step="1"
					/>
				</div>
			</div>
		{/if}
	</div>

Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
	<div class=" py-0.5 w-full justify-between">
		<div class="flex w-full justify-between">
			<div class=" self-center text-xs font-medium">{$i18n.t('Template')}</div>

			<button
				class="p-1 px-3 text-xs flex rounded transition"
				type="button"
				on:click={() => {
					params.template = (params?.template ?? null) === null ? '' : null;
				}}
			>
				{#if (params?.template ?? null) === null}
					<span class="ml-2 self-center">{$i18n.t('Default')}</span>
				{:else}
					<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
				{/if}
			</button>
		</div>

		{#if (params?.template ?? null) !== null}
			<div class="flex mt-0.5 space-x-2">
				<div class=" flex-1">
					<textarea
						class="px-3 py-1.5 text-sm w-full bg-transparent border dark:border-gray-600 outline-none rounded-lg -mb-1"
						placeholder="Write your model template content here"
						rows="4"
						bind:value={params.template}
					/>
				</div>
			</div>
		{/if}
	</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
730
</div>