First upload version 0.0.1
This commit is contained in:
21
node_modules/node-llama-cpp/dist/bindings/utils/getExampleUsageCodeOfGetLlama.js
generated
vendored
Normal file
21
node_modules/node-llama-cpp/dist/bindings/utils/getExampleUsageCodeOfGetLlama.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
import chalk from "chalk";
|
||||
import stripAnsi from "strip-ansi";
|
||||
import { prettyPrintObject } from "../../utils/prettyPrintObject.js";
|
||||
import { getLlamaFunctionName } from "../getLlama.js";
|
||||
export function getExampleUsageCodeOfGetLlama(getLlamaOptions, prefix = "", wrapWithSeparators = true) {
|
||||
let res = prefix + [
|
||||
chalk.magenta.italic("import "), chalk.whiteBright("{"), chalk.yellow(getLlamaFunctionName), chalk.whiteBright("} "),
|
||||
chalk.magenta.italic("from "), chalk.green("\"node-llama-cpp\""), chalk.whiteBright(";"),
|
||||
"\n\n",
|
||||
chalk.magenta.italic("const "), chalk.whiteBright("llama "), chalk.whiteBright("= "), chalk.magenta.italic("await "), chalk.yellow(getLlamaFunctionName), chalk.whiteBright("("),
|
||||
getLlamaOptions === undefined ? "" : prettyPrintObject(getLlamaOptions),
|
||||
chalk.whiteBright(")"), chalk.whiteBright(";")
|
||||
].join(prefix);
|
||||
if (wrapWithSeparators) {
|
||||
const longestLineLength = res.split("\n")
|
||||
.reduce((max, line) => Math.max(max, stripAnsi(line).length), 0);
|
||||
res = chalk.blue("-".repeat(longestLineLength)) + "\n" + res + "\n" + chalk.blue("-".repeat(longestLineLength));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
//# sourceMappingURL=getExampleUsageCodeOfGetLlama.js.map
|
||||
Reference in New Issue
Block a user