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
1"use strict";2var __defProp = Object.defineProperty;3var __getOwnPropDesc = Object.getOwnPropertyDescriptor;4var __getOwnPropNames = Object.getOwnPropertyNames;5var __hasOwnProp = Object.prototype.hasOwnProperty;6var __export = (target, all) => {7 for (var name in all)8 __defProp(target, name, { get: all[name], enumerable: true });9};10var __copyProps = (to, from, except, desc) => {11 if (from && typeof from === "object" || typeof from === "function") {12 for (let key of __getOwnPropNames(from))13 if (!__hasOwnProp.call(to, key) && key !== except)14 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });15 }16 return to;17};18var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);19var javascript_exports = {};20__export(javascript_exports, {21 JavaScriptFormatter: () => JavaScriptFormatter,22 JavaScriptLanguageGenerator: () => JavaScriptLanguageGenerator,23 quoteMultiline: () => quoteMultiline24});25module.exports = __toCommonJS(javascript_exports);26var import_language = require("./language");27var import_utils = require("../../utils");28var import_deviceDescriptors = require("../deviceDescriptors");29class JavaScriptLanguageGenerator {30 constructor(isTest) {31 this.groupName = "Node.js";32 this.highlighter = "javascript";33 this.id = isTest ? "playwright-test" : "javascript";34 this.name = isTest ? "Test Runner" : "Library";35 this._isTest = isTest;36 }37 generateAction(actionInContext) {38 const action = actionInContext.action;39 if (this._isTest && (action.name === "openPage" || action.name === "closePage"))40 return "";41 const pageAlias = actionInContext.frame.pageAlias;42 const formatter = new JavaScriptFormatter(2);43 if (action.name === "openPage") {44 formatter.add(`const ${pageAlias} = await context.newPage();`);45 if (action.url && action.url !== "about:blank" && action.url !== "chrome://newtab/")46 formatter.add(`await ${pageAlias}.goto(${quote(action.url)});`);47 return formatter.format();48 }49 const locators = actionInContext.frame.framePath.map((selector) => `.${this._asLocator(selector)}.contentFrame()`);50 const subject = `${pageAlias}${locators.join("")}`;51 const signals = (0, import_language.toSignalMap)(action);52 if (signals.dialog) {53 formatter.add(` ${pageAlias}.once('dialog', dialog => {54 console.log(\`Dialog message: \${dialog.message()}\`);55 dialog.dismiss().catch(() => {});56 });`);57 }58 if (signals.popup)59 formatter.add(`const ${signals.popup.popupAlias}Promise = ${pageAlias}.waitForEvent('popup');`);60 if (signals.download)61 formatter.add(`const download${signals.download.downloadAlias}Promise = ${pageAlias}.waitForEvent('download');`);62 formatter.add(wrapWithStep(actionInContext.description, this._generateActionCall(subject, actionInContext)));63 if (signals.popup)64 formatter.add(`const ${signals.popup.popupAlias} = await ${signals.popup.popupAlias}Promise;`);65 if (signals.download)66 formatter.add(`const download${signals.download.downloadAlias} = await download${signals.download.downloadAlias}Promise;`);67 return formatter.format();68 }69 _generateActionCall(subject, actionInContext) {70 const action = actionInContext.action;71 switch (action.name) {72 case "openPage":73 throw Error("Not reached");74 case "closePage":75 return `await ${subject}.close();`;76 case "click": {77 let method = "click";78 if (action.clickCount === 2)79 method = "dblclick";80 const options = (0, import_language.toClickOptionsForSourceCode)(action);81 const optionsString = formatOptions(options, false);82 return `await ${subject}.${this._asLocator(action.selector)}.${method}(${optionsString});`;83 }84 case "hover":85 return `await ${subject}.${this._asLocator(action.selector)}.hover(${formatOptions({ position: action.position }, false)});`;86 case "check":87 return `await ${subject}.${this._asLocator(action.selector)}.check();`;88 case "uncheck":89 return `await ${subject}.${this._asLocator(action.selector)}.uncheck();`;90 case "fill":91 return `await ${subject}.${this._asLocator(action.selector)}.fill(${quote(action.text)});`;92 case "setInputFiles":93 return `await ${subject}.${this._asLocator(action.selector)}.setInputFiles(${formatObject(action.files.length === 1 ? action.files[0] : action.files)});`;94 case "press": {95 const modifiers = (0, import_language.toKeyboardModifiers)(action.modifiers);96 const shortcut = [...modifiers, action.key].join("+");97 return `await ${subject}.${this._asLocator(action.selector)}.press(${quote(shortcut)});`;98 }99 case "navigate":100 return `await ${subject}.goto(${quote(action.url)});`;101 case "select":102 return `await ${subject}.${this._asLocator(action.selector)}.selectOption(${formatObject(action.options.length === 1 ? action.options[0] : action.options)});`;103 case "assertText":104 return `${this._isTest ? "" : "// "}await expect(${subject}.${this._asLocator(action.selector)}).${action.substring ? "toContainText" : "toHaveText"}(${quote(action.text)});`;105 case "assertChecked":106 return `${this._isTest ? "" : "// "}await expect(${subject}.${this._asLocator(action.selector)})${action.checked ? "" : ".not"}.toBeChecked();`;107 case "assertVisible":108 return `${this._isTest ? "" : "// "}await expect(${subject}.${this._asLocator(action.selector)}).toBeVisible();`;109 case "assertValue": {110 const assertion = action.value ? `toHaveValue(${quote(action.value)})` : `toBeEmpty()`;111 return `${this._isTest ? "" : "// "}await expect(${subject}.${this._asLocator(action.selector)}).${assertion};`;112 }113 case "assertSnapshot": {114 const commentIfNeeded = this._isTest ? "" : "// ";115 return `${commentIfNeeded}await expect(${subject}.${this._asLocator(action.selector)}).toMatchAriaSnapshot(${quoteMultiline(action.ariaSnapshot, `${commentIfNeeded} `)});`;116 }117 }118 }119 _asLocator(selector) {120 return (0, import_utils.asLocator)("javascript", selector);121 }122 generateHeader(options) {123 if (this._isTest)124 return this.generateTestHeader(options);125 return this.generateStandaloneHeader(options);126 }127 generateFooter(saveStorage) {128 if (this._isTest)129 return this.generateTestFooter(saveStorage);130 return this.generateStandaloneFooter(saveStorage);131 }132 generateTestHeader(options) {133 const formatter = new JavaScriptFormatter();134 const useText = formatContextOptions(options.contextOptions, options.deviceName, this._isTest);135 formatter.add(`136 import { test, expect${options.deviceName ? ", devices" : ""} } from '@playwright/test';137${useText ? "\ntest.use(" + useText + ");\n" : ""}138 test('test', async ({ page }) => {`);139 if (options.contextOptions.recordHar) {140 const url = options.contextOptions.recordHar.urlFilter;141 formatter.add(` await page.routeFromHAR(${quote(options.contextOptions.recordHar.path)}${url ? `, ${formatOptions({ url }, false)}` : ""});`);142 }143 return formatter.format();144 }145 generateTestFooter(saveStorage) {146 return `});`;147 }148 generateStandaloneHeader(options) {149 const formatter = new JavaScriptFormatter();150 formatter.add(`151 const { ${options.browserName}${options.deviceName ? ", devices" : ""} } = require('playwright');152 153 (async () => {154 const browser = await ${options.browserName}.launch(${formatObjectOrVoid(options.launchOptions)});155 const context = await browser.newContext(${formatContextOptions(options.contextOptions, options.deviceName, false)});`);156 if (options.contextOptions.recordHar)157 formatter.add(` await context.routeFromHAR(${quote(options.contextOptions.recordHar.path)});`);158 return formatter.format();159 }160 generateStandaloneFooter(saveStorage) {161 const storageStateLine = saveStorage ? `162 await context.storageState({ path: ${quote(saveStorage)} });` : "";163 return `164 // ---------------------${storageStateLine}165 await context.close();166 await browser.close();167})();`;168 }169}170function formatOptions(value, hasArguments) {171 const keys = Object.keys(value).filter((key) => value[key] !== void 0);172 if (!keys.length)173 return "";174 return (hasArguments ? ", " : "") + formatObject(value);175}176function formatObject(value, indent = " ") {177 if (typeof value === "string")178 return quote(value);179 if (Array.isArray(value))180 return `[${value.map((o) => formatObject(o)).join(", ")}]`;181 if (typeof value === "object") {182 const keys = Object.keys(value).filter((key) => value[key] !== void 0).sort();183 if (!keys.length)184 return "{}";185 const tokens = [];186 for (const key of keys)187 tokens.push(`${key}: ${formatObject(value[key])}`);188 return `{189${indent}${tokens.join(`,190${indent}`)}191}`;192 }193 return String(value);194}195function formatObjectOrVoid(value, indent = " ") {196 const result = formatObject(value, indent);197 return result === "{}" ? "" : result;198}199function formatContextOptions(options, deviceName, isTest) {200 const device = deviceName && import_deviceDescriptors.deviceDescriptors[deviceName];201 options = { ...options, recordHar: void 0 };202 if (!device)203 return formatObjectOrVoid(options);204 let serializedObject = formatObjectOrVoid((0, import_language.sanitizeDeviceOptions)(device, options));205 if (!serializedObject)206 serializedObject = "{\n}";207 const lines = serializedObject.split("\n");208 lines.splice(1, 0, `...devices[${quote(deviceName)}],`);209 return lines.join("\n");210}211class JavaScriptFormatter {212 constructor(offset = 0) {213 this._lines = [];214 this._baseIndent = " ".repeat(2);215 this._baseOffset = " ".repeat(offset);216 }217 prepend(text) {218 const trim = isMultilineString(text) ? (line) => line : (line) => line.trim();219 this._lines = text.trim().split("\n").map(trim).concat(this._lines);220 }221 add(text) {222 const trim = isMultilineString(text) ? (line) => line : (line) => line.trim();223 this._lines.push(...text.trim().split("\n").map(trim));224 }225 newLine() {226 this._lines.push("");227 }228 format() {229 let spaces = "";230 let previousLine = "";231 return this._lines.map((line) => {232 if (line === "")233 return line;234 if (line.startsWith("}") || line.startsWith("]"))235 spaces = spaces.substring(this._baseIndent.length);236 const extraSpaces = /^(for|while|if|try).*\(.*\)$/.test(previousLine) ? this._baseIndent : "";237 previousLine = line;238 const callCarryOver = line.startsWith(".set");239 line = spaces + extraSpaces + (callCarryOver ? this._baseIndent : "") + line;240 if (line.endsWith("{") || line.endsWith("["))241 spaces += this._baseIndent;242 return this._baseOffset + line;243 }).join("\n");244 }245}246function quote(text) {247 return (0, import_utils.escapeWithQuotes)(text, "'");248}249function wrapWithStep(description, body) {250 return description ? `await test.step(\`${description}\`, async () => {251${body}252});` : body;253}254function quoteMultiline(text, indent = " ") {255 const escape = (text2) => text2.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${");256 const lines = text.split("\n");257 if (lines.length === 1)258 return "`" + escape(text) + "`";259 return "`\n" + lines.map((line) => indent + escape(line).replace(/\${/g, "\\${")).join("\n") + `260${indent}\``;261}262function isMultilineString(text) {263 return text.match(/`[\S\s]*`/)?.[0].includes("\n");264}265// Annotate the CommonJS export names for ESM import in node:2660 && (module.exports = {267 JavaScriptFormatter,268 JavaScriptLanguageGenerator,269 quoteMultiline270});271 