Andrew commited on
Commit
3c1958b
·
1 Parent(s): 8a9fb43

fix(ui): fix type errors in model settings page

Browse files
src/routes/settings/(nav)/models/[...model]/+page.svelte CHANGED
@@ -25,30 +25,34 @@
25
 
26
  // Initialize multimodal override for this model if not set yet
27
  $effect(() => {
28
- if (!$settings.multimodalOverrides) {
29
- $settings.multimodalOverrides = {};
30
- }
31
  const modelId = page.params.model;
32
- if ($settings.multimodalOverrides[modelId] === undefined && model) {
33
- // Default to the model's advertised capability
34
- $settings.multimodalOverrides = {
35
- ...$settings.multimodalOverrides,
36
- [modelId]: !!model.multimodal,
37
- };
 
 
 
 
 
38
  }
39
  });
40
 
41
  // Ensure hidePromptExamples has an entry for this model so the switch can bind safely
42
  $effect(() => {
43
- if (!$settings.hidePromptExamples) {
44
- $settings.hidePromptExamples = {};
45
- }
46
  const modelId = page.params.model;
47
- if ($settings.hidePromptExamples[modelId] === undefined) {
48
- $settings.hidePromptExamples = {
49
- ...$settings.hidePromptExamples,
50
- [modelId]: false,
51
- };
 
 
 
 
 
52
  }
53
  });
54
  </script>
@@ -174,7 +178,7 @@
174
  </div>
175
  <Switch
176
  name="forceMultimodal"
177
- bind:checked={$settings.multimodalOverrides[page.params.model]}
178
  />
179
  </div>
180
 
@@ -190,7 +194,7 @@
190
  </div>
191
  <Switch
192
  name="hidePromptExamples"
193
- bind:checked={$settings.hidePromptExamples[page.params.model]}
194
  />
195
  </div>
196
  {/if}
 
25
 
26
  // Initialize multimodal override for this model if not set yet
27
  $effect(() => {
 
 
 
28
  const modelId = page.params.model;
29
+ if (modelId) {
30
+ if (!$settings.multimodalOverrides) {
31
+ $settings.multimodalOverrides = {};
32
+ }
33
+ if ($settings.multimodalOverrides[modelId] === undefined && model) {
34
+ // Default to the model's advertised capability
35
+ $settings.multimodalOverrides = {
36
+ ...$settings.multimodalOverrides,
37
+ [modelId]: !!model.multimodal,
38
+ };
39
+ }
40
  }
41
  });
42
 
43
  // Ensure hidePromptExamples has an entry for this model so the switch can bind safely
44
  $effect(() => {
 
 
 
45
  const modelId = page.params.model;
46
+ if (modelId) {
47
+ if (!$settings.hidePromptExamples) {
48
+ $settings.hidePromptExamples = {};
49
+ }
50
+ if ($settings.hidePromptExamples[modelId] === undefined) {
51
+ $settings.hidePromptExamples = {
52
+ ...$settings.hidePromptExamples,
53
+ [modelId]: false,
54
+ };
55
+ }
56
  }
57
  });
58
  </script>
 
178
  </div>
179
  <Switch
180
  name="forceMultimodal"
181
+ bind:checked={$settings.multimodalOverrides[page.params.model ?? ""]}
182
  />
183
  </div>
184
 
 
194
  </div>
195
  <Switch
196
  name="hidePromptExamples"
197
+ bind:checked={$settings.hidePromptExamples[page.params.model ?? ""]}
198
  />
199
  </div>
200
  {/if}