Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion tools/ui/src/lib/constants/settings-keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,6 @@ export const SETTINGS_KEYS = {
EXCLUDE_REASONING_FROM_CONTEXT: 'excludeReasoningFromContext',
SHOW_RAW_OUTPUT_SWITCH: 'showRawOutputSwitch',
// PY_INTERPRETER_ENABLED: 'pyInterpreterEnabled',
CUSTOM: 'custom'
CUSTOM_JSON: 'custom',
Comment thread
ServeurpersoCom marked this conversation as resolved.
Outdated
CUSTOM_CSS: 'customCss'
} as const;
14 changes: 13 additions & 1 deletion tools/ui/src/lib/constants/settings-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -659,12 +659,24 @@ const SETTINGS_REGISTRY: Record<string, SettingsSectionEntry> = {
}
},
{
key: SETTINGS_KEYS.CUSTOM,
key: SETTINGS_KEYS.CUSTOM_JSON,
label: 'Custom JSON',
help: 'Custom JSON parameters to send to the API. Must be valid JSON format.',
defaultValue: '',
type: SettingsFieldType.TEXTAREA,
section: SETTINGS_SECTION_SLUGS.DEVELOPER
},
{
key: SETTINGS_KEYS.CUSTOM_CSS,
label: 'Custom CSS',
help: 'CSS injected into the page at runtime. Set it here, or ship it server side via the --ui-config customCss field.',
defaultValue: '',
type: SettingsFieldType.TEXTAREA,
section: SETTINGS_SECTION_SLUGS.DEVELOPER,
sync: {
serverKey: SETTINGS_KEYS.CUSTOM_CSS,
paramType: SyncableParameterType.STRING
}
}
]
},
Expand Down
12 changes: 12 additions & 0 deletions tools/ui/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,14 @@
}
});

// Inject custom CSS at runtime through an action on the head style node
// textContent keeps the value as text, never parsed as HTML
function customCss(node: HTMLStyleElement) {
$effect(() => {
node.textContent = (config().customCss as string | undefined) ?? '';
});
}

// Fetch router models when in router mode (for status and modalities)
// Wait for models to be loaded first, run only once
let routerModelsFetched = false;
Expand Down Expand Up @@ -227,6 +235,10 @@
});
</script>

<svelte:head>
<style use:customCss></style>
</svelte:head>
Comment thread
ServeurpersoCom marked this conversation as resolved.

<Tooltip.Provider delayDuration={TOOLTIP_DELAY_DURATION}>
<ModeWatcher />
<Toaster richColors />
Expand Down
Loading