char-fork/llama.cpp
git clone https://git.t4t.associates/char-fork/llama.cpp
e21152dc9
char/aliceai-t5-moe
1// Constants for the markdown code-block renderer: language/fence handling and CSS classes. 2 3/** Parsing and escaping helpers for the markdown code-block renderer. */ 4export const CODE_BLOCK = { 5AMPERSAND_REGEX :/ & / g , 6/** Language fallback used when no language is specified. */ 7DEFAULT_LANGUAGE :'text' , 8/** Matches opening/closing markdown code fences. */ 9FENCE_PATTERN :/ ^```|\n``` / g , 10GT_REGEX :/ > / g , 11/** Matches the language specifier at the start of a code fence. */ 12LANG_PATTERN :/ ^(\w*)\n? / , 13LT_REGEX :/ < / g , 14 15// Matches the `text:` prefix that file-type identifiers use to denote a 16// plain-text language (e.g. `text:typescript`). Used by tool-call renderers 17// to recover the underlying highlight.js language. 18TEXT_LANGUAGE_PREFIX_REGEX :/ ^text: / , 19// Whitespace-only empty lines (between start of string and first non-empty line). 20// Used by trimCodePadding to drop leading/trailing phantom blank rows from LLM 21// payload wrappers without touching internal blank lines. 22TRIM_LEADING_PADDING_REGEX :/ ^(?:[ \t]*\n)+ / , 23 24TRIM_TRAILING_PADDING_REGEX :/ (?:\n[ \t]*)+$ / 25} as const ; 26 27// Matches either Unix or Windows path separators so `String.split(REGEX)` can 28// recover the trailing file-name segment from either `/foo/bar.txt` or 29// `C:\foo\bar.txt`. Used wherever a parameter accepts a user-supplied path. 30export const FILE_PATH_SEPARATOR_REGEX = / [\\/] / ; 31 32// Separates a file name from its extension, e.g. the '.' in `cover.png`. 33export const FILE_EXTENSION_SEPARATOR = '.' ; 34 35// Matches the `text:` prefix that file-type identifiers use to denote a 36// plain-text language (e.g. `text:typescript`). Used by tool-call renderers 37// to recover the underlying highlight.js language. 38export const TEXT_LANGUAGE_PREFIX_REGEX = / ^text: / ; 39 40/** CSS classes applied by the markdown code-block renderer. */ 41export const CODE_BLOCK_CLASS = { 42ACTIONS :'code-block-actions' , 43COPY_BTN :'copy-code-btn' , 44HEADER :'code-block-header' , 45LANGUAGE :'code-language' , 46PREVIEW_BTN :'preview-code-btn' , 47RELATIVE :'relative' , 48SCROLL_CONTAINER :'code-block-scroll-container' , 49WRAPPER :'code-block-wrapper' 50} as const ;