SvelteKit-based WebUI (#14839)
This commit is contained in:
committed by
GitHub
parent
8f8f2274ee
commit
a7a98e0fff
3
tools/server/webui/src/lib/constants/auto-scroll.ts
Normal file
3
tools/server/webui/src/lib/constants/auto-scroll.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export const AUTO_SCROLL_INTERVAL = 100;
|
||||
export const INITIAL_SCROLL_DELAY = 50;
|
||||
export const AUTO_SCROLL_AT_BOTTOM_THRESHOLD = 10;
|
||||
1
tools/server/webui/src/lib/constants/debounce.ts
Normal file
1
tools/server/webui/src/lib/constants/debounce.ts
Normal file
@@ -0,0 +1 @@
|
||||
export const SLOTS_DEBOUNCE_INTERVAL = 100;
|
||||
6
tools/server/webui/src/lib/constants/input-classes.ts
Normal file
6
tools/server/webui/src/lib/constants/input-classes.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export const INPUT_CLASSES = `
|
||||
bg-muted/70 dark:bg-muted/85
|
||||
border border-border/30 focus-within:border-border dark:border-border/20 dark:focus-within:border-border
|
||||
outline-none
|
||||
text-foreground
|
||||
`;
|
||||
1
tools/server/webui/src/lib/constants/max-bundle-size.ts
Normal file
1
tools/server/webui/src/lib/constants/max-bundle-size.ts
Normal file
@@ -0,0 +1 @@
|
||||
export const MAX_BUNDLE_SIZE = 2 * 1024 * 1024;
|
||||
1
tools/server/webui/src/lib/constants/processing-info.ts
Normal file
1
tools/server/webui/src/lib/constants/processing-info.ts
Normal file
@@ -0,0 +1 @@
|
||||
export const PROCESSING_INFO_TIMEOUT = 2000;
|
||||
84
tools/server/webui/src/lib/constants/settings-config.ts
Normal file
84
tools/server/webui/src/lib/constants/settings-config.ts
Normal file
@@ -0,0 +1,84 @@
|
||||
export const SETTING_CONFIG_DEFAULT: Record<string, string | number | boolean> = {
|
||||
// Note: in order not to introduce breaking changes, please keep the same data type (number, string, etc) if you want to change the default value. Do not use null or undefined for default value.
|
||||
// Do not use nested objects, keep it single level. Prefix the key if you need to group them.
|
||||
apiKey: '',
|
||||
systemMessage: '',
|
||||
theme: 'system',
|
||||
showTokensPerSecond: false,
|
||||
showThoughtInProgress: false,
|
||||
keepStatsVisible: false,
|
||||
askForTitleConfirmation: false,
|
||||
pasteLongTextToFileLen: 2500,
|
||||
pdfAsImage: false,
|
||||
// make sure these default values are in sync with `common.h`
|
||||
samplers: 'top_k;typ_p;top_p;min_p;temperature',
|
||||
temperature: 0.8,
|
||||
dynatemp_range: 0.0,
|
||||
dynatemp_exponent: 1.0,
|
||||
top_k: 40,
|
||||
top_p: 0.95,
|
||||
min_p: 0.05,
|
||||
xtc_probability: 0.0,
|
||||
xtc_threshold: 0.1,
|
||||
typ_p: 1.0,
|
||||
repeat_last_n: 64,
|
||||
repeat_penalty: 1.0,
|
||||
presence_penalty: 0.0,
|
||||
frequency_penalty: 0.0,
|
||||
dry_multiplier: 0.0,
|
||||
dry_base: 1.75,
|
||||
dry_allowed_length: 2,
|
||||
dry_penalty_last_n: -1,
|
||||
max_tokens: -1,
|
||||
custom: '', // custom json-stringified object
|
||||
// experimental features
|
||||
pyInterpreterEnabled: false
|
||||
};
|
||||
|
||||
export const SETTING_CONFIG_INFO: Record<string, string> = {
|
||||
apiKey: 'Set the API Key if you are using --api-key option for the server.',
|
||||
systemMessage: 'The starting message that defines how model should behave.',
|
||||
theme:
|
||||
'Choose the color theme for the interface. You can choose between System (follows your device settings), Light, or Dark.',
|
||||
pasteLongTextToFileLen:
|
||||
'On pasting long text, it will be converted to a file. You can control the file length by setting the value of this parameter. Value 0 means disable.',
|
||||
samplers:
|
||||
'The order at which samplers are applied, in simplified way. Default is "top_k;typ_p;top_p;min_p;temperature": top_k->typ_p->top_p->min_p->temperature',
|
||||
temperature:
|
||||
'Controls the randomness of the generated text by affecting the probability distribution of the output tokens. Higher = more random, lower = more focused.',
|
||||
dynatemp_range:
|
||||
'Addon for the temperature sampler. The added value to the range of dynamic temperature, which adjusts probabilities by entropy of tokens.',
|
||||
dynatemp_exponent:
|
||||
'Addon for the temperature sampler. Smoothes out the probability redistribution based on the most probable token.',
|
||||
top_k: 'Keeps only k top tokens.',
|
||||
top_p: 'Limits tokens to those that together have a cumulative probability of at least p',
|
||||
min_p:
|
||||
'Limits tokens based on the minimum probability for a token to be considered, relative to the probability of the most likely token.',
|
||||
xtc_probability:
|
||||
'XTC sampler cuts out top tokens; this parameter controls the chance of cutting tokens at all. 0 disables XTC.',
|
||||
xtc_threshold:
|
||||
'XTC sampler cuts out top tokens; this parameter controls the token probability that is required to cut that token.',
|
||||
typ_p: 'Sorts and limits tokens based on the difference between log-probability and entropy.',
|
||||
repeat_last_n: 'Last n tokens to consider for penalizing repetition',
|
||||
repeat_penalty: 'Controls the repetition of token sequences in the generated text',
|
||||
presence_penalty: 'Limits tokens based on whether they appear in the output or not.',
|
||||
frequency_penalty: 'Limits tokens based on how often they appear in the output.',
|
||||
dry_multiplier:
|
||||
'DRY sampling reduces repetition in generated text even across long contexts. This parameter sets the DRY sampling multiplier.',
|
||||
dry_base:
|
||||
'DRY sampling reduces repetition in generated text even across long contexts. This parameter sets the DRY sampling base value.',
|
||||
dry_allowed_length:
|
||||
'DRY sampling reduces repetition in generated text even across long contexts. This parameter sets the allowed length for DRY sampling.',
|
||||
dry_penalty_last_n:
|
||||
'DRY sampling reduces repetition in generated text even across long contexts. This parameter sets DRY penalty for the last n tokens.',
|
||||
max_tokens: 'The maximum number of token per output. Use -1 for infinite (no limit).',
|
||||
custom: 'Custom JSON parameters to send to the API. Must be valid JSON format.',
|
||||
showTokensPerSecond: 'Display generation speed in tokens per second during streaming.',
|
||||
showThoughtInProgress: 'Expand thought process by default when generating messages.',
|
||||
keepStatsVisible: 'Keep processing statistics visible after generation finishes.',
|
||||
askForTitleConfirmation:
|
||||
'Ask for confirmation before automatically changing conversation title when editing the first message.',
|
||||
pdfAsImage: 'Parse PDF as image instead of text (requires vision-capable model).',
|
||||
pyInterpreterEnabled:
|
||||
'Enable Python interpreter using Pyodide. Allows running Python code in markdown code blocks.'
|
||||
};
|
||||
180
tools/server/webui/src/lib/constants/supported-file-types.ts
Normal file
180
tools/server/webui/src/lib/constants/supported-file-types.ts
Normal file
@@ -0,0 +1,180 @@
|
||||
/**
|
||||
* Comprehensive dictionary of all supported file types in webui
|
||||
* Organized by category with TypeScript enums for better type safety
|
||||
*/
|
||||
|
||||
import {
|
||||
FileExtensionAudio,
|
||||
FileExtensionImage,
|
||||
FileExtensionPdf,
|
||||
FileExtensionText,
|
||||
FileTypeAudio,
|
||||
FileTypeImage,
|
||||
FileTypePdf,
|
||||
FileTypeText,
|
||||
MimeTypeAudio,
|
||||
MimeTypeImage,
|
||||
MimeTypeApplication,
|
||||
MimeTypeText
|
||||
} from '$lib/enums/files';
|
||||
|
||||
// File type configuration using enums
|
||||
export const AUDIO_FILE_TYPES = {
|
||||
[FileTypeAudio.MP3]: {
|
||||
extensions: [FileExtensionAudio.MP3],
|
||||
mimeTypes: [MimeTypeAudio.MP3_MPEG, MimeTypeAudio.MP3]
|
||||
},
|
||||
[FileTypeAudio.WAV]: {
|
||||
extensions: [FileExtensionAudio.WAV],
|
||||
mimeTypes: [MimeTypeAudio.WAV]
|
||||
}
|
||||
} as const;
|
||||
|
||||
export const IMAGE_FILE_TYPES = {
|
||||
[FileTypeImage.JPEG]: {
|
||||
extensions: [FileExtensionImage.JPG, FileExtensionImage.JPEG],
|
||||
mimeTypes: [MimeTypeImage.JPEG]
|
||||
},
|
||||
[FileTypeImage.PNG]: {
|
||||
extensions: [FileExtensionImage.PNG],
|
||||
mimeTypes: [MimeTypeImage.PNG]
|
||||
},
|
||||
[FileTypeImage.GIF]: {
|
||||
extensions: [FileExtensionImage.GIF],
|
||||
mimeTypes: [MimeTypeImage.GIF]
|
||||
},
|
||||
[FileTypeImage.WEBP]: {
|
||||
extensions: [FileExtensionImage.WEBP],
|
||||
mimeTypes: [MimeTypeImage.WEBP]
|
||||
},
|
||||
[FileTypeImage.SVG]: {
|
||||
extensions: [FileExtensionImage.SVG],
|
||||
mimeTypes: [MimeTypeImage.SVG]
|
||||
}
|
||||
} as const;
|
||||
|
||||
export const PDF_FILE_TYPES = {
|
||||
[FileTypePdf.PDF]: {
|
||||
extensions: [FileExtensionPdf.PDF],
|
||||
mimeTypes: [MimeTypeApplication.PDF]
|
||||
}
|
||||
} as const;
|
||||
|
||||
export const TEXT_FILE_TYPES = {
|
||||
[FileTypeText.PLAIN_TEXT]: {
|
||||
extensions: [FileExtensionText.TXT],
|
||||
mimeTypes: [MimeTypeText.PLAIN]
|
||||
},
|
||||
[FileTypeText.MARKDOWN]: {
|
||||
extensions: [FileExtensionText.MD],
|
||||
mimeTypes: [MimeTypeText.MARKDOWN]
|
||||
},
|
||||
[FileTypeText.JAVASCRIPT]: {
|
||||
extensions: [FileExtensionText.JS],
|
||||
mimeTypes: [MimeTypeText.JAVASCRIPT, MimeTypeText.JAVASCRIPT_APP]
|
||||
},
|
||||
[FileTypeText.TYPESCRIPT]: {
|
||||
extensions: [FileExtensionText.TS],
|
||||
mimeTypes: [MimeTypeText.TYPESCRIPT]
|
||||
},
|
||||
[FileTypeText.JSX]: {
|
||||
extensions: [FileExtensionText.JSX],
|
||||
mimeTypes: [MimeTypeText.JSX]
|
||||
},
|
||||
[FileTypeText.TSX]: {
|
||||
extensions: [FileExtensionText.TSX],
|
||||
mimeTypes: [MimeTypeText.TSX]
|
||||
},
|
||||
[FileTypeText.CSS]: {
|
||||
extensions: [FileExtensionText.CSS],
|
||||
mimeTypes: [MimeTypeText.CSS]
|
||||
},
|
||||
[FileTypeText.HTML]: {
|
||||
extensions: [FileExtensionText.HTML, FileExtensionText.HTM],
|
||||
mimeTypes: [MimeTypeText.HTML]
|
||||
},
|
||||
[FileTypeText.JSON]: {
|
||||
extensions: [FileExtensionText.JSON],
|
||||
mimeTypes: [MimeTypeText.JSON]
|
||||
},
|
||||
[FileTypeText.XML]: {
|
||||
extensions: [FileExtensionText.XML],
|
||||
mimeTypes: [MimeTypeText.XML_TEXT, MimeTypeText.XML_APP]
|
||||
},
|
||||
[FileTypeText.YAML]: {
|
||||
extensions: [FileExtensionText.YAML, FileExtensionText.YML],
|
||||
mimeTypes: [MimeTypeText.YAML_TEXT, MimeTypeText.YAML_APP]
|
||||
},
|
||||
[FileTypeText.CSV]: {
|
||||
extensions: [FileExtensionText.CSV],
|
||||
mimeTypes: [MimeTypeText.CSV]
|
||||
},
|
||||
[FileTypeText.LOG]: {
|
||||
extensions: [FileExtensionText.LOG],
|
||||
mimeTypes: [MimeTypeText.PLAIN]
|
||||
},
|
||||
[FileTypeText.PYTHON]: {
|
||||
extensions: [FileExtensionText.PY],
|
||||
mimeTypes: [MimeTypeText.PYTHON]
|
||||
},
|
||||
[FileTypeText.JAVA]: {
|
||||
extensions: [FileExtensionText.JAVA],
|
||||
mimeTypes: [MimeTypeText.JAVA]
|
||||
},
|
||||
[FileTypeText.CPP]: {
|
||||
extensions: [FileExtensionText.CPP, FileExtensionText.C, FileExtensionText.H],
|
||||
mimeTypes: [MimeTypeText.CPP_SRC, MimeTypeText.C_SRC, MimeTypeText.C_HDR]
|
||||
},
|
||||
[FileTypeText.PHP]: {
|
||||
extensions: [FileExtensionText.PHP],
|
||||
mimeTypes: [MimeTypeText.PHP]
|
||||
},
|
||||
[FileTypeText.RUBY]: {
|
||||
extensions: [FileExtensionText.RB],
|
||||
mimeTypes: [MimeTypeText.RUBY]
|
||||
},
|
||||
[FileTypeText.GO]: {
|
||||
extensions: [FileExtensionText.GO],
|
||||
mimeTypes: [MimeTypeText.GO]
|
||||
},
|
||||
[FileTypeText.RUST]: {
|
||||
extensions: [FileExtensionText.RS],
|
||||
mimeTypes: [MimeTypeText.RUST]
|
||||
},
|
||||
[FileTypeText.SHELL]: {
|
||||
extensions: [FileExtensionText.SH, FileExtensionText.BAT],
|
||||
mimeTypes: [MimeTypeText.SHELL, MimeTypeText.BAT]
|
||||
},
|
||||
[FileTypeText.SQL]: {
|
||||
extensions: [FileExtensionText.SQL],
|
||||
mimeTypes: [MimeTypeText.SQL]
|
||||
},
|
||||
[FileTypeText.R]: {
|
||||
extensions: [FileExtensionText.R],
|
||||
mimeTypes: [MimeTypeText.R]
|
||||
},
|
||||
[FileTypeText.SCALA]: {
|
||||
extensions: [FileExtensionText.SCALA],
|
||||
mimeTypes: [MimeTypeText.SCALA]
|
||||
},
|
||||
[FileTypeText.KOTLIN]: {
|
||||
extensions: [FileExtensionText.KT],
|
||||
mimeTypes: [MimeTypeText.KOTLIN]
|
||||
},
|
||||
[FileTypeText.SWIFT]: {
|
||||
extensions: [FileExtensionText.SWIFT],
|
||||
mimeTypes: [MimeTypeText.SWIFT]
|
||||
},
|
||||
[FileTypeText.DART]: {
|
||||
extensions: [FileExtensionText.DART],
|
||||
mimeTypes: [MimeTypeText.DART]
|
||||
},
|
||||
[FileTypeText.VUE]: {
|
||||
extensions: [FileExtensionText.VUE],
|
||||
mimeTypes: [MimeTypeText.VUE]
|
||||
},
|
||||
[FileTypeText.SVELTE]: {
|
||||
extensions: [FileExtensionText.SVELTE],
|
||||
mimeTypes: [MimeTypeText.SVELTE]
|
||||
}
|
||||
} as const;
|
||||
1
tools/server/webui/src/lib/constants/tooltip-config.ts
Normal file
1
tools/server/webui/src/lib/constants/tooltip-config.ts
Normal file
@@ -0,0 +1 @@
|
||||
export const TOOLTIP_DELAY_DURATION = 100;
|
||||
1
tools/server/webui/src/lib/constants/viewport.ts
Normal file
1
tools/server/webui/src/lib/constants/viewport.ts
Normal file
@@ -0,0 +1 @@
|
||||
export const DEFAULT_MOBILE_BREAKPOINT = 768;
|
||||
Reference in New Issue
Block a user