char-fork/llama.cpp
git clone https://git.t4t.associates/char-fork/llama.cpp
cae63579b
char/aliceai-t5-moe
1import { CLI_FLAGS } from './cli-flags.constants' ; 2import { DEFAULT_MCP_CONFIG } from './mcp.constants' ; 3import { SETTINGS_KEYS } from './settings-keys.constants' ; 4import { TITLE_GENERATION } from './title-generation.constants' ; 5import { FILE_GLOB_SEARCH_PICKERS } from './working-directory.constants' ; 6import { 7Code , 8Database , 9Funnel , 10ListRestart , 11Monitor , 12Moon , 13PencilRuler , 14SlidersVertical , 15Sun 16} from '@lucide/svelte' ; 17import { SyncableParameterType } from '$lib/enums' ; 18import { SettingsFieldType } from '$lib/enums/settings.enums' ; 19import { ColorMode } from '$lib/enums/ui.enums' ; 20import type { 21SettingsConfigValue , 22SettingsEntry , 23SettingsFieldConfig , 24SettingsSection , 25SettingsSectionEntry 26} from '$lib/types' ; 27 28/** Settings sections — slug is the routing identity, title is the display label. */ 29export const SETTINGS_SECTIONS = { 30AGENTIC :{ slug :'agentic' , title :'Agentic' }, 31DEVELOPER :{ slug :'developer' , title :'Developer' }, 32DISPLAY :{ slug :'display' , title :'Display' }, 33GENERAL :{ slug :'general' , title :'General' }, 34IMPORT_EXPORT :{ slug :'import-export' , title :'Import/Export' }, 35SAMPLING_PENALTIES :{ slug :'sampling-penalties' , title :'Sampling & Penalties' }, 36TOOLS :{ slug :'tools' , title :'Tools' } 37} as const ; 38 39export const SETTINGS_SECTION_SLUGS = { 40AGENTIC :SETTINGS_SECTIONS . AGENTIC . slug , 41DEVELOPER :SETTINGS_SECTIONS . DEVELOPER . slug , 42DISPLAY :SETTINGS_SECTIONS . DISPLAY . slug , 43GENERAL :SETTINGS_SECTIONS . GENERAL . slug , 44IMPORT_EXPORT :SETTINGS_SECTIONS . IMPORT_EXPORT . slug , 45SAMPLING_PENALTIES :SETTINGS_SECTIONS . SAMPLING_PENALTIES . slug , 46TOOLS :SETTINGS_SECTIONS . TOOLS . slug 47} as const ; 48 49export const SETTINGS_SECTION_TITLES = { 50AGENTIC :SETTINGS_SECTIONS . AGENTIC . title , 51DEVELOPER :SETTINGS_SECTIONS . DEVELOPER . title , 52DISPLAY :SETTINGS_SECTIONS . DISPLAY . title , 53GENERAL :SETTINGS_SECTIONS . GENERAL . title , 54IMPORT_EXPORT :SETTINGS_SECTIONS . IMPORT_EXPORT . title , 55SAMPLING_PENALTIES :SETTINGS_SECTIONS . SAMPLING_PENALTIES . title , 56TOOLS :SETTINGS_SECTIONS . TOOLS . title 57} as const ; 58 59export const SETTINGS_REGISTRY :SettingsSectionEntry [] = [ 60// General 61{ 62icon :SlidersVertical , 63settings :[ 64{ 65defaultValue :ColorMode . SYSTEM , 66help :'Choose the color theme for the interface. You can choose between System (follows your device settings), Light, or Dark.' , 67key :SETTINGS_KEYS . THEME , 68label :'Theme' , 69options :[ 70{ icon :Monitor , label :'System' , value :ColorMode . SYSTEM }, 71{ icon :Sun , label :'Light' , value :ColorMode . LIGHT }, 72{ icon :Moon , label :'Dark' , value :ColorMode . DARK } 73], 74type :SettingsFieldType . SELECT 75}, 76{ 77defaultValue :'' , 78help :`Set the API Key if you are using <code> ${ CLI_FLAGS . API_KEY } </code> option for the server.` , 79isPrivate :true , 80key :SETTINGS_KEYS . API_KEY , 81label :'API Key' , 82type :SettingsFieldType . INPUT 83}, 84{ 85defaultValue :'' , 86help :'The starting message that defines how model should behave.' , 87key :SETTINGS_KEYS . SYSTEM_MESSAGE , 88label :'System Message' , 89type :SettingsFieldType . TEXTAREA 90}, 91{ 92defaultValue :true , 93help :'Display the system message at the top of each conversation.' , 94key :SETTINGS_KEYS . SHOW_SYSTEM_MESSAGE , 95label :'Show system message' , 96standaloneField :false , 97type :SettingsFieldType . CHECKBOX 98}, 99{ 100defaultValue :2500 , 101help :'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.' , 102key :SETTINGS_KEYS . PASTE_LONG_TEXT_TO_FILE_LEN , 103label :'Paste long text to file length' , 104type :SettingsFieldType . INPUT 105}, 106{ 107defaultValue :true , 108help :'Use Enter to send messages and Shift + Enter for new lines. When disabled, use Ctrl/Cmd + Enter.' , 109key :SETTINGS_KEYS . SEND_ON_ENTER , 110label :'Send message on Enter' , 111type :SettingsFieldType . CHECKBOX 112}, 113{ 114defaultValue :true , 115help :'Automatically show microphone button instead of send button when textarea is empty for models with audio modality support.' , 116key :SETTINGS_KEYS . AUTO_MIC_ON_EMPTY , 117label :'Show microphone on empty input' , 118type :SettingsFieldType . CHECKBOX 119}, 120{ 121defaultValue :false , 122help :'Enable "Continue" button for assistant messages, including reasoning models.' , 123isExperimental :true , 124key :SETTINGS_KEYS . ENABLE_CONTINUE_GENERATION , 125label :'Enable "Continue" button' , 126type :SettingsFieldType . CHECKBOX 127}, 128{ 129defaultValue :true , 130help :'Choose how conversation titles are generated. The first non-empty line uses a fast deterministic rule; the LLM option uses a model-generated title from the first message exchange.' , 131key :SETTINGS_KEYS . TITLE_GENERATION_USE_FIRST_LINE , 132label :'Conversation title' , 133radioOptions :[ 134{ 135key :SETTINGS_KEYS . TITLE_GENERATION_USE_FIRST_LINE , 136label :'Use first non-empty line for the conversation title' , 137value :'firstLine' 138}, 139{ 140isExperimental :true , 141key :SETTINGS_KEYS . TITLE_GENERATION_USE_LLM , 142label :'Generate title with LLM' , 143value :'llm' 144} 145], 146type :SettingsFieldType . RADIO 147}, 148{ 149defaultValue :TITLE_GENERATION . DEFAULT_PROMPT , 150dependsOn :SETTINGS_KEYS . TITLE_GENERATION_USE_LLM , 151help :'Optional template for the title generation prompt. Use {{USER}} for the user message and {{ASSISTANT}} for the assistant message.' , 152key :SETTINGS_KEYS . TITLE_GENERATION_PROMPT , 153label :'LLM title generation prompt' , 154type :SettingsFieldType . TEXTAREA 155}, 156{ 157defaultValue :false , 158help :'Counterpart of the conversation title radio; stored and synced without a dedicated UI field.' , 159key :SETTINGS_KEYS . TITLE_GENERATION_USE_LLM , 160label :'Generate title with LLM' , 161standaloneField :false , 162type :SettingsFieldType . CHECKBOX 163}, 164{ 165defaultValue :false , 166help :'When copying a message with text attachments, combine them into a single plain text string instead of a special format that can be pasted back as attachments.' , 167key :SETTINGS_KEYS . COPY_TEXT_ATTACHMENTS_AS_PLAIN_TEXT , 168label :'Copy text attachments as plain text' , 169type :SettingsFieldType . CHECKBOX 170}, 171{ 172defaultValue :false , 173help :'Parse PDF as image instead of text. Automatically falls back to text processing for non-vision models.' , 174key :SETTINGS_KEYS . PDF_AS_IMAGE , 175label :'Parse PDF as image' , 176type :SettingsFieldType . CHECKBOX 177}, 178{ 179defaultValue :0 , 180help :'Images larger than this will be resized before sending to server. Set to 0 to disable.' , 181key :SETTINGS_KEYS . MAX_IMAGE_RESOLUTION , 182label :'Maximum image resolution (megapixels)' , 183type :SettingsFieldType . INPUT 184} 185], 186slug :SETTINGS_SECTION_SLUGS . GENERAL , 187title :SETTINGS_SECTION_TITLES . GENERAL 188}, 189// Display 190{ 191icon :Monitor , 192settings :[ 193{ 194defaultValue :true , 195help :'Display generation statistics (tokens/second, token count, duration) below each assistant message.' , 196key :SETTINGS_KEYS . SHOW_MESSAGE_STATS , 197label :'Show message generation statistics' , 198type :SettingsFieldType . CHECKBOX 199}, 200{ 201defaultValue :false , 202dependsOn :SETTINGS_KEYS . SHOW_MESSAGE_STATS , 203help :'Display per-turn statistics (tokens, duration) under each turn in agentic responses. Shown only when "Show message generation statistics" is enabled.' , 204key :SETTINGS_KEYS . SHOW_AGENTIC_TURN_STATS , 205label :'Show statistics for individual agentic turns' , 206type :SettingsFieldType . CHECKBOX 207}, 208{ 209defaultValue :true , 210help :'Expand thought process by default when generating messages.' , 211key :SETTINGS_KEYS . SHOW_THOUGHT_IN_PROGRESS , 212label :'Show thought in progress' , 213type :SettingsFieldType . CHECKBOX 214}, 215{ 216defaultValue :false , 217help :'Automatically expand tool call details while executing and keep them expanded after completion.' , 218key :SETTINGS_KEYS . ALWAYS_SHOW_TOOL_CALL_CONTENT , 219label :'Always show tool call content' , 220type :SettingsFieldType . CHECKBOX 221}, 222{ 223defaultValue :true , 224help :'Render user messages using markdown formatting in the chat. Turn this off to keep a message exactly as typed; @-mention badges show either way.' , 225key :SETTINGS_KEYS . RENDER_USER_CONTENT_AS_MARKDOWN , 226label :'Render user content as Markdown' , 227type :SettingsFieldType . CHECKBOX 228}, 229{ 230defaultValue :true , 231help :'Render the reasoning/thinking block content as formatted Markdown instead of plain text.' , 232key :SETTINGS_KEYS . RENDER_THINKING_AS_MARKDOWN , 233label :'Render thinking as Markdown' , 234type :SettingsFieldType . CHECKBOX 235}, 236{ 237defaultValue :false , 238help :'Always display code blocks at their full natural height, overriding any height limits.' , 239key :SETTINGS_KEYS . FULL_HEIGHT_CODE_BLOCKS , 240label :'Use full height code blocks' , 241type :SettingsFieldType . CHECKBOX 242}, 243{ 244defaultValue :false , 245help :'Disable automatic scrolling while messages stream so you can control the viewport position manually.' , 246key :SETTINGS_KEYS . DISABLE_AUTO_SCROLL , 247label :'Disable automatic scroll' , 248type :SettingsFieldType . CHECKBOX 249}, 250{ 251defaultValue :false , 252help :'Always keep the sidebar visible on desktop instead of auto-hiding it.' , 253key :SETTINGS_KEYS . ALWAYS_SHOW_SIDEBAR_ON_DESKTOP , 254label :'Always show sidebar on desktop' , 255type :SettingsFieldType . CHECKBOX 256}, 257{ 258defaultValue :true , 259help :'Show open chats as browser-style tabs above the conversation, one per open chat. When disabled, only one chat is shown at a time.' , 260key :SETTINGS_KEYS . CONVERSATION_TABS , 261label :'Conversation tabs' , 262type :SettingsFieldType . CHECKBOX 263}, 264{ 265defaultValue :false , 266help :'Display full raw model identifiers (e.g. "ggml-org/GLM-4.7-Flash-GGUF:Q8_0") instead of parsed names with badges.' , 267key :SETTINGS_KEYS . SHOW_RAW_MODEL_NAMES , 268label :'Show raw model names' , 269type :SettingsFieldType . CHECKBOX 270}, 271{ 272defaultValue :true , 273help :'Display quantization badges (e.g. Q8_0, Q4_K_M) next to model names throughout the interface.' , 274key :SETTINGS_KEYS . SHOW_MODEL_QUANTIZATION , 275label :'Show model quantization information' , 276type :SettingsFieldType . CHECKBOX 277}, 278{ 279defaultValue :true , 280help :'Display model tags (e.g. "vision", "reasoning") next to model names throughout the interface.' , 281key :SETTINGS_KEYS . SHOW_MODEL_TAGS , 282label :'Show model tags' , 283type :SettingsFieldType . CHECKBOX 284}, 285{ 286defaultValue :false , 287help :'Display the organization name in the model selector trigger button.' , 288key :SETTINGS_KEYS . SHOW_MODEL_ORG_NAME_IN_TRIGGER , 289label :'Show organization name in model selector trigger' , 290type :SettingsFieldType . CHECKBOX 291}, 292{ 293defaultValue :false , 294help :'Display the current build version in the bottom-right corner of the interface.' , 295key :SETTINGS_KEYS . SHOW_BUILD_VERSION , 296label :'Show build version information' , 297type :SettingsFieldType . CHECKBOX 298}, 299{ 300defaultValue :false , 301help :'Display the full file system path inside file and folder @-mention badges instead of just the file or folder name.' , 302key :SETTINGS_KEYS . SHOW_FULL_PATH_IN_MENTIONS , 303label :'Show full path in mentions' , 304type :SettingsFieldType . CHECKBOX 305} 306], 307slug :SETTINGS_SECTION_SLUGS . DISPLAY , 308title :SETTINGS_SECTION_TITLES . DISPLAY 309}, 310// MCP Servers (non-UI config object) 311{ 312icon :PencilRuler , 313settings :[ 314{ 315defaultValue :'[]' , 316help :'Configure MCP servers as a JSON list. Use the form in the MCP Client settings section to edit.' , 317key :SETTINGS_KEYS . MCP_SERVERS , 318label :'MCP servers' , 319standaloneField :false , 320type :SettingsFieldType . INPUT 321} 322], 323slug :SETTINGS_SECTION_SLUGS . TOOLS , 324title :SETTINGS_SECTION_TITLES . TOOLS 325}, 326// Tools 327{ 328icon :ListRestart , 329settings :[ 330{ 331defaultValue :10 , 332help :'Maximum number of tool execution cycles before stopping (prevents infinite loops).' , 333isPositiveInteger :true , 334key :SETTINGS_KEYS . AGENTIC_MAX_TURNS , 335label :'Agentic turns' , 336type :SettingsFieldType . INPUT 337}, 338{ 339defaultValue :DEFAULT_MCP_CONFIG . requestTimeoutSeconds , 340help :'Timeout for individual MCP tool calls.' , 341isPositiveInteger :true , 342key :SETTINGS_KEYS . MCP_REQUEST_TIMEOUT_SECONDS , 343label :'MCP request timeout (seconds)' , 344type :SettingsFieldType . INPUT 345}, 346{ 347defaultValue :FILE_GLOB_SEARCH_PICKERS . DEFAULT_SEARCH_DEPTH , 348help :'How many directory levels below the working directory the @-mention file search descends. Larger values surface deeply nested files but take longer on large trees.' , 349isPositiveInteger :true , 350key :SETTINGS_KEYS . MENTION_SEARCH_MAX_DEPTH , 351label :'Mention search depth' , 352max :FILE_GLOB_SEARCH_PICKERS . MAX_SEARCH_DEPTH , 353min :1 , 354placeholder :` ${ FILE_GLOB_SEARCH_PICKERS . DEFAULT_SEARCH_DEPTH } ` , 355type :SettingsFieldType . INPUT 356} 357], 358slug :SETTINGS_SECTION_SLUGS . AGENTIC , 359title :SETTINGS_SECTION_TITLES . AGENTIC 360}, 361// Import/Export 362{ 363icon :Database , 364settings :[], 365slug :SETTINGS_SECTION_SLUGS . IMPORT_EXPORT , 366title :SETTINGS_SECTION_TITLES . IMPORT_EXPORT 367}, 368// Sampling 369{ 370icon :Funnel , 371settings :[ 372{ 373defaultValue :undefined , 374help :'Controls the randomness of the generated text by affecting the probability distribution of the output tokens. Higher = more random, lower = more focused.' , 375key :SETTINGS_KEYS . TEMPERATURE , 376label :'Temperature' , 377sync :{ 378paramType :SyncableParameterType . NUMBER , 379serverKey :SETTINGS_KEYS . TEMPERATURE 380}, 381type :SettingsFieldType . INPUT 382}, 383{ 384defaultValue :undefined , 385help :'Addon for the temperature sampler. The added value to the range of dynamic temperature, which adjusts probabilities by entropy of tokens.' , 386key :SETTINGS_KEYS . DYNATEMP_RANGE , 387label :'Dynamic temperature range' , 388sync :{ 389paramType :SyncableParameterType . NUMBER , 390serverKey :SETTINGS_KEYS . DYNATEMP_RANGE 391}, 392type :SettingsFieldType . INPUT 393}, 394{ 395defaultValue :undefined , 396help :'Addon for the temperature sampler. Smoothes out the probability redistribution based on the most probable token.' , 397key :SETTINGS_KEYS . DYNATEMP_EXPONENT , 398label :'Dynamic temperature exponent' , 399sync :{ 400paramType :SyncableParameterType . NUMBER , 401serverKey :SETTINGS_KEYS . DYNATEMP_EXPONENT 402}, 403type :SettingsFieldType . INPUT 404}, 405{ 406defaultValue :undefined , 407help :'Keeps only k top tokens.' , 408key :SETTINGS_KEYS . TOP_K , 409label :'Top K' , 410sync :{ paramType :SyncableParameterType . NUMBER , serverKey :SETTINGS_KEYS . TOP_K }, 411type :SettingsFieldType . INPUT 412}, 413{ 414defaultValue :undefined , 415help :'Limits tokens to those that together have a cumulative probability of at least p' , 416key :SETTINGS_KEYS . TOP_P , 417label :'Top P' , 418sync :{ paramType :SyncableParameterType . NUMBER , serverKey :SETTINGS_KEYS . TOP_P }, 419type :SettingsFieldType . INPUT 420}, 421{ 422defaultValue :undefined , 423help :'Limits tokens based on the minimum probability for a token to be considered, relative to the probability of the most likely token.' , 424key :SETTINGS_KEYS . MIN_P , 425label :'Min P' , 426sync :{ paramType :SyncableParameterType . NUMBER , serverKey :SETTINGS_KEYS . MIN_P }, 427type :SettingsFieldType . INPUT 428}, 429{ 430defaultValue :undefined , 431help :'XTC sampler cuts out top tokens; this parameter controls the chance of cutting tokens at all. 0 disables XTC.' , 432key :SETTINGS_KEYS . XTC_PROBABILITY , 433label :'XTC probability' , 434sync :{ 435paramType :SyncableParameterType . NUMBER , 436serverKey :SETTINGS_KEYS . XTC_PROBABILITY 437}, 438type :SettingsFieldType . INPUT 439}, 440{ 441defaultValue :undefined , 442help :'XTC sampler cuts out top tokens; this parameter controls the token probability that is required to cut that token.' , 443key :SETTINGS_KEYS . XTC_THRESHOLD , 444label :'XTC threshold' , 445sync :{ 446paramType :SyncableParameterType . NUMBER , 447serverKey :SETTINGS_KEYS . XTC_THRESHOLD 448}, 449type :SettingsFieldType . INPUT 450}, 451{ 452defaultValue :undefined , 453help :'Sorts and limits tokens based on the difference between log-probability and entropy.' , 454key :SETTINGS_KEYS . TYP_P , 455label :'Typical P' , 456sync :{ paramType :SyncableParameterType . NUMBER , serverKey :SETTINGS_KEYS . TYP_P }, 457type :SettingsFieldType . INPUT 458}, 459{ 460defaultValue :undefined , 461help :'The maximum number of token per output. Use -1 for infinite (no limit).' , 462key :SETTINGS_KEYS . MAX_TOKENS , 463label :'Max tokens' , 464sync :{ 465paramType :SyncableParameterType . NUMBER , 466serverKey :SETTINGS_KEYS . MAX_TOKENS 467}, 468type :SettingsFieldType . INPUT 469}, 470{ 471defaultValue :'' , 472help :'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' , 473key :SETTINGS_KEYS . SAMPLERS , 474label :'Samplers' , 475sync :{ paramType :SyncableParameterType . STRING , serverKey :SETTINGS_KEYS . SAMPLERS }, 476type :SettingsFieldType . INPUT 477}, 478{ 479defaultValue :false , 480help :'Enable backend-based samplers. When enabled, supported samplers run on the accelerator backend for faster sampling.' , 481key :SETTINGS_KEYS . BACKEND_SAMPLING , 482label :'Backend sampling' , 483type :SettingsFieldType . CHECKBOX 484}, 485{ 486defaultValue :undefined , 487help :'Last n tokens to consider for penalizing repetition' , 488key :SETTINGS_KEYS . REPEAT_LAST_N , 489label :'Repeat last N' , 490sync :{ 491paramType :SyncableParameterType . NUMBER , 492serverKey :SETTINGS_KEYS . REPEAT_LAST_N 493}, 494type :SettingsFieldType . INPUT 495}, 496{ 497defaultValue :undefined , 498help :'Controls the repetition of token sequences in the generated text' , 499key :SETTINGS_KEYS . REPEAT_PENALTY , 500label :'Repeat penalty' , 501sync :{ 502paramType :SyncableParameterType . NUMBER , 503serverKey :SETTINGS_KEYS . REPEAT_PENALTY 504}, 505type :SettingsFieldType . INPUT 506}, 507{ 508defaultValue :undefined , 509help :'Limits tokens based on whether they appear in the output or not.' , 510key :SETTINGS_KEYS . PRESENCE_PENALTY , 511label :'Presence penalty' , 512sync :{ 513paramType :SyncableParameterType . NUMBER , 514serverKey :SETTINGS_KEYS . PRESENCE_PENALTY 515}, 516type :SettingsFieldType . INPUT 517}, 518{ 519defaultValue :undefined , 520help :'Limits tokens based on how often they appear in the output.' , 521key :SETTINGS_KEYS . FREQUENCY_PENALTY , 522label :'Frequency penalty' , 523sync :{ 524paramType :SyncableParameterType . NUMBER , 525serverKey :SETTINGS_KEYS . FREQUENCY_PENALTY 526}, 527type :SettingsFieldType . INPUT 528}, 529{ 530defaultValue :undefined , 531help :'DRY sampling reduces repetition in generated text even across long contexts. This parameter sets the DRY sampling multiplier.' , 532key :SETTINGS_KEYS . DRY_MULTIPLIER , 533label :'DRY multiplier' , 534sync :{ 535paramType :SyncableParameterType . NUMBER , 536serverKey :SETTINGS_KEYS . DRY_MULTIPLIER 537}, 538type :SettingsFieldType . INPUT 539}, 540{ 541defaultValue :undefined , 542help :'DRY sampling reduces repetition in generated text even across long contexts. This parameter sets the DRY sampling base value.' , 543key :SETTINGS_KEYS . DRY_BASE , 544label :'DRY base' , 545sync :{ paramType :SyncableParameterType . NUMBER , serverKey :SETTINGS_KEYS . DRY_BASE }, 546type :SettingsFieldType . INPUT 547}, 548{ 549defaultValue :undefined , 550help :'DRY sampling reduces repetition in generated text even across long contexts. This parameter sets the allowed length for DRY sampling.' , 551key :SETTINGS_KEYS . DRY_ALLOWED_LENGTH , 552label :'DRY allowed length' , 553sync :{ 554paramType :SyncableParameterType . NUMBER , 555serverKey :SETTINGS_KEYS . DRY_ALLOWED_LENGTH 556}, 557type :SettingsFieldType . INPUT 558}, 559{ 560defaultValue :undefined , 561help :'DRY sampling reduces repetition in generated text even across long contexts. This parameter sets DRY penalty for the last n tokens.' , 562key :SETTINGS_KEYS . DRY_PENALTY_LAST_N , 563label :'DRY penalty last N' , 564sync :{ 565paramType :SyncableParameterType . NUMBER , 566serverKey :SETTINGS_KEYS . DRY_PENALTY_LAST_N 567}, 568type :SettingsFieldType . INPUT 569} 570], 571slug :SETTINGS_SECTION_SLUGS . SAMPLING_PENALTIES , 572title :SETTINGS_SECTION_TITLES . SAMPLING_PENALTIES 573}, 574// Developer 575{ 576icon :Code , 577settings :[ 578{ 579defaultValue :false , 580help :'After each response, re-submit the conversation to pre-fill the server KV cache. Makes the next turn faster since the prompt is already encoded while you read the response.' , 581key :SETTINGS_KEYS . PRE_ENCODE_CONVERSATION , 582label :'Pre-fill KV cache after response' , 583type :SettingsFieldType . CHECKBOX 584}, 585{ 586defaultValue :false , 587help :'Send reasoning_format=none so the server returns thinking tokens inline instead of extracting them into a separate field.' , 588key :SETTINGS_KEYS . DISABLE_REASONING_PARSING , 589label :'Disable reasoning content parsing' , 590type :SettingsFieldType . CHECKBOX 591}, 592{ 593defaultValue :false , 594help :'Strip thinking from previous messages before sending. When off, thinking is sent back via the reasoning_content field so the model sees its own chain-of-thought across turns.' , 595key :SETTINGS_KEYS . EXCLUDE_REASONING_FROM_CONTEXT , 596label :'Exclude reasoning from context' , 597type :SettingsFieldType . CHECKBOX 598}, 599{ 600defaultValue :false , 601help :'Show toggle button to display messages as plain text instead of Markdown-formatted content' , 602key :SETTINGS_KEYS . SHOW_RAW_OUTPUT_SWITCH , 603label :'Enable raw output toggle' , 604type :SettingsFieldType . CHECKBOX 605}, 606{ 607defaultValue :false , 608help :'Expose a run_javascript tool to the model. Code runs in a Web Worker inside a sandboxed iframe with an opaque origin, isolated from the WebUI and its API, with a hard timeout.' , 609key :SETTINGS_KEYS . JS_SANDBOX_ENABLED , 610label :'JavaScript sandbox tool' , 611type :SettingsFieldType . CHECKBOX 612}, 613{ 614defaultValue :false , 615dependsOn :SETTINGS_KEYS . JS_SANDBOX_ENABLED , 616help :'Pre-load nerdamer in the sandbox for symbolic computation: simplify, diff, integrate, solve, and more. Requires "JavaScript sandbox tool" to be enabled.' , 617key :SETTINGS_KEYS . SYMBOLIC_MATH_ENABLED , 618label :'Symbolic math (nerdamer)' , 619type :SettingsFieldType . CHECKBOX 620}, 621{ 622defaultValue :'' , 623help :'Custom JSON parameters to send to the API. Must be valid JSON format.' , 624key :SETTINGS_KEYS . CUSTOM_JSON , 625label :'Custom JSON' , 626type :SettingsFieldType . TEXTAREA 627}, 628{ 629defaultValue :'' , 630help :'CSS injected into the page at runtime. Set it here, or ship it server side via the --ui-config customCss field.' , 631key :SETTINGS_KEYS . CUSTOM_CSS , 632label :'Custom CSS' , 633type :SettingsFieldType . TEXTAREA 634} 635], 636slug :SETTINGS_SECTION_SLUGS . DEVELOPER , 637title :SETTINGS_SECTION_TITLES . DEVELOPER 638} 639]; 640 641function getAllSettings () :SettingsEntry [] { 642const result :SettingsEntry [] = []; 643 644for ( const section of SETTINGS_REGISTRY ) { 645result . push ( ...section . settings ); 646} 647 648return result ; 649} 650 651/** Flat config object stored in localStorage. */ 652export const SETTING_CONFIG_DEFAULT :Record < string , SettingsConfigValue > = Object . fromEntries ( 653getAllSettings (). map (( s ) => [ s . key , s . defaultValue ]) 654) as Record < string , SettingsConfigValue >; 655 656/** Help text for every setting (including non-UI). */ 657export const SETTING_CONFIG_INFO :Record < string , string > = Object . fromEntries ( 658getAllSettings (). map (( s ) => [ s . key , s . help ]) 659) as Record < string , string >; 660 661/** Sidebar sections + field configs (as consumed by UI). */ 662function toSettingsSection ( section :SettingsSectionEntry ) :SettingsSection { 663return { 664fields :section . settings 665. filter (( s ) => s . standaloneField !== false ) 666. map (( s ) => ({ 667dependsOn :s . dependsOn , 668help :s . help , 669isExperimental :s . isExperimental , 670isPositiveInteger :s . isPositiveInteger , 671isPrivate :s . isPrivate , 672key :s . key , 673label :s . label , 674max :s . max , 675min :s . min , 676options :s . options as SettingsFieldConfig [ 'options' ], 677placeholder :s . placeholder , 678radioOptions :s . radioOptions , 679type :s . type 680})), 681icon :section . icon , 682slug :section . slug , 683title :section . title 684}; 685} 686 687/** Sidebar sections in custom display order (the registry array order). */ 688export const SETTINGS_CHAT_SECTIONS :SettingsSection [] = SETTINGS_REGISTRY . map ( toSettingsSection ); 689 690/** INPUT-type settings whose value is a number. */ 691export const NUMERIC_FIELDS = getAllSettings () 692. filter (( s ) => s . type === SettingsFieldType . INPUT && typeof s . defaultValue !== 'string' ) 693. map (( s ) => s . key ) as readonly string []; 694 695/** Numeric fields clamped to >= 1 and rounded. */ 696export const POSITIVE_INTEGER_FIELDS = getAllSettings () 697. filter (( s ) => s . isPositiveInteger ) 698. map (( s ) => s . key ) as readonly string [];