AdvancedParams.svelte 18.3 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
						type="number"
						class=" bg-transparent text-center w-14"
						min="0"
						max="1"
Timothy J. Baek's avatar
Timothy J. Baek committed
148
						step="any"
Timothy J. Baek's avatar
Timothy J. Baek committed
149
150
151
152
153
154
155
156
					/>
				</div>
			</div>
		{/if}
	</div>

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

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

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

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

Timothy J. Baek's avatar
Timothy J. Baek committed
220
		{#if (params?.mirostat_eta ?? null) !== null}
Timothy J. Baek's avatar
Timothy J. Baek committed
221
222
223
224
225
226
227
228
			<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
229
						bind:value={params.mirostat_eta}
Timothy J. Baek's avatar
Timothy J. Baek committed
230
231
232
233
234
						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
235
						bind:value={params.mirostat_eta}
Timothy J. Baek's avatar
Timothy J. Baek committed
236
237
238
239
						type="number"
						class=" bg-transparent text-center w-14"
						min="0"
						max="1"
Timothy J. Baek's avatar
Timothy J. Baek committed
240
						step="any"
Timothy J. Baek's avatar
Timothy J. Baek committed
241
242
243
244
245
246
247
248
					/>
				</div>
			</div>
		{/if}
	</div>

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

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

Timothy J. Baek's avatar
Timothy J. Baek committed
266
		{#if (params?.mirostat_tau ?? null) !== null}
Timothy J. Baek's avatar
Timothy J. Baek committed
267
268
269
270
271
272
273
274
			<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
275
						bind:value={params.mirostat_tau}
Timothy J. Baek's avatar
Timothy J. Baek committed
276
277
278
279
280
						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
281
						bind:value={params.mirostat_tau}
Timothy J. Baek's avatar
Timothy J. Baek committed
282
283
284
285
						type="number"
						class=" bg-transparent text-center w-14"
						min="0"
						max="10"
Timothy J. Baek's avatar
Timothy J. Baek committed
286
						step="any"
Timothy J. Baek's avatar
Timothy J. Baek committed
287
288
289
290
291
292
293
294
					/>
				</div>
			</div>
		{/if}
	</div>

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

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

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

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

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

Timothy J. Baek's avatar
Timothy J. Baek committed
358
		{#if (params?.top_p ?? null) !== null}
Timothy J. Baek's avatar
Timothy J. Baek committed
359
360
361
362
363
364
365
366
			<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
367
						bind:value={params.top_p}
Timothy J. Baek's avatar
Timothy J. Baek committed
368
369
370
371
372
						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
373
						bind:value={params.top_p}
Timothy J. Baek's avatar
Timothy J. Baek committed
374
375
376
377
						type="number"
						class=" bg-transparent text-center w-14"
						min="0"
						max="1"
Timothy J. Baek's avatar
Timothy J. Baek committed
378
						step="any"
Timothy J. Baek's avatar
Timothy J. Baek committed
379
380
381
382
383
384
385
386
					/>
				</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
387
			<div class=" self-center text-xs font-medium">{$i18n.t('Frequency Penalty')}</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
388
389
390
391
392

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

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

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

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

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

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

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

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

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

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

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

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

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

Timothy J. Baek's avatar
Timothy J. Baek committed
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
	{#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>
633
634
		</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
		<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>
653
654
		</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
		<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>
673

Timothy J. Baek's avatar
Timothy J. Baek committed
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
			{#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}
699
700
		</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
		<!-- <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>
718
719
			</div>

Timothy J. Baek's avatar
Timothy J. Baek committed
720
721
722
723
724
725
726
727
728
729
			{#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
730
				</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
731
732
733
			{/if}
		</div> -->
	{/if}
Timothy J. Baek's avatar
Timothy J. Baek committed
734
</div>