webui: Add setting to have full height Code Blocks in Chat Messages (#19829)
This commit is contained in:
parent
72b44c0d21
commit
9051663d5d
Binary file not shown.
|
|
@ -114,6 +114,11 @@
|
||||||
label: 'Render user content as Markdown',
|
label: 'Render user content as Markdown',
|
||||||
type: SettingsFieldType.CHECKBOX
|
type: SettingsFieldType.CHECKBOX
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: SETTINGS_KEYS.FULL_HEIGHT_CODE_BLOCKS,
|
||||||
|
label: 'Use full height code blocks',
|
||||||
|
type: SettingsFieldType.CHECKBOX
|
||||||
|
},
|
||||||
{
|
{
|
||||||
key: SETTINGS_KEYS.DISABLE_AUTO_SCROLL,
|
key: SETTINGS_KEYS.DISABLE_AUTO_SCROLL,
|
||||||
label: 'Disable automatic scroll',
|
label: 'Disable automatic scroll',
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,8 @@
|
||||||
import { ActionIconsCodeBlock, DialogCodePreview } from '$lib/components/app';
|
import { ActionIconsCodeBlock, DialogCodePreview } from '$lib/components/app';
|
||||||
import { createAutoScrollController } from '$lib/hooks/use-auto-scroll.svelte';
|
import { createAutoScrollController } from '$lib/hooks/use-auto-scroll.svelte';
|
||||||
import type { DatabaseMessageExtra } from '$lib/types/database';
|
import type { DatabaseMessageExtra } from '$lib/types/database';
|
||||||
|
import { config } from '$lib/stores/settings.svelte';
|
||||||
|
import { SETTINGS_KEYS } from '$lib/constants/settings-keys';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
attachments?: DatabaseMessageExtra[];
|
attachments?: DatabaseMessageExtra[];
|
||||||
|
|
@ -593,7 +595,12 @@
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div bind:this={containerRef} class={className}>
|
<div
|
||||||
|
bind:this={containerRef}
|
||||||
|
class="{className}{config()[SETTINGS_KEYS.FULL_HEIGHT_CODE_BLOCKS]
|
||||||
|
? ' full-height-code-blocks'
|
||||||
|
: ''}"
|
||||||
|
>
|
||||||
{#each renderedBlocks as block (block.id)}
|
{#each renderedBlocks as block (block.id)}
|
||||||
<div class="markdown-block" data-block-id={block.id}>
|
<div class="markdown-block" data-block-id={block.id}>
|
||||||
<!-- eslint-disable-next-line no-at-html-tags -->
|
<!-- eslint-disable-next-line no-at-html-tags -->
|
||||||
|
|
@ -914,6 +921,16 @@
|
||||||
line-height: 1.3;
|
line-height: 1.3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.full-height-code-blocks :global(.code-block-wrapper) {
|
||||||
|
max-height: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.full-height-code-blocks :global(.code-block-scroll-container),
|
||||||
|
.full-height-code-blocks .streaming-code-scroll-container {
|
||||||
|
max-height: none;
|
||||||
|
overflow-y: visible;
|
||||||
|
}
|
||||||
|
|
||||||
div :global(.code-block-header) {
|
div :global(.code-block-header) {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ export const SETTING_CONFIG_DEFAULT: Record<string, string | number | boolean> =
|
||||||
alwaysShowSidebarOnDesktop: false,
|
alwaysShowSidebarOnDesktop: false,
|
||||||
autoShowSidebarOnNewChat: true,
|
autoShowSidebarOnNewChat: true,
|
||||||
autoMicOnEmpty: false,
|
autoMicOnEmpty: false,
|
||||||
|
fullHeightCodeBlocks: false,
|
||||||
// make sure these default values are in sync with `common.h`
|
// make sure these default values are in sync with `common.h`
|
||||||
samplers: 'top_k;typ_p;top_p;min_p;temperature',
|
samplers: 'top_k;typ_p;top_p;min_p;temperature',
|
||||||
backend_sampling: false,
|
backend_sampling: false,
|
||||||
|
|
@ -113,6 +114,8 @@ export const SETTING_CONFIG_INFO: Record<string, string> = {
|
||||||
'Automatically show sidebar when starting a new chat. Disable to keep the sidebar hidden until you click on it.',
|
'Automatically show sidebar when starting a new chat. Disable to keep the sidebar hidden until you click on it.',
|
||||||
autoMicOnEmpty:
|
autoMicOnEmpty:
|
||||||
'Automatically show microphone button instead of send button when textarea is empty for models with audio modality support.',
|
'Automatically show microphone button instead of send button when textarea is empty for models with audio modality support.',
|
||||||
|
fullHeightCodeBlocks:
|
||||||
|
'Always display code blocks at their full natural height, overriding any height limits.',
|
||||||
pyInterpreterEnabled:
|
pyInterpreterEnabled:
|
||||||
'Enable Python interpreter using Pyodide. Allows running Python code in markdown code blocks.',
|
'Enable Python interpreter using Pyodide. Allows running Python code in markdown code blocks.',
|
||||||
enableContinueGeneration:
|
enableContinueGeneration:
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ export const SETTINGS_KEYS = {
|
||||||
DISABLE_AUTO_SCROLL: 'disableAutoScroll',
|
DISABLE_AUTO_SCROLL: 'disableAutoScroll',
|
||||||
ALWAYS_SHOW_SIDEBAR_ON_DESKTOP: 'alwaysShowSidebarOnDesktop',
|
ALWAYS_SHOW_SIDEBAR_ON_DESKTOP: 'alwaysShowSidebarOnDesktop',
|
||||||
AUTO_SHOW_SIDEBAR_ON_NEW_CHAT: 'autoShowSidebarOnNewChat',
|
AUTO_SHOW_SIDEBAR_ON_NEW_CHAT: 'autoShowSidebarOnNewChat',
|
||||||
|
FULL_HEIGHT_CODE_BLOCKS: 'fullHeightCodeBlocks',
|
||||||
// Sampling
|
// Sampling
|
||||||
TEMPERATURE: 'temperature',
|
TEMPERATURE: 'temperature',
|
||||||
DYNATEMP_RANGE: 'dynatemp_range',
|
DYNATEMP_RANGE: 'dynatemp_range',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue