char-fork/llama.cpp

git clone https://git.t4t.associates/char-fork/llama.cpp

Aleksander Grygierui: Constants refactor (#26908)e21152dc9

char/aliceai-t5-moe
1.6 KiB46 linesraw
1/**
2 * URI Template constants for RFC 6570 template processing.
3 */
4
5/** URI scheme separator */
6export const URI_SCHEME_SEPARATOR = '://';
7
8/** Regex to match template expressions like {var}, {+var}, {#var}, {/var} */
9export const TEMPLATE_EXPRESSION_REGEX = /\{([+#./;?&]?)([^}]+)\}/g;
10
11/** RFC 6570 URI template operators and separators. A single object covers both: an operator prefix character doubles as the separator written into the expansion (e.g. `{/a}`/`{;a}` use `/` and `;` for both), so the characters live here once. */
12export const URI_TEMPLATE_SYMBOLS = {
13	/** Comma separator for list expansion */
14	COMMA: ',',
15	/** Form-style query */
16	FORM_CONTINUATION: '&',
17	/** Form-style query prefix */
18	FORM_QUERY: '?',
19	/** Fragment expansion */
20	FRAGMENT: '#',
21	/** Label expansion */
22	LABEL: '.',
23	/** Path-style parameters */
24	PATH_PARAM: ';',
25	/** Path segment expansion */
26	PATH_SEGMENT: '/',
27	/** Reserved expansion */
28	RESERVED: '+',
29	/** Simple string expansion (default) */
30	SIMPLE: ''
31} as const;
32
33/** Maximum number of leading slashes to strip during URI normalization */
34export const MAX_LEADING_SLASHES_TO_STRIP = 3;
35
36/** Regex to strip explode modifier (*) from variable names */
37export const VARIABLE_EXPLODE_MODIFIER_REGEX = /[*]$/;
38
39/** Regex to strip prefix modifier (:N) from variable names */
40export const VARIABLE_PREFIX_MODIFIER_REGEX = /:[\d]+$/;
41
42/** Regex to strip one or more leading slashes */
43export const LEADING_SLASHES_REGEX = /^\/+/;
44
45/** Regex to match base64-encoded image URIs (format: "data:image/[media type];base64,[data]")*/
46export const BASE64_IMAGE_URI_REGEX = /^data:(image\/[a-z0-9.\-+]+);base64/;