oroute-cli 0.2.0 → 0.2.1
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/oroute.cjs +14 -7
- package/package.json +1 -1
package/dist/oroute.cjs
CHANGED
|
@@ -243494,7 +243494,7 @@ ${YELLOW} \uCD5C\uB300 \uB77C\uC778 \uC218(${MULTILINE_MAX_LINES})\uC5D0 \uB3C4
|
|
|
243494
243494
|
});
|
|
243495
243495
|
}
|
|
243496
243496
|
async function agentChat(config) {
|
|
243497
|
-
const apiUrl = config.apiUrl ?? "
|
|
243497
|
+
const apiUrl = config.apiUrl ?? "https://api.oroute.itshin.com";
|
|
243498
243498
|
let model = config.model ?? "auto";
|
|
243499
243499
|
let cwd = process.cwd();
|
|
243500
243500
|
const homeDir = os7.homedir();
|
|
@@ -244016,7 +244016,13 @@ ${headers.join("\n")}${RESET}
|
|
|
244016
244016
|
continue;
|
|
244017
244017
|
}
|
|
244018
244018
|
const msg = err instanceof Error ? err.message : "unknown error";
|
|
244019
|
-
|
|
244019
|
+
if (msg.includes("fetch failed") || msg.includes("ECONNREFUSED") || msg.includes("Could not resolve")) {
|
|
244020
|
+
printError(`API \uC11C\uBC84\uC5D0 \uC5F0\uACB0\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4 (${apiUrl})`);
|
|
244021
|
+
console.log(`${YELLOW} \uC11C\uBC84\uAC00 \uC544\uC9C1 \uBC30\uD3EC\uB418\uC9C0 \uC54A\uC558\uAC70\uB098 \uB124\uD2B8\uC6CC\uD06C \uBB38\uC81C\uC77C \uC218 \uC788\uC2B5\uB2C8\uB2E4.${RESET}`);
|
|
244022
|
+
console.log(`${GRAY} \uB85C\uCEEC \uC11C\uBC84 \uC0AC\uC6A9: oroute --api-url http://localhost:3001${RESET}`);
|
|
244023
|
+
} else {
|
|
244024
|
+
printError(`Request failed: ${msg}`);
|
|
244025
|
+
}
|
|
244020
244026
|
messages.pop();
|
|
244021
244027
|
continueLoop = false;
|
|
244022
244028
|
}
|
|
@@ -244103,6 +244109,7 @@ var WHITE2 = "\x1B[37m";
|
|
|
244103
244109
|
var VERSION = "0.2.0";
|
|
244104
244110
|
var CONFIG_DIR = path18.join(os9.homedir(), ".oroute");
|
|
244105
244111
|
var CONFIG_FILE = path18.join(CONFIG_DIR, "config.json");
|
|
244112
|
+
var DEFAULT_API_URL = "https://api.oroute.itshin.com";
|
|
244106
244113
|
var LOCAL_API_URL = "http://localhost:3001";
|
|
244107
244114
|
var ASCII_CHARACTER = `
|
|
244108
244115
|
${GRAY4} \u2584\u2584\u2588\u2588\u2588\u2584\u2584
|
|
@@ -244250,7 +244257,7 @@ async function loginWithApiKey(config) {
|
|
|
244250
244257
|
console.log(`${YELLOW3} Invalid key format. O'Route keys start with "or-"${RESET2}`);
|
|
244251
244258
|
return;
|
|
244252
244259
|
}
|
|
244253
|
-
const apiUrl = config.apiUrl ??
|
|
244260
|
+
const apiUrl = config.apiUrl ?? DEFAULT_API_URL;
|
|
244254
244261
|
console.log(`${GRAY4} Verifying key...${RESET2}`);
|
|
244255
244262
|
try {
|
|
244256
244263
|
const res = await fetch(`${apiUrl}/v1/providers/status`, {
|
|
@@ -244276,7 +244283,7 @@ async function loginWithApiKey(config) {
|
|
|
244276
244283
|
}
|
|
244277
244284
|
}
|
|
244278
244285
|
async function loginWithGoogle(config) {
|
|
244279
|
-
const apiUrl = config.apiUrl ??
|
|
244286
|
+
const apiUrl = config.apiUrl ?? DEFAULT_API_URL;
|
|
244280
244287
|
console.log(`${GRAY4} Requesting device code...${RESET2}`);
|
|
244281
244288
|
try {
|
|
244282
244289
|
const res = await fetch(`${apiUrl}/v1/auth/device`, {
|
|
@@ -244329,7 +244336,7 @@ async function chat(config) {
|
|
|
244329
244336
|
console.log(`${YELLOW3} No API Key configured. Run option 1 first.${RESET2}`);
|
|
244330
244337
|
return;
|
|
244331
244338
|
}
|
|
244332
|
-
const apiUrl = config.apiUrl ??
|
|
244339
|
+
const apiUrl = config.apiUrl ?? DEFAULT_API_URL;
|
|
244333
244340
|
const model = config.model ?? "auto";
|
|
244334
244341
|
const cwd = process.cwd();
|
|
244335
244342
|
console.log(`${GREEN2}${BOLD2} O'Route${RESET2} v${VERSION}`);
|
|
@@ -244378,7 +244385,7 @@ async function chat(config) {
|
|
|
244378
244385
|
}
|
|
244379
244386
|
}
|
|
244380
244387
|
async function checkStatus(config) {
|
|
244381
|
-
const apiUrl = config.apiUrl ??
|
|
244388
|
+
const apiUrl = config.apiUrl ?? DEFAULT_API_URL;
|
|
244382
244389
|
console.log(`${GRAY4} Checking O'Route status...${RESET2}`);
|
|
244383
244390
|
try {
|
|
244384
244391
|
const res = await fetch(`${apiUrl}/health`, { signal: AbortSignal.timeout(5e3) });
|
|
@@ -244467,7 +244474,7 @@ async function main() {
|
|
|
244467
244474
|
console.log(`${YELLOW3}No API Key. Run: oroute login${RESET2}`);
|
|
244468
244475
|
process.exit(1);
|
|
244469
244476
|
}
|
|
244470
|
-
const apiUrl = config.apiUrl ??
|
|
244477
|
+
const apiUrl = config.apiUrl ?? DEFAULT_API_URL;
|
|
244471
244478
|
try {
|
|
244472
244479
|
const res = await fetch(`${apiUrl}/v1/messages`, {
|
|
244473
244480
|
method: "POST",
|