openhorizon-cli 1.0.8 → 1.0.10
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 -6
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -234,7 +234,7 @@ async function* streamCompletion(baseUrl, apiKey, model, messages) {
|
|
|
234
234
|
Authorization: `Bearer ${apiKey}`,
|
|
235
235
|
"x-api-key": apiKey,
|
|
236
236
|
"x-client": "openhorizon-cli",
|
|
237
|
-
"x-client-version": "1.0.
|
|
237
|
+
"x-client-version": "1.0.10"
|
|
238
238
|
},
|
|
239
239
|
body: JSON.stringify({
|
|
240
240
|
model,
|
|
@@ -243,8 +243,21 @@ async function* streamCompletion(baseUrl, apiKey, model, messages) {
|
|
|
243
243
|
})
|
|
244
244
|
});
|
|
245
245
|
if (!res.ok) {
|
|
246
|
-
const
|
|
247
|
-
|
|
246
|
+
const bodyText = await res.text().catch(() => "");
|
|
247
|
+
let errorMessage = res.statusText || String(res.status);
|
|
248
|
+
try {
|
|
249
|
+
const json = JSON.parse(bodyText);
|
|
250
|
+
if (json.details) {
|
|
251
|
+
errorMessage = json.details;
|
|
252
|
+
} else if (json.error) {
|
|
253
|
+
errorMessage = json.error;
|
|
254
|
+
} else {
|
|
255
|
+
errorMessage = bodyText;
|
|
256
|
+
}
|
|
257
|
+
} catch {
|
|
258
|
+
errorMessage = bodyText || res.statusText || String(res.status);
|
|
259
|
+
}
|
|
260
|
+
throw new Error(errorMessage);
|
|
248
261
|
}
|
|
249
262
|
if (!res.body) throw new Error("No response body received from server.");
|
|
250
263
|
const reader = res.body.getReader();
|
|
@@ -322,12 +335,12 @@ async function runChatLoop(options) {
|
|
|
322
335
|
}
|
|
323
336
|
if (trimmed === "/version") {
|
|
324
337
|
console.log(chalk3.blue(`
|
|
325
|
-
OpenHorizon CLI version: ${chalk3.bold("1.0.
|
|
338
|
+
OpenHorizon CLI version: ${chalk3.bold("1.0.10")}
|
|
326
339
|
`));
|
|
327
340
|
continue;
|
|
328
341
|
}
|
|
329
342
|
if (trimmed === "/update") {
|
|
330
|
-
await runUpdate("1.0.
|
|
343
|
+
await runUpdate("1.0.10");
|
|
331
344
|
continue;
|
|
332
345
|
}
|
|
333
346
|
if (trimmed.startsWith("/history")) {
|
|
@@ -419,7 +432,7 @@ async function runChatLoop(options) {
|
|
|
419
432
|
// src/index.ts
|
|
420
433
|
dotenv.config();
|
|
421
434
|
var program = new Command();
|
|
422
|
-
var version = "1.0.
|
|
435
|
+
var version = "1.0.10";
|
|
423
436
|
program.name("openhorizon").description("CLI to interact with OpenHorizon AI Models").version(version, "-v, --version", "Output the current version");
|
|
424
437
|
program.command("version").description("Show the current CLI version").action(() => {
|
|
425
438
|
console.log(chalk4.blue(`OpenHorizon CLI version: ${chalk4.bold(version)}`));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openhorizon-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10",
|
|
4
4
|
"description": "Official CLI for OpenHorizon — chat with AI models directly from your terminal",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"build": "tsup",
|
|
18
18
|
"dev": "tsup --watch",
|
|
19
19
|
"prepublishOnly": "npm run build",
|
|
20
|
-
"
|
|
20
|
+
"release": "npm publish --access public"
|
|
21
21
|
},
|
|
22
22
|
"keywords": [
|
|
23
23
|
"openhorizon",
|