openhorizon-cli 1.0.8 → 1.0.12
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 +14 -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.12"
|
|
238
238
|
},
|
|
239
239
|
body: JSON.stringify({
|
|
240
240
|
model,
|
|
@@ -243,8 +243,16 @@ 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
|
+
let rawMsg = json.details || json.error || bodyText;
|
|
251
|
+
errorMessage = rawMsg.replace(/^(error:?\s*)+/i, "");
|
|
252
|
+
} catch {
|
|
253
|
+
errorMessage = bodyText || res.statusText || String(res.status);
|
|
254
|
+
}
|
|
255
|
+
throw new Error(errorMessage);
|
|
248
256
|
}
|
|
249
257
|
if (!res.body) throw new Error("No response body received from server.");
|
|
250
258
|
const reader = res.body.getReader();
|
|
@@ -322,12 +330,12 @@ async function runChatLoop(options) {
|
|
|
322
330
|
}
|
|
323
331
|
if (trimmed === "/version") {
|
|
324
332
|
console.log(chalk3.blue(`
|
|
325
|
-
OpenHorizon CLI version: ${chalk3.bold("1.0.
|
|
333
|
+
OpenHorizon CLI version: ${chalk3.bold("1.0.12")}
|
|
326
334
|
`));
|
|
327
335
|
continue;
|
|
328
336
|
}
|
|
329
337
|
if (trimmed === "/update") {
|
|
330
|
-
await runUpdate("1.0.
|
|
338
|
+
await runUpdate("1.0.12");
|
|
331
339
|
continue;
|
|
332
340
|
}
|
|
333
341
|
if (trimmed.startsWith("/history")) {
|
|
@@ -419,7 +427,7 @@ async function runChatLoop(options) {
|
|
|
419
427
|
// src/index.ts
|
|
420
428
|
dotenv.config();
|
|
421
429
|
var program = new Command();
|
|
422
|
-
var version = "1.0.
|
|
430
|
+
var version = "1.0.12";
|
|
423
431
|
program.name("openhorizon").description("CLI to interact with OpenHorizon AI Models").version(version, "-v, --version", "Output the current version");
|
|
424
432
|
program.command("version").description("Show the current CLI version").action(() => {
|
|
425
433
|
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.12",
|
|
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",
|