Spaces:
Paused
Paused
Download node_modules/@huggingface/tasks/dist/commonjs/snippets/common.js from Leon4gr45/UserSyncFrontend: direct link, hf CLI and curl.
- Browser
- Download file 901 Bytes
-
https://huggingface.co/spaces/Leon4gr45/UserSyncFrontend/resolve/main/node_modules/%40huggingface/tasks/dist/commonjs/snippets/common.js
- Command line
-
hf download hf://spaces/Leon4gr45/UserSyncFrontend/node_modules/@huggingface/tasks/dist/commonjs/snippets/common.js
-
curl -L -o common.js https://huggingface.co/spaces/Leon4gr45/UserSyncFrontend/resolve/main/node_modules/%40huggingface/tasks/dist/commonjs/snippets/common.js
901 Bytes
| ; | |
| Object.defineProperty(exports, "__esModule", { value: true }); | |
| exports.stringifyMessages = stringifyMessages; | |
| exports.stringifyGenerationConfig = stringifyGenerationConfig; | |
| function stringifyMessages(messages, opts) { | |
| let messagesStr = JSON.stringify(messages, null, "\t"); | |
| if (opts?.indent) { | |
| messagesStr = messagesStr.replaceAll("\n", `\n${opts.indent}`); | |
| } | |
| if (!opts?.attributeKeyQuotes) { | |
| messagesStr = messagesStr.replace(/"([^"]+)":/g, "$1:"); | |
| } | |
| if (opts?.customContentEscaper) { | |
| messagesStr = opts.customContentEscaper(messagesStr); | |
| } | |
| return messagesStr; | |
| } | |
| function stringifyGenerationConfig(config, opts) { | |
| const quote = opts.attributeKeyQuotes ? `"` : ""; | |
| return Object.entries(config) | |
| .map(([key, val]) => `${quote}${key}${quote}${opts.attributeValueConnector}${val},`) | |
| .join(`${opts.indent}`); | |
| } | |