forked from open-webui/open-webui
		
	Merge pull request #308 from anuraagdjain/fix/model-saving
fix(model-selector): prevent saving empty default model
This commit is contained in:
		
						commit
						8370465796
					
				
					 1 changed files with 6 additions and 1 deletions
				
			
		|  | @ -6,6 +6,11 @@ | ||||||
| 	export let disabled = false; | 	export let disabled = false; | ||||||
| 
 | 
 | ||||||
| 	const saveDefaultModel = () => { | 	const saveDefaultModel = () => { | ||||||
|  | 		const hasEmptyModel = selectedModels.filter(it => it === ''); | ||||||
|  | 		if(hasEmptyModel.length){ | ||||||
|  | 			toast.error('Choose a model before saving...'); | ||||||
|  | 			return; | ||||||
|  | 		} | ||||||
| 		settings.set({ ...$settings, models: selectedModels }); | 		settings.set({ ...$settings, models: selectedModels }); | ||||||
| 		localStorage.setItem('settings', JSON.stringify($settings)); | 		localStorage.setItem('settings', JSON.stringify($settings)); | ||||||
| 		toast.success('Default model updated'); | 		toast.success('Default model updated'); | ||||||
|  | @ -21,7 +26,7 @@ | ||||||
| 				bind:value={selectedModel} | 				bind:value={selectedModel} | ||||||
| 				{disabled} | 				{disabled} | ||||||
| 			> | 			> | ||||||
| 				<option class=" text-gray-700" value="" selected>Select a model</option> | 				<option class=" text-gray-700" value="" selected disabled>Select a model</option> | ||||||
| 
 | 
 | ||||||
| 				{#each $models as model} | 				{#each $models as model} | ||||||
| 					{#if model.name === 'hr'} | 					{#if model.name === 'hr'} | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Timothy Jaeryang Baek
						Timothy Jaeryang Baek