Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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: 'custom',
Comment thread
ServeurpersoCom marked this conversation as resolved.
Outdated
CUSTOM_CSS: 'customCSS'
Comment thread
ServeurpersoCom marked this conversation as resolved.
Outdated
} as const;
12 changes: 12 additions & 0 deletions tools/ui/src/lib/constants/settings-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,18 @@ const SETTINGS_REGISTRY: Record<string, SettingsSectionEntry> = {
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
17 changes: 17 additions & 0 deletions tools/ui/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,23 @@
}
});

// Inject custom CSS at runtime, reactive on the customCSS setting
$effect(() => {
if (!browser) return;

const css = (config().customCSS as string | undefined) ?? '';

let style = document.getElementById('llama-custom-css') as HTMLStyleElement | null;

if (!style) {
style = document.createElement('style');
style.id = 'llama-custom-css';
document.head.appendChild(style);
}

style.textContent = css;
});
Comment thread
ServeurpersoCom marked this conversation as resolved.
Outdated

// 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
Loading