AdvancedParams.svelte 15.6 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
11
12
13
14
15
16
17
18
19
20
21
		// Advanced
		seed: 0,
		stop: '',
		temperature: '',
		repeat_penalty: '',
		repeat_last_n: '',
		mirostat: '',
		mirostat_eta: '',
		mirostat_tau: '',
		top_k: '',
		top_p: '',
		tfs_z: '',
		num_ctx: '',
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
22
23
		num_predict: '',
		template: null
Timothy J. Baek's avatar
Timothy J. Baek committed
24
	};
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
25
26
27

	let customFieldName = '';
	let customFieldValue = '';
Timothy J. Baek's avatar
Timothy J. Baek committed
28
29
30
31

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

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

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

		{#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
102
103
104
105
	</div>

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

			<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
112
					params.temperature = (params?.temperature ?? '') === '' ? 0.8 : '';
Timothy J. Baek's avatar
Timothy J. Baek committed
113
114
				}}
			>
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
115
				{#if (params?.temperature ?? '') === ''}
116
					<span class="ml-2 self-center"> {$i18n.t('Default')} </span>
Timothy J. Baek's avatar
Timothy J. Baek committed
117
				{:else}
118
					<span class="ml-2 self-center"> {$i18n.t('Custom')} </span>
Timothy J. Baek's avatar
Timothy J. Baek committed
119
120
121
122
				{/if}
			</button>
		</div>

Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
123
		{#if (params?.temperature ?? '') !== ''}
Timothy J. Baek's avatar
Timothy J. Baek committed
124
125
126
127
128
129
130
131
			<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
132
						bind:value={params.temperature}
Timothy J. Baek's avatar
Timothy J. Baek committed
133
134
135
136
137
						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
138
						bind:value={params.temperature}
Timothy J. Baek's avatar
Timothy J. Baek committed
139
140
141
142
143
144
145
146
147
148
149
150
151
						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">
152
			<div class=" self-center text-xs font-medium">{$i18n.t('Mirostat')}</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
153
154
155
156
157

			<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
158
					params.mirostat = (params?.mirostat ?? '') === '' ? 0 : '';
Timothy J. Baek's avatar
Timothy J. Baek committed
159
160
				}}
			>
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
161
				{#if (params?.mirostat ?? '') === ''}
162
					<span class="ml-2 self-center">{$i18n.t('Default')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
163
				{:else}
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
164
					<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
165
166
167
168
				{/if}
			</button>
		</div>

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

			<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
204
					params.mirostat_eta = (params?.mirostat_eta ?? '') === '' ? 0.1 : '';
Timothy J. Baek's avatar
Timothy J. Baek committed
205
206
				}}
			>
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
207
				{#if (params?.mirostat_eta ?? '') === ''}
208
					<span class="ml-2 self-center">{$i18n.t('Default')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
209
				{:else}
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
210
					<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
211
212
213
214
				{/if}
			</button>
		</div>

Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
215
		{#if (params?.mirostat_eta ?? '') !== ''}
Timothy J. Baek's avatar
Timothy J. Baek committed
216
217
218
219
220
221
222
223
			<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
224
						bind:value={params.mirostat_eta}
Timothy J. Baek's avatar
Timothy J. Baek committed
225
226
227
228
229
						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
230
						bind:value={params.mirostat_eta}
Timothy J. Baek's avatar
Timothy J. Baek committed
231
232
233
234
235
236
237
238
239
240
241
242
243
						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">
244
			<div class=" self-center text-xs font-medium">{$i18n.t('Mirostat Tau')}</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
245
246
247
248
249

			<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
250
					params.mirostat_tau = (params?.mirostat_tau ?? '') === '' ? 5.0 : '';
Timothy J. Baek's avatar
Timothy J. Baek committed
251
252
				}}
			>
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
253
				{#if (params?.mirostat_tau ?? '') === ''}
254
					<span class="ml-2 self-center">{$i18n.t('Default')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
255
				{:else}
256
					<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
257
258
259
260
				{/if}
			</button>
		</div>

Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
261
		{#if (params?.mirostat_tau ?? '') !== ''}
Timothy J. Baek's avatar
Timothy J. Baek committed
262
263
264
265
266
267
268
269
			<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
270
						bind:value={params.mirostat_tau}
Timothy J. Baek's avatar
Timothy J. Baek committed
271
272
273
274
275
						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
276
						bind:value={params.mirostat_tau}
Timothy J. Baek's avatar
Timothy J. Baek committed
277
278
279
280
281
282
283
284
285
286
287
288
289
						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">
290
			<div class=" self-center text-xs font-medium">{$i18n.t('Top K')}</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
291
292
293
294
295

			<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
296
					params.top_k = (params?.top_k ?? '') === '' ? 40 : '';
Timothy J. Baek's avatar
Timothy J. Baek committed
297
298
				}}
			>
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
299
				{#if (params?.top_k ?? '') === ''}
300
					<span class="ml-2 self-center">{$i18n.t('Default')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
301
				{:else}
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
302
					<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
303
304
305
306
				{/if}
			</button>
		</div>

Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
307
		{#if (params?.top_k ?? '') !== ''}
Timothy J. Baek's avatar
Timothy J. Baek committed
308
309
310
311
312
313
314
315
			<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
316
						bind:value={params.top_k}
Timothy J. Baek's avatar
Timothy J. Baek committed
317
318
319
320
321
						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
322
						bind:value={params.top_k}
Timothy J. Baek's avatar
Timothy J. Baek committed
323
324
325
326
327
328
329
330
331
332
333
334
335
						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">
336
			<div class=" self-center text-xs font-medium">{$i18n.t('Top P')}</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
337
338
339
340
341

			<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
342
					params.top_p = (params?.top_p ?? '') === '' ? 0.9 : '';
Timothy J. Baek's avatar
Timothy J. Baek committed
343
344
				}}
			>
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
345
				{#if (params?.top_p ?? '') === ''}
346
					<span class="ml-2 self-center">{$i18n.t('Default')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
347
				{:else}
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
348
					<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
349
350
351
352
				{/if}
			</button>
		</div>

Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
353
		{#if (params?.top_p ?? '') !== ''}
Timothy J. Baek's avatar
Timothy J. Baek committed
354
355
356
357
358
359
360
361
			<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
362
						bind:value={params.top_p}
Timothy J. Baek's avatar
Timothy J. Baek committed
363
364
365
366
367
						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
368
						bind:value={params.top_p}
Timothy J. Baek's avatar
Timothy J. Baek committed
369
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"
						step="0.05"
					/>
				</div>
			</div>
		{/if}
	</div>

	<div class=" py-0.5 w-full justify-between">
		<div class="flex w-full justify-between">
382
			<div class=" self-center text-xs font-medium">{$i18n.t('Repeat 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
refac  
Timothy J. Baek committed
388
					params.repeat_penalty = (params?.repeat_penalty ?? '') === '' ? 1.1 : '';
Timothy J. Baek's avatar
Timothy J. Baek committed
389
390
				}}
			>
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
391
				{#if (params?.repeat_penalty ?? '') === ''}
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
refac  
Timothy J. Baek committed
399
		{#if (params?.repeat_penalty ?? '') !== ''}
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"
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
408
						bind:value={params.repeat_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
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
414
						bind:value={params.repeat_penalty}
Timothy J. Baek's avatar
Timothy J. Baek committed
415
416
417
418
419
420
421
422
423
424
425
426
427
						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">
428
			<div class=" self-center text-xs font-medium">{$i18n.t('Repeat Last N')}</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
429
430
431
432
433

			<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
434
					params.repeat_last_n = (params?.repeat_last_n ?? '') === '' ? 64 : '';
Timothy J. Baek's avatar
Timothy J. Baek committed
435
436
				}}
			>
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
437
				{#if (params?.repeat_last_n ?? '') === ''}
438
					<span class="ml-2 self-center">{$i18n.t('Default')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
439
				{:else}
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
440
					<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
441
442
443
444
				{/if}
			</button>
		</div>

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

			<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
480
					params.tfs_z = (params?.tfs_z ?? '') === '' ? 1 : '';
Timothy J. Baek's avatar
Timothy J. Baek committed
481
482
				}}
			>
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
483
				{#if (params?.tfs_z ?? '') === ''}
484
					<span class="ml-2 self-center">{$i18n.t('Default')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
485
				{:else}
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
486
					<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
487
488
489
490
				{/if}
			</button>
		</div>

Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
491
		{#if (params?.tfs_z ?? '') !== ''}
Timothy J. Baek's avatar
Timothy J. Baek committed
492
493
494
495
496
497
498
499
			<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
500
						bind:value={params.tfs_z}
Timothy J. Baek's avatar
Timothy J. Baek committed
501
502
503
504
505
						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
506
						bind:value={params.tfs_z}
Timothy J. Baek's avatar
Timothy J. Baek committed
507
508
509
510
511
512
513
514
515
516
517
518
519
						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">
520
			<div class=" self-center text-xs font-medium">{$i18n.t('Context Length')}</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
521
522
523
524
525

			<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
526
					params.num_ctx = (params?.num_ctx ?? '') === '' ? 2048 : '';
Timothy J. Baek's avatar
Timothy J. Baek committed
527
528
				}}
			>
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
529
				{#if (params?.num_ctx ?? '') === ''}
530
					<span class="ml-2 self-center">{$i18n.t('Default')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
531
				{:else}
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
532
					<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
533
534
535
536
				{/if}
			</button>
		</div>

Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
537
		{#if (params?.num_ctx ?? '') !== ''}
Timothy J. Baek's avatar
Timothy J. Baek committed
538
539
540
541
542
			<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
543
						min="-1"
Timothy J. Baek's avatar
Timothy J. Baek committed
544
						max="10240000"
Timothy J. Baek's avatar
Timothy J. Baek committed
545
						step="1"
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
546
						bind:value={params.num_ctx}
Timothy J. Baek's avatar
Timothy J. Baek committed
547
548
549
550
551
						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
552
						bind:value={params.num_ctx}
Timothy J. Baek's avatar
Timothy J. Baek committed
553
554
						type="number"
						class=" bg-transparent text-center w-14"
Timothy J. Baek's avatar
Timothy J. Baek committed
555
						min="-1"
Timothy J. Baek's avatar
Timothy J. Baek committed
556
						step="10"
Timothy J. Baek's avatar
Timothy J. Baek committed
557
558
559
560
561
562
563
					/>
				</div>
			</div>
		{/if}
	</div>
	<div class=" py-0.5 w-full justify-between">
		<div class="flex w-full justify-between">
564
			<div class=" self-center text-xs font-medium">{$i18n.t('Max Tokens')}</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
565
566
567
568
569

			<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
570
					params.num_predict = (params?.num_predict ?? '') === '' ? 128 : '';
Timothy J. Baek's avatar
Timothy J. Baek committed
571
572
				}}
			>
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
573
				{#if (params?.num_predict ?? '') === ''}
574
					<span class="ml-2 self-center">{$i18n.t('Default')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
575
				{:else}
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
576
					<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
Timothy J. Baek's avatar
Timothy J. Baek committed
577
578
579
580
				{/if}
			</button>
		</div>

Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
581
		{#if (params?.num_predict ?? '') !== ''}
Timothy J. Baek's avatar
Timothy J. Baek committed
582
583
584
585
586
587
588
589
			<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"
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
590
						bind:value={params.num_predict}
Timothy J. Baek's avatar
Timothy J. Baek committed
591
592
593
594
595
						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
596
						bind:value={params.num_predict}
Timothy J. Baek's avatar
Timothy J. Baek committed
597
598
599
600
601
602
603
604
605
606
						type="number"
						class=" bg-transparent text-center w-14"
						min="-2"
						max="16000"
						step="1"
					/>
				</div>
			</div>
		{/if}
	</div>
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
607
608
609
610
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
	<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
639
</div>