Brunobkr/llama.cpp_AlgMor24_github
ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.
03.1k
1import type {CssStyle, HtmlDomNode} from "./domTree";2import type {MathDomNode} from "./mathMLTree";3 4 5// To ensure that all nodes have compatible signatures for these methods.6export interface VirtualNode {7 toNode(): Node;8 toMarkup(): string;9}10 11function isMathDomNode(node: VirtualNode): node is MathDomNode {12 return 'toText' in node;13}14 15 16/**17 * This node represents a document fragment, which contains elements, but when18 * placed into the DOM doesn't have any representation itself. It only contains19 * children and doesn't have any DOM node properties.20 */21export class DocumentFragment<ChildType extends VirtualNode>22 implements HtmlDomNode, MathDomNode {23 children: ReadonlyArray<ChildType>;24 classes: string[];25 height: number;26 depth: number;27 maxFontSize: number;28 style: CssStyle; // Never used; needed for satisfying interface.29 30 constructor(children: ReadonlyArray<ChildType>) {31 this.children = children;32 this.classes = [];33 this.height = 0;34 this.depth = 0;35 this.maxFontSize = 0;36 this.style = {};37 }38 39 hasClass(className: string): boolean {40 return this.classes.includes(className);41 }42 43 /** Convert the fragment into a node. */44 toNode(): Node {45 const frag = document.createDocumentFragment();46 47 for (let i = 0; i < this.children.length; i++) {48 frag.appendChild(this.children[i].toNode());49 }50 51 return frag;52 }53 54 /** Convert the fragment into HTML markup. */55 toMarkup(): string {56 let markup = "";57 58 // Simply concatenate the markup for the children together.59 for (let i = 0; i < this.children.length; i++) {60 markup += this.children[i].toMarkup();61 }62 63 return markup;64 }65 66 /**67 * Converts the math node into a string, similar to innerText. Applies to68 * MathDomNode's only.69 */70 toText(): string {71 return this.children.map((child: ChildType): string => {72 if (isMathDomNode(child)) {73 return child.toText();74 }75 throw new Error(76 `Expected MathDomNode with toText, got ${child.constructor.name}`);77 }).join("");78 }79}80 