char-fork/llama.cpp
git clone https://git.t4t.associates/char-fork/llama.cpp
bdffafa5d
char/aliceai-t5-moe
1/** 2* Shared visual contract between the two DOM-only badge paths (the 3* ChatFormInputRich tokenizer + the rehype plugin). Svelte cannot be 4* mounted at the per-keystroke tokenizer hot path nor from a hast tree, 5* so both emit the badge with the same class string literal; Tailwind's 6* scanner picks it up in both sources. 7*/ 8export const MENTION_BADGE_CLASSNAME = 9'inline-flex w-fit shrink-0 items-center gap-1 whitespace-nowrap rounded-md border border-border/50 bg-foreground/5 px-1.5 py-0.5 text-xs font-mono text-foreground hover:bg-foreground/10 dark:bg-foreground/10 dark:text-secondary-foreground' ; 10 11export const MENTION_BADGE_ICON_CLASSNAME = 'h-3 w-3 shrink-0' ; 12 13/** Full `data-*` attribute names that tag ChatFormInputRich mention badges. */ 14export const MENTION_BADGE_DATA_ATTRS = { 15BADGE :'data-mention-badge' , 16NAME :'data-mention-name' , 17PATH :'data-mention-path' 18} as const ; 19 20/** Regex flag that makes the mention scanner walk every link in a message instead of the first. */ 21export const MENTION_LINK_SCAN_FLAGS = 'g' ; 22 23/** 24* SVG attributes shared by the DOM-built and hast-built badge icons. 25* The tokenizer applies them via `setAttribute`, the rehype plugin 26* spreads them onto the hast `<svg>` `properties`; string values are 27* valid for both. 28*/ 29export const MENTION_BADGE_SVG_ATTRIBUTES :Readonly < Record < string , string >> = { 30'aria-hidden' :'true' , 31fill :'none' , 32stroke :'currentColor' , 33'stroke-linecap' :'round' , 34'stroke-linejoin' :'round' , 35'stroke-width' :'2' , 36viewBox :'0 0 24 24' , 37xmlns :'http://www.w3.org/2000/svg' 38}; 39 40/** 41* SVG path strings for the badge's inline icon; each entry becomes one 42* `<path>` child of the wrapper `<svg>`. Paths match `lucide-svelte`'s 43* current `File` and `Folder` glyphs. 44*/ 45export const MENTION_BADGE_FILE_ICON_PATHS :readonly string [] = [ 46'M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z' , 47'M14 2v5a1 1 0 0 0 1 1h5' 48]; 49 50export const MENTION_BADGE_FOLDER_ICON_PATHS :readonly string [] = [ 51'M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z' 52];