Commit 4d375498 authored by Anuraag Jain's avatar Anuraag Jain
Browse files

fix(model-selector): prevent saving empty default model

- throw a toast error when user is trying to click on `set as default` without actually choosing the model(s).
- feat: added hmr for local development. use `npm run dev` and you get the hmr when debugging.
parent 72524272
......@@ -6,6 +6,11 @@
export let disabled = false;
const saveDefaultModel = () => {
const hasEmptyModel = selectedModels.filter(it => it === '');
if(hasEmptyModel.length){
toast.error('Choose a model before saving...');
return;
}
settings.set({ ...$settings, models: selectedModels });
localStorage.setItem('settings', JSON.stringify($settings));
toast.success('Default model updated');
......@@ -21,7 +26,7 @@
bind:value={selectedModel}
{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}
{#if model.name === 'hr'}
......
......@@ -2,5 +2,8 @@ import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
export default defineConfig({
plugins: [sveltekit()]
plugins: [sveltekit()],
server: {
hmr: true
}
});
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment