forked from open-webui/open-webui
		
	Settings were being referenced incorrectly and as a result, no settings were being sent to openai endpoint. Added num_predict slider in advanced UI. Also added seed, stop and max_tokens (uses num_predict) being sent to openai endpoint.
This commit is contained in:
		
							parent
							
								
									87f5e72eeb
								
							
						
					
					
						commit
						431b710e46
					
				
					 5 changed files with 69 additions and 12 deletions
				
			
		| 
						 | 
				
			
			@ -12,7 +12,8 @@
 | 
			
		|||
		top_k: '',
 | 
			
		||||
		top_p: '',
 | 
			
		||||
		tfs_z: '',
 | 
			
		||||
		num_ctx: ''
 | 
			
		||||
		num_ctx: '',
 | 
			
		||||
		num_predict: ''
 | 
			
		||||
	};
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -507,4 +508,49 @@
 | 
			
		|||
			</div>
 | 
			
		||||
		{/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">Max Tokens</div>
 | 
			
		||||
 | 
			
		||||
			<button
 | 
			
		||||
				class="p-1 px-3 text-xs flex rounded transition"
 | 
			
		||||
				type="button"
 | 
			
		||||
				on:click={() => {
 | 
			
		||||
					options.num_predict = options.num_predict === '' ? 256 : '';
 | 
			
		||||
				}}
 | 
			
		||||
			>
 | 
			
		||||
				{#if options.num_predict === ''}
 | 
			
		||||
					<span class="ml-2 self-center"> Default </span>
 | 
			
		||||
				{:else}
 | 
			
		||||
					<span class="ml-2 self-center"> Custom </span>
 | 
			
		||||
				{/if}
 | 
			
		||||
			</button>
 | 
			
		||||
		</div>
 | 
			
		||||
 | 
			
		||||
		{#if options.num_predict !== ''}
 | 
			
		||||
			<div class="flex mt-0.5 space-x-2">
 | 
			
		||||
				<div class=" flex-1">
 | 
			
		||||
					<input
 | 
			
		||||
						id="steps-range"
 | 
			
		||||
						type="range"
 | 
			
		||||
						min="1"
 | 
			
		||||
						max="16000"
 | 
			
		||||
						step="1"
 | 
			
		||||
						bind:value={options.num_predict}
 | 
			
		||||
						class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
 | 
			
		||||
					/>
 | 
			
		||||
				</div>
 | 
			
		||||
				<div class="">
 | 
			
		||||
					<input
 | 
			
		||||
						bind:value={options.num_predict}
 | 
			
		||||
						type="number"
 | 
			
		||||
						class=" bg-transparent text-center w-14"
 | 
			
		||||
						min="1"
 | 
			
		||||
						max="16000"
 | 
			
		||||
						step="1"
 | 
			
		||||
					/>
 | 
			
		||||
				</div>
 | 
			
		||||
			</div>
 | 
			
		||||
		{/if}
 | 
			
		||||
	</div>
 | 
			
		||||
</div>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -52,7 +52,8 @@
 | 
			
		|||
		top_p: '',
 | 
			
		||||
		stop: '',
 | 
			
		||||
		tfs_z: '',
 | 
			
		||||
		num_ctx: ''
 | 
			
		||||
		num_ctx: '',
 | 
			
		||||
		num_predict: ''
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	// Models
 | 
			
		||||
| 
						 | 
				
			
			@ -644,6 +645,7 @@
 | 
			
		|||
		options.top_k = settings.top_k ?? '';
 | 
			
		||||
		options.top_p = settings.top_p ?? '';
 | 
			
		||||
		options.num_ctx = settings.num_ctx ?? '';
 | 
			
		||||
		options.num_predict = settings.num_predict ?? '';
 | 
			
		||||
		options = { ...options, ...settings.options };
 | 
			
		||||
		options.stop = (settings?.options?.stop ?? []).join(',');
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1122,7 +1124,8 @@
 | 
			
		|||
											top_k: options.top_k !== '' ? options.top_k : undefined,
 | 
			
		||||
											top_p: options.top_p !== '' ? options.top_p : undefined,
 | 
			
		||||
											tfs_z: options.tfs_z !== '' ? options.tfs_z : undefined,
 | 
			
		||||
											num_ctx: options.num_ctx !== '' ? options.num_ctx : undefined
 | 
			
		||||
											num_ctx: options.num_ctx !== '' ? options.num_ctx : undefined,
 | 
			
		||||
											num_predict: options.num_predict !== '' ? options.num_predict : undefined
 | 
			
		||||
										}
 | 
			
		||||
									});
 | 
			
		||||
									show = false;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue