openhorizon-cli 1.0.7 → 1.0.8
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 +1 -1
package/dist/index.js
CHANGED
|
@@ -223,6 +223,10 @@ async function* streamCompletion(baseUrl, apiKey, model, messages) {
|
|
|
223
223
|
const base = baseUrl.replace(/\/$/, "");
|
|
224
224
|
const v1base = base.endsWith("/v1") ? base : `${base}/v1`;
|
|
225
225
|
const url = `${v1base}/chat/completions`;
|
|
226
|
+
const systemMessage = {
|
|
227
|
+
role: "system",
|
|
228
|
+
content: "You are a helpful AI assistant. Respond in clear, concise Markdown. Made by Saidev Dhal at Galgotias University. You are hosted on NVIDIA DGX H200 GPUs."
|
|
229
|
+
};
|
|
226
230
|
const res = await fetch(url, {
|
|
227
231
|
method: "POST",
|
|
228
232
|
headers: {
|
|
@@ -230,9 +234,13 @@ async function* streamCompletion(baseUrl, apiKey, model, messages) {
|
|
|
230
234
|
Authorization: `Bearer ${apiKey}`,
|
|
231
235
|
"x-api-key": apiKey,
|
|
232
236
|
"x-client": "openhorizon-cli",
|
|
233
|
-
"x-client-version": "1.0.
|
|
237
|
+
"x-client-version": "1.0.8"
|
|
234
238
|
},
|
|
235
|
-
body: JSON.stringify({
|
|
239
|
+
body: JSON.stringify({
|
|
240
|
+
model,
|
|
241
|
+
messages: [systemMessage, ...messages],
|
|
242
|
+
stream: true
|
|
243
|
+
})
|
|
236
244
|
});
|
|
237
245
|
if (!res.ok) {
|
|
238
246
|
const body = await res.text().catch(() => "");
|
|
@@ -280,7 +288,7 @@ async function runChatLoop(options) {
|
|
|
280
288
|
console.log(
|
|
281
289
|
chalk3.gray(
|
|
282
290
|
`
|
|
283
|
-
Commands: ${chalk3.white("/model")} ${chalk3.white("/clear")} ${chalk3.white("/help")} ${chalk3.white("/version")} ${chalk3.white("/update")} ${chalk3.white("exit")}
|
|
291
|
+
Commands: ${chalk3.white("/model")} ${chalk3.white("/history")} ${chalk3.white("/clear")} ${chalk3.white("/help")} ${chalk3.white("/version")} ${chalk3.white("/update")} ${chalk3.white("exit")}
|
|
284
292
|
`
|
|
285
293
|
)
|
|
286
294
|
);
|
|
@@ -314,12 +322,12 @@ async function runChatLoop(options) {
|
|
|
314
322
|
}
|
|
315
323
|
if (trimmed === "/version") {
|
|
316
324
|
console.log(chalk3.blue(`
|
|
317
|
-
OpenHorizon CLI version: ${chalk3.bold("1.0.
|
|
325
|
+
OpenHorizon CLI version: ${chalk3.bold("1.0.8")}
|
|
318
326
|
`));
|
|
319
327
|
continue;
|
|
320
328
|
}
|
|
321
329
|
if (trimmed === "/update") {
|
|
322
|
-
await runUpdate("1.0.
|
|
330
|
+
await runUpdate("1.0.8");
|
|
323
331
|
continue;
|
|
324
332
|
}
|
|
325
333
|
if (trimmed.startsWith("/history")) {
|
|
@@ -411,7 +419,7 @@ async function runChatLoop(options) {
|
|
|
411
419
|
// src/index.ts
|
|
412
420
|
dotenv.config();
|
|
413
421
|
var program = new Command();
|
|
414
|
-
var version = "1.0.
|
|
422
|
+
var version = "1.0.8";
|
|
415
423
|
program.name("openhorizon").description("CLI to interact with OpenHorizon AI Models").version(version, "-v, --version", "Output the current version");
|
|
416
424
|
program.command("version").description("Show the current CLI version").action(() => {
|
|
417
425
|
console.log(chalk4.blue(`OpenHorizon CLI version: ${chalk4.bold(version)}`));
|