@pollinations/cli 0.1.35 → 0.1.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +19 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var init_package = __esm({
|
|
|
14
14
|
"package.json"() {
|
|
15
15
|
package_default = {
|
|
16
16
|
name: "@pollinations/cli",
|
|
17
|
-
version: "0.1.
|
|
17
|
+
version: "0.1.36",
|
|
18
18
|
description: "The Pollinations CLI \u2014 for humans, AI agents, and everything in between",
|
|
19
19
|
type: "module",
|
|
20
20
|
bin: {
|
|
@@ -2054,7 +2054,9 @@ var applyWithSnapshot = (ctx, id, paths, apply) => {
|
|
|
2054
2054
|
throw error;
|
|
2055
2055
|
}
|
|
2056
2056
|
for (const path of paths) {
|
|
2057
|
-
snapshot.files[path]
|
|
2057
|
+
const file = snapshot.files[path];
|
|
2058
|
+
if (!existing?.complete || contentHash(rollback[path].before) === file.afterHash)
|
|
2059
|
+
file.afterHash = contentHash(readTextIfExists(path));
|
|
2058
2060
|
}
|
|
2059
2061
|
snapshot.complete = true;
|
|
2060
2062
|
writeSnapshot(ctx, id, paths, snapshot);
|
|
@@ -5257,6 +5259,7 @@ function modelBody(opts, includeRequired) {
|
|
|
5257
5259
|
if (opts.requiredSafety !== void 0) {
|
|
5258
5260
|
body.requiredSafetyFeatures = String(opts.requiredSafety).trim() === "none" ? [] : commaSeparatedList(opts.requiredSafety);
|
|
5259
5261
|
}
|
|
5262
|
+
if (opts.streaming === false) body.advertised = { streaming: false };
|
|
5260
5263
|
if (includeRequired) {
|
|
5261
5264
|
for (const required of ["name", "title"]) {
|
|
5262
5265
|
if (!body[required]) {
|
|
@@ -5363,6 +5366,9 @@ var create3 = addPriceOptions(
|
|
|
5363
5366
|
).option(
|
|
5364
5367
|
"--image-pricing <mode>",
|
|
5365
5368
|
"Image billing: request (per image, default) or tokens"
|
|
5369
|
+
).option(
|
|
5370
|
+
"--no-streaming",
|
|
5371
|
+
"Text endpoint has no SSE (`my-models test` reports streaming: false); stream: true calls get the whole answer at once"
|
|
5366
5372
|
)
|
|
5367
5373
|
).action(async (opts) => {
|
|
5368
5374
|
const key = requireKey();
|
|
@@ -6089,6 +6095,15 @@ import { createReadStream, existsSync as existsSync7, statSync as statSync2 } fr
|
|
|
6089
6095
|
import { basename as basename5 } from "path";
|
|
6090
6096
|
import { Command as Command24 } from "commander";
|
|
6091
6097
|
init_output();
|
|
6098
|
+
var encodeExtValue = (value) => encodeURIComponent(value).replace(
|
|
6099
|
+
/['()*]/g,
|
|
6100
|
+
(char) => `%${char.charCodeAt(0).toString(16).toUpperCase()}`
|
|
6101
|
+
);
|
|
6102
|
+
var HEADER_SAFE = /^[\x20-\x7e\xa0-\xff]*$/;
|
|
6103
|
+
var fileNameHeaders = (name) => ({
|
|
6104
|
+
"Content-Disposition": `attachment; filename*=UTF-8''${encodeExtValue(name)}`,
|
|
6105
|
+
...HEADER_SAFE.test(name) && { "X-File-Name": name }
|
|
6106
|
+
});
|
|
6092
6107
|
var uploadCommand = new Command24("upload").description(
|
|
6093
6108
|
"Upload a local file to media.pollinations.ai and print its public URL"
|
|
6094
6109
|
).argument("<file>", "Path to the local file to upload").action(async (file) => {
|
|
@@ -6105,7 +6120,7 @@ var uploadCommand = new Command24("upload").description(
|
|
|
6105
6120
|
Authorization: `Bearer ${key}`,
|
|
6106
6121
|
"Content-Type": mime,
|
|
6107
6122
|
"Content-Length": String(size),
|
|
6108
|
-
|
|
6123
|
+
...fileNameHeaders(basename5(file))
|
|
6109
6124
|
},
|
|
6110
6125
|
body: createReadStream(file),
|
|
6111
6126
|
duplex: "half"
|
|
@@ -6154,7 +6169,7 @@ function resolveKeyIds(keys, requested) {
|
|
|
6154
6169
|
});
|
|
6155
6170
|
}
|
|
6156
6171
|
function tokensIn(r) {
|
|
6157
|
-
return (r.input_text_tokens ?? 0) + (r.input_cached_tokens ?? 0) + (r.input_audio_tokens ?? 0) + (r.input_image_tokens ?? 0);
|
|
6172
|
+
return (r.input_text_tokens ?? 0) + (r.input_cached_tokens ?? 0) + (r.input_cache_write_tokens ?? 0) + (r.input_audio_tokens ?? 0) + (r.input_image_tokens ?? 0);
|
|
6158
6173
|
}
|
|
6159
6174
|
function filterDailyRows(rows, keyIds, models2) {
|
|
6160
6175
|
let out = rows;
|