Skip to content

Commit 63d7683

Browse files
committed
Disable multimodal override for HuggingChat models
Prevents users from overriding multimodal capability for models when using HuggingChat, as this is now controlled by the endpoint. Updates both the server logic and the settings UI to reflect this behavior, displaying the model's capability status instead of a toggle.
1 parent cb586b3 commit 63d7683

File tree

2 files changed

+29
-11
lines changed

2 files changed

+29
-11
lines changed

src/routes/conversation/[id]/+server.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -453,11 +453,14 @@ export async function POST({ request, locals, params, getClientAddress }) {
453453
ip: getClientAddress(),
454454
username: locals.user?.username,
455455
// Force-enable multimodal if user settings say so for this model
456-
forceMultimodal: Boolean(
457-
(await collections.settings.findOne(authCondition(locals)))?.multimodalOverrides?.[
458-
model.id
459-
]
460-
),
456+
// In HuggingChat, ignore user overrides - multimodal is controlled by the endpoint
457+
forceMultimodal: config.isHuggingChat
458+
? false
459+
: Boolean(
460+
(await collections.settings.findOne(authCondition(locals)))?.multimodalOverrides?.[
461+
model.id
462+
]
463+
),
461464
locals,
462465
abortController: ctrl,
463466
};

src/routes/settings/(nav)/[...model]/+page.svelte

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
import CarbonCopy from "~icons/carbon/copy";
1111
import CarbonChat from "~icons/carbon/chat";
1212
import CarbonCode from "~icons/carbon/code";
13+
import CarbonCheckmarkFilled from "~icons/carbon/checkmark-filled";
14+
import CarbonCloseFilled from "~icons/carbon/close-filled";
1315
1416
import { goto } from "$app/navigation";
1517
import { usePublicConfig } from "$lib/utils/PublicConfig.svelte";
@@ -35,8 +37,9 @@
3537
let providerList: RouterProvider[] = $derived((model?.providers ?? []) as RouterProvider[]);
3638
3739
// Initialize multimodal override for this model if not set yet
40+
// Skip initialization for HuggingChat where multimodal is controlled by the endpoint
3841
$effect(() => {
39-
if (model) {
42+
if (model && !publicConfig.isHuggingChat) {
4043
// Default to the model's advertised capability
4144
settings.initValue("multimodalOverrides", page.params.model, !!model.multimodal);
4245
}
@@ -185,13 +188,25 @@
185188
Supports image inputs (multimodal)
186189
</div>
187190
<p class="text-[12px] text-gray-500 dark:text-gray-400">
188-
Enable image uploads and send images to this model.
191+
{#if publicConfig.isHuggingChat}
192+
This capability is determined by the model.
193+
{:else}
194+
Enable image uploads and send images to this model.
195+
{/if}
189196
</p>
190197
</div>
191-
<Switch
192-
name="forceMultimodal"
193-
bind:checked={$settings.multimodalOverrides[page.params.model]}
194-
/>
198+
{#if publicConfig.isHuggingChat}
199+
{#if model.multimodal}
200+
<CarbonCheckmarkFilled class="text-blue-600 dark:text-blue-500" />
201+
{:else}
202+
<CarbonCloseFilled class="text-gray-400 dark:text-gray-600" />
203+
{/if}
204+
{:else}
205+
<Switch
206+
name="forceMultimodal"
207+
bind:checked={$settings.multimodalOverrides[page.params.model]}
208+
/>
209+
{/if}
195210
</div>
196211

197212
{#if model?.isRouter}

0 commit comments

Comments
 (0)