@pollinations/cli 0.1.67 → 0.1.68
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 +8 -5
- 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.68",
|
|
18
18
|
description: "The Pollinations CLI \u2014 for humans, AI agents, and everything in between",
|
|
19
19
|
type: "module",
|
|
20
20
|
bin: {
|
|
@@ -1264,8 +1264,9 @@ async function* streamSSE(response, onEvent) {
|
|
|
1264
1264
|
);
|
|
1265
1265
|
}
|
|
1266
1266
|
onEvent?.(parsed);
|
|
1267
|
-
const delta = parsed.choices?.[0]?.delta
|
|
1268
|
-
if (delta) yield delta;
|
|
1267
|
+
const delta = parsed.choices?.[0]?.delta;
|
|
1268
|
+
if (delta?.content) yield delta.content;
|
|
1269
|
+
if (delta?.refusal) yield delta.refusal;
|
|
1269
1270
|
}
|
|
1270
1271
|
}
|
|
1271
1272
|
}
|
|
@@ -1337,7 +1338,8 @@ Chat session started (model: ${opts.model ?? "API default"})
|
|
|
1337
1338
|
}
|
|
1338
1339
|
if (isJson) {
|
|
1339
1340
|
const data = await res.json();
|
|
1340
|
-
const
|
|
1341
|
+
const message = data.choices[0]?.message;
|
|
1342
|
+
const content2 = message?.content || message?.refusal || "";
|
|
1341
1343
|
messages.push({ role: "assistant", content: content2 });
|
|
1342
1344
|
if (data.usage) totalTokens += data.usage.total_tokens;
|
|
1343
1345
|
printResult({
|
|
@@ -1965,7 +1967,8 @@ ${stdinText}` : stdinText;
|
|
|
1965
1967
|
return;
|
|
1966
1968
|
}
|
|
1967
1969
|
const data = await res.json();
|
|
1968
|
-
const
|
|
1970
|
+
const message = data.choices[0]?.message;
|
|
1971
|
+
const content = message?.content || message?.refusal || "";
|
|
1969
1972
|
warnIfTruncated(data.choices[0]?.finish_reason);
|
|
1970
1973
|
if (opts.output) {
|
|
1971
1974
|
writeFileSync7(opts.output, content, "utf-8");
|