npm-noxyai 1.0.11 → 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/index-noxyai.js +81 -160
- package/package.json +1 -1
package/index-noxyai.js
CHANGED
|
@@ -18,15 +18,13 @@ function loadConfig() {
|
|
|
18
18
|
try {
|
|
19
19
|
const config = JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf8'));
|
|
20
20
|
if (config.agentMode === undefined) config.agentMode = true;
|
|
21
|
-
if (config.autoDeduct === undefined) config.autoDeduct = false;
|
|
22
21
|
return config;
|
|
23
22
|
} catch(e) {}
|
|
24
23
|
}
|
|
25
24
|
return {
|
|
26
25
|
token: null,
|
|
27
26
|
model: 'auto',
|
|
28
|
-
agentMode: true
|
|
29
|
-
autoDeduct: false
|
|
27
|
+
agentMode: true
|
|
30
28
|
};
|
|
31
29
|
}
|
|
32
30
|
|
|
@@ -46,41 +44,13 @@ function printLogo() {
|
|
|
46
44
|
` + '\x1b[0m');
|
|
47
45
|
}
|
|
48
46
|
|
|
49
|
-
function printFunnyArt() {
|
|
50
|
-
const art = `
|
|
51
|
-
▓▓ ▓▓
|
|
52
|
-
▓▓ ▓▓ ▓▓
|
|
53
|
-
▓▓▓▓ ▓▓
|
|
54
|
-
▓▓ ██ ▓▓
|
|
55
|
-
▓▓░░░░ ▓▓
|
|
56
|
-
▓▓▓▓░░ ▓▓
|
|
57
|
-
▓▓ ▓▓
|
|
58
|
-
▓▓ ▓▓ ▓▓
|
|
59
|
-
▓▓ ▓▓ ▓▓ ▓▓
|
|
60
|
-
▓▓ ▓▓ ▓▓ ▓▓
|
|
61
|
-
▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ░░▓▓
|
|
62
|
-
▓▓ ▓▓
|
|
63
|
-
▓▓░░ ▓▓
|
|
64
|
-
▓▓░░ ░░▓▓
|
|
65
|
-
▓▓░░ ░░▓▓
|
|
66
|
-
▓▓░░░░ ░░░░░░░░░░ ▓▓
|
|
67
|
-
▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓
|
|
68
|
-
▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓
|
|
69
|
-
▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓
|
|
70
|
-
▓▓░░▓▓░░▓▓ ▓▓░░▓▓░░▓▓
|
|
71
|
-
▓▓░░▓▓░░▓▓ ▓▓░░▓▓░░▓▓
|
|
72
|
-
▓▓░░▓▓░░▓▓ ▓▓░░▓▓░░▓▓
|
|
73
|
-
▓▓ ▓▓ ▓▓ ▓▓`;
|
|
74
|
-
console.log('\x1b[35m' + art + '\x1b[0m');
|
|
75
|
-
}
|
|
76
|
-
|
|
77
47
|
let spinnerInterval;
|
|
78
48
|
function startSpinner(text) {
|
|
79
49
|
const frames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
80
50
|
let i = 0;
|
|
81
51
|
process.stdout.write('\x1b[?25l');
|
|
82
52
|
spinnerInterval = setInterval(() => {
|
|
83
|
-
process.stdout.write(
|
|
53
|
+
process.stdout.write(`\r\x1b[36m${frames[i]} ${text}\x1b[0m`);
|
|
84
54
|
i = (i + 1) % frames.length;
|
|
85
55
|
}, 80);
|
|
86
56
|
}
|
|
@@ -105,11 +75,11 @@ function openBrowser(url) {
|
|
|
105
75
|
else spawn('xdg-open', [url], { stdio: 'ignore' });
|
|
106
76
|
}
|
|
107
77
|
|
|
108
|
-
// --- SEARCH FUNCTION
|
|
78
|
+
// --- SEARCH FUNCTION ---
|
|
109
79
|
async function searchWeb(query) {
|
|
110
80
|
try {
|
|
111
81
|
const config = loadConfig();
|
|
112
|
-
const res = await fetch(
|
|
82
|
+
const res = await fetch(`${BASE_URL}/api/io?action=search&q=${encodeURIComponent(query)}`, {
|
|
113
83
|
headers: { 'Authorization': 'Bearer ' + config.token }
|
|
114
84
|
});
|
|
115
85
|
const data = await res.json();
|
|
@@ -119,33 +89,6 @@ async function searchWeb(query) {
|
|
|
119
89
|
}
|
|
120
90
|
}
|
|
121
91
|
|
|
122
|
-
// --- CREDIT DEDUCTION WITH MANUAL APPROVAL ---
|
|
123
|
-
async function requestCreditDeduction(usage, model) {
|
|
124
|
-
const config = loadConfig();
|
|
125
|
-
|
|
126
|
-
if (config.autoDeduct) {
|
|
127
|
-
return { approved: true, cost: usage.estimatedCost };
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
console.log('\n\x1b[33m💰 Credit Usage Summary:\x1b[0m');
|
|
131
|
-
console.log(' Prompt Tokens: ${usage.promptTokens}');
|
|
132
|
-
console.log(' Response Tokens: ${usage.responseTokens}');
|
|
133
|
-
if (usage.reasoningTokens) {
|
|
134
|
-
console.log(' \x1b[31mReasoning Tokens: ${usage.reasoningTokens}\x1b[0m');
|
|
135
|
-
}
|
|
136
|
-
console.log(' Total Tokens: ${usage.totalTokens}');
|
|
137
|
-
console.log(' \x1b[32mEstimated Cost: ${usage.estimatedCost} credits\x1b[0m');
|
|
138
|
-
|
|
139
|
-
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
140
|
-
|
|
141
|
-
return new Promise((resolve) => {
|
|
142
|
-
rl.question('\n\x1b[33mApprove credit deduction? (y/n): \x1b[0m', (answer) => {
|
|
143
|
-
rl.close();
|
|
144
|
-
resolve({ approved: answer.toLowerCase() === 'y', cost: usage.estimatedCost });
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
|
|
149
92
|
// --- CORE FUNCTIONS ---
|
|
150
93
|
async function login() {
|
|
151
94
|
printLogo();
|
|
@@ -155,7 +98,7 @@ async function login() {
|
|
|
155
98
|
const { deviceCode, verificationUrl, interval } = await initRes.json();
|
|
156
99
|
|
|
157
100
|
console.log('=============================================');
|
|
158
|
-
console.log(
|
|
101
|
+
console.log(`URL: ${verificationUrl}`);
|
|
159
102
|
console.log('=============================================\n');
|
|
160
103
|
|
|
161
104
|
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
@@ -203,18 +146,18 @@ async function login() {
|
|
|
203
146
|
|
|
204
147
|
function runTerminalCommand(cmd) {
|
|
205
148
|
return new Promise((resolve, reject) => {
|
|
206
|
-
console.log(
|
|
149
|
+
console.log(`\n\x1b[33m⚡ Running:\x1b[0m ${cmd}\n`);
|
|
207
150
|
const isServer = cmd.includes('dev') || cmd.includes('serve') || cmd.includes('host') || cmd.includes('start');
|
|
208
151
|
const child = spawn(cmd, { shell: true, stdio: 'inherit' });
|
|
209
152
|
|
|
210
153
|
if (isServer) {
|
|
211
|
-
console.log(
|
|
154
|
+
console.log(`\n\x1b[36m[i] Server detected. Running in foreground. Press Ctrl+C to stop.\x1b[0m`);
|
|
212
155
|
setTimeout(() => resolve(), 2500);
|
|
213
156
|
}
|
|
214
157
|
|
|
215
158
|
child.on('close', (code) => {
|
|
216
159
|
if (!isServer) {
|
|
217
|
-
if (code !== 0) reject(
|
|
160
|
+
if (code !== 0) reject(`Command failed with exit code ${code}`);
|
|
218
161
|
else resolve();
|
|
219
162
|
}
|
|
220
163
|
});
|
|
@@ -225,7 +168,7 @@ function runTerminalCommand(cmd) {
|
|
|
225
168
|
function getLocalContext() {
|
|
226
169
|
try {
|
|
227
170
|
const files = fs.readdirSync(process.cwd()).filter(f => !f.startsWith('node_modules') && !f.startsWith('.git')).slice(0, 30);
|
|
228
|
-
return
|
|
171
|
+
return `\n[SYSTEM: You are in ${process.cwd()}. Files here: ${files.join(', ')}]\n`;
|
|
229
172
|
} catch (e) { return ""; }
|
|
230
173
|
}
|
|
231
174
|
|
|
@@ -260,16 +203,15 @@ async function chat(prompt, depth = 0) {
|
|
|
260
203
|
return console.error('\n❌ API Error: ' + errorText);
|
|
261
204
|
}
|
|
262
205
|
|
|
263
|
-
const modelDisplay = config.model === 'auto' ? '
|
|
264
|
-
const agentStatus = config.agentMode ? '🤖 Agent
|
|
265
|
-
console.log(
|
|
206
|
+
const modelDisplay = config.model === 'auto' ? 'Mamba-Codestral 7B' : config.model;
|
|
207
|
+
const agentStatus = config.agentMode ? '🤖 Agent' : '💬 Chat';
|
|
208
|
+
console.log(`\n${agentStatus} \x1b[36mNoxyAI (${modelDisplay}):\x1b[0m\n`);
|
|
266
209
|
|
|
267
210
|
const reader = res.body.getReader();
|
|
268
211
|
const decoder = new TextDecoder('utf-8');
|
|
269
212
|
let fullResponse = "";
|
|
270
|
-
let fullReasoning = "";
|
|
271
213
|
let usage = null;
|
|
272
|
-
let
|
|
214
|
+
let searchSources = [];
|
|
273
215
|
|
|
274
216
|
while (true) {
|
|
275
217
|
const { done, value } = await reader.read();
|
|
@@ -284,17 +226,12 @@ async function chat(prompt, depth = 0) {
|
|
|
284
226
|
try {
|
|
285
227
|
const parsed = JSON.parse(data);
|
|
286
228
|
|
|
287
|
-
|
|
288
|
-
isQwen = true;
|
|
289
|
-
}
|
|
290
|
-
|
|
229
|
+
// Reasoning in GREEN
|
|
291
230
|
if (parsed.reasoning) {
|
|
292
|
-
|
|
293
|
-
if (isQwen) {
|
|
294
|
-
process.stdout.write('\x1b[31m' + parsed.reasoning + '\x1b[0m');
|
|
295
|
-
}
|
|
231
|
+
process.stdout.write('\x1b[32m' + parsed.reasoning + '\x1b[0m');
|
|
296
232
|
}
|
|
297
233
|
|
|
234
|
+
// Normal response
|
|
298
235
|
if (parsed.text) {
|
|
299
236
|
fullResponse += parsed.text;
|
|
300
237
|
process.stdout.write(parsed.text);
|
|
@@ -308,34 +245,7 @@ async function chat(prompt, depth = 0) {
|
|
|
308
245
|
}
|
|
309
246
|
}
|
|
310
247
|
|
|
311
|
-
|
|
312
|
-
const approval = await requestCreditDeduction(usage, config.model);
|
|
313
|
-
|
|
314
|
-
if (approval.approved) {
|
|
315
|
-
const deductRes = await fetch(BASE_URL + '/api/io/deduct', {
|
|
316
|
-
method: 'POST',
|
|
317
|
-
headers: {
|
|
318
|
-
'Content-Type': 'application/json',
|
|
319
|
-
'Authorization': 'Bearer ' + config.token
|
|
320
|
-
},
|
|
321
|
-
body: JSON.stringify({
|
|
322
|
-
amount: approval.cost,
|
|
323
|
-
model: config.model,
|
|
324
|
-
tokens: usage.totalTokens
|
|
325
|
-
})
|
|
326
|
-
});
|
|
327
|
-
|
|
328
|
-
if (deductRes.ok) {
|
|
329
|
-
console.log('\n\x1b[32m✅ Credits deducted successfully!\x1b[0m');
|
|
330
|
-
} else {
|
|
331
|
-
console.log('\n\x1b[31m❌ Credit deduction failed\x1b[0m');
|
|
332
|
-
}
|
|
333
|
-
} else {
|
|
334
|
-
console.log('\n\x1b[33m⚠️ Credit deduction cancelled\x1b[0m');
|
|
335
|
-
return;
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
|
|
248
|
+
// Only process agent actions if agent mode is ON
|
|
339
249
|
if (!config.agentMode) {
|
|
340
250
|
console.log('\n');
|
|
341
251
|
return;
|
|
@@ -344,42 +254,62 @@ async function chat(prompt, depth = 0) {
|
|
|
344
254
|
console.log('\n\n\x1b[32m[Agent] Processing actions...\x1b[0m');
|
|
345
255
|
let agentFeedback = "";
|
|
346
256
|
|
|
257
|
+
// Tool: Read Files
|
|
347
258
|
const readRegex = /<read>([\s\S]*?)<\/read>/g;
|
|
348
259
|
let match;
|
|
349
260
|
while ((match = readRegex.exec(fullResponse)) !== null) {
|
|
350
261
|
const filePath = match[1].trim();
|
|
351
262
|
try {
|
|
352
263
|
const content = fs.readFileSync(filePath, 'utf8');
|
|
353
|
-
console.log(
|
|
354
|
-
agentFeedback +=
|
|
264
|
+
console.log(`\x1b[34m📖 Read file:\x1b[0m ${filePath}`);
|
|
265
|
+
agentFeedback += `\n[FILE: ${filePath}]\n\`\`\`\n${content}\n\`\`\`\n`;
|
|
355
266
|
} catch (err) {
|
|
356
|
-
console.log(
|
|
357
|
-
agentFeedback +=
|
|
267
|
+
console.log(`\x1b[31m❌ Failed to read:\x1b[0m ${filePath}`);
|
|
268
|
+
agentFeedback += `\n[ERROR reading ${filePath}: ${err.message}]\n`;
|
|
358
269
|
}
|
|
359
270
|
}
|
|
360
271
|
|
|
272
|
+
// Tool: Search Web with sources
|
|
361
273
|
const searchRegex = /<search>([\s\S]*?)<\/search>/g;
|
|
362
274
|
while ((match = searchRegex.exec(fullResponse)) !== null) {
|
|
363
275
|
const query = match[1].trim();
|
|
364
|
-
console.log(
|
|
276
|
+
console.log(`\x1b[35m🔍 Searching Web:\x1b[0m ${query}`);
|
|
365
277
|
try {
|
|
366
278
|
const searchData = await searchWeb(query);
|
|
367
|
-
|
|
368
|
-
|
|
279
|
+
if (searchData.items) {
|
|
280
|
+
searchSources = searchData.items.slice(0, 5).map(i => ({
|
|
281
|
+
title: i.title,
|
|
282
|
+
link: i.link,
|
|
283
|
+
snippet: i.snippet
|
|
284
|
+
}));
|
|
285
|
+
|
|
286
|
+
console.log(`\x1b[35m📚 Sources found:\x1b[0m`);
|
|
287
|
+
searchSources.forEach((s, i) => {
|
|
288
|
+
console.log(` \x1b[36m${i+1}. ${s.title}\x1b[0m`);
|
|
289
|
+
console.log(` \x1b[90m${s.link}\x1b[0m`);
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
const snippets = searchData.items.map(i => `- ${i.title}: ${i.snippet}\n Source: ${i.link}`).join('\n');
|
|
293
|
+
agentFeedback += `\n[SEARCH RESULTS FOR "${query}"]\n${snippets}\n`;
|
|
294
|
+
} else {
|
|
295
|
+
agentFeedback += `\n[SEARCH RESULTS FOR "${query}"]\nNo results found.\n`;
|
|
296
|
+
}
|
|
369
297
|
} catch (err) {
|
|
370
|
-
agentFeedback +=
|
|
298
|
+
agentFeedback += `\n[SEARCH FAILED: ${err.message}]\n`;
|
|
371
299
|
}
|
|
372
300
|
}
|
|
373
301
|
|
|
302
|
+
// Tool: Write Files
|
|
374
303
|
const fileRegex = /<file path="([^"]+)">([\s\S]*?)<\/file>/g;
|
|
375
304
|
while ((match = fileRegex.exec(fullResponse)) !== null) {
|
|
376
305
|
const filePath = match[1], content = match[2];
|
|
377
306
|
const dir = path.dirname(filePath);
|
|
378
307
|
if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
|
|
379
308
|
fs.writeFileSync(filePath, content.trim());
|
|
380
|
-
console.log(
|
|
309
|
+
console.log(`\x1b[32m✔ Wrote file:\x1b[0m ${filePath}`);
|
|
381
310
|
}
|
|
382
311
|
|
|
312
|
+
// Tool: Execute Commands
|
|
383
313
|
const execRegex = /<execute>([\s\S]*?)<\/execute>/g;
|
|
384
314
|
const commands = [];
|
|
385
315
|
while ((match = execRegex.exec(fullResponse)) !== null) commands.push(match[1].trim());
|
|
@@ -388,20 +318,20 @@ async function chat(prompt, depth = 0) {
|
|
|
388
318
|
try {
|
|
389
319
|
await runTerminalCommand(cmd);
|
|
390
320
|
} catch (err) {
|
|
391
|
-
console.log(
|
|
392
|
-
agentFeedback +=
|
|
321
|
+
console.log(`\x1b[31m❌ Command Failed:\x1b[0m ${err}`);
|
|
322
|
+
agentFeedback += `\n[COMMAND ERROR running "${cmd}": ${err}]\n`;
|
|
393
323
|
}
|
|
394
324
|
}
|
|
395
325
|
|
|
396
326
|
if (agentFeedback) {
|
|
397
|
-
console.log(
|
|
398
|
-
await chat(
|
|
327
|
+
console.log(`\n\x1b[33m🔄 Sending data back to Agent...\x1b[0m`);
|
|
328
|
+
await chat(`Here are the results of your actions:\n${agentFeedback}\nWhat is the next step? Output <file> or <execute> if ready, or <read>/<search> if you need more info.`, depth + 1);
|
|
399
329
|
return;
|
|
400
330
|
}
|
|
401
331
|
|
|
402
332
|
console.log('\n\x1b[32m════════════════════════════════════════\x1b[0m');
|
|
403
|
-
console.log(
|
|
404
|
-
console.log('\
|
|
333
|
+
console.log(`\x1b[32m✨ Task Completed!\x1b[0m`);
|
|
334
|
+
console.log('\x1b[32m════════════════════════════════════════\x1b[0m\n');
|
|
405
335
|
|
|
406
336
|
} catch (error) {
|
|
407
337
|
stopSpinner();
|
|
@@ -413,20 +343,17 @@ function startInteractiveMode() {
|
|
|
413
343
|
const config = loadConfig();
|
|
414
344
|
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
415
345
|
printLogo();
|
|
416
|
-
printFunnyArt();
|
|
417
346
|
|
|
418
347
|
const agentStatus = config.agentMode ? '\x1b[32mON\x1b[0m' : '\x1b[31mOFF\x1b[0m';
|
|
419
|
-
const deductStatus = config.autoDeduct ? '\x1b[32mAUTO\x1b[0m' : '\x1b[33mMANUAL\x1b[0m';
|
|
420
348
|
|
|
421
|
-
console.log(
|
|
422
|
-
console.log(
|
|
423
|
-
console.log(
|
|
424
|
-
console.log(
|
|
425
|
-
console.log(
|
|
426
|
-
console.log(
|
|
427
|
-
console.log(
|
|
428
|
-
console.log(
|
|
429
|
-
console.log(' \x1b[36m/exit\x1b[0m - Exit\n');
|
|
349
|
+
console.log(`\x1b[33mWelcome to NoxyAI Interactive Mode!\x1b[0m`);
|
|
350
|
+
console.log(`Current Model: \x1b[32m${config.model}\x1b[0m`);
|
|
351
|
+
console.log(`Agent Mode: ${agentStatus}`);
|
|
352
|
+
console.log(`\nCommands:`);
|
|
353
|
+
console.log(` \x1b[36m/agent\x1b[0m - Toggle Agent Mode (3-model collaboration)`);
|
|
354
|
+
console.log(` \x1b[36m/model\x1b[0m - Change AI Model`);
|
|
355
|
+
console.log(` \x1b[36m/clear\x1b[0m - Clear screen`);
|
|
356
|
+
console.log(` \x1b[36m/exit\x1b[0m - Exit\n`);
|
|
430
357
|
|
|
431
358
|
function ask() {
|
|
432
359
|
const prompt = config.agentMode ? '\x1b[36mNoxyAI [Agent] > \x1b[0m' : '\x1b[36mNoxyAI [Chat] > \x1b[0m';
|
|
@@ -441,44 +368,38 @@ function startInteractiveMode() {
|
|
|
441
368
|
else if (lower === '/clear') {
|
|
442
369
|
console.clear();
|
|
443
370
|
printLogo();
|
|
444
|
-
printFunnyArt();
|
|
445
371
|
ask();
|
|
446
372
|
}
|
|
447
|
-
else if (lower === '/agent') {
|
|
373
|
+
else if (lower === '/agent' || lower === '/agent on' || lower === '/agent off') {
|
|
448
374
|
config.agentMode = !config.agentMode;
|
|
449
375
|
saveConfig(config);
|
|
450
376
|
const status = config.agentMode ? '\x1b[32mON\x1b[0m' : '\x1b[31mOFF\x1b[0m';
|
|
451
|
-
console.log(
|
|
377
|
+
console.log(`\n\x1b[33m🤖 Agent Mode: ${status}\x1b[0m`);
|
|
452
378
|
if (config.agentMode) {
|
|
453
|
-
console.log('\
|
|
454
|
-
console.log(' •
|
|
455
|
-
console.log(' •
|
|
456
|
-
console.log(' •
|
|
379
|
+
console.log('\x1b[36mAgent mode uses 3 models working together:\x1b[0m');
|
|
380
|
+
console.log(' • Mamba-Codestral 7B (Fast Coding)');
|
|
381
|
+
console.log(' • Qwen3 80B (Deep Reasoning)');
|
|
382
|
+
console.log(' • GLM-4 9B (General Purpose)\n');
|
|
457
383
|
}
|
|
458
384
|
ask();
|
|
459
385
|
}
|
|
460
|
-
else if (lower === '/auto') {
|
|
461
|
-
config.autoDeduct = !config.autoDeduct;
|
|
462
|
-
saveConfig(config);
|
|
463
|
-
const status = config.autoDeduct ? '\x1b[32mAUTO\x1b[0m' : '\x1b[33mMANUAL\x1b[0m';
|
|
464
|
-
console.log('\n\x1b[33m💰 Credit Deduction Mode: ${status}\x1b[0m\n');
|
|
465
|
-
ask();
|
|
466
|
-
}
|
|
467
386
|
else if (lower === '/model') {
|
|
468
387
|
console.log('\n\x1b[33mSelect an AI Model:\x1b[0m');
|
|
469
|
-
console.log(' \x1b[36m1)\x1b[0m Auto (
|
|
470
|
-
console.log(' \x1b[36m2)\x1b[0m Qwen3 Next 80B Thinking
|
|
471
|
-
console.log(' \x1b[36m3)\x1b[0m
|
|
388
|
+
console.log(' \x1b[36m1)\x1b[0m Auto (Mamba-Codestral 7B - Fast/Coding)');
|
|
389
|
+
console.log(' \x1b[36m2)\x1b[0m Qwen3 Next 80B Thinking \x1b[32m[Reasoning in Green]\x1b[0m');
|
|
390
|
+
console.log(' \x1b[36m3)\x1b[0m Mistral Mamba-Codestral 7B');
|
|
391
|
+
console.log(' \x1b[36m4)\x1b[0m GLM-4 9B Chat');
|
|
472
392
|
|
|
473
|
-
rl.question('\nEnter number (1-
|
|
393
|
+
rl.question('\nEnter number (1-4): ', (choice) => {
|
|
474
394
|
let selected = 'auto';
|
|
475
395
|
if (choice === '2') selected = 'Qwen3';
|
|
476
|
-
if (choice === '3') selected = '
|
|
396
|
+
if (choice === '3') selected = 'Mamba-Codestral';
|
|
397
|
+
if (choice === '4') selected = 'GLM-4';
|
|
477
398
|
|
|
478
399
|
config.model = selected;
|
|
479
400
|
saveConfig(config);
|
|
480
401
|
|
|
481
|
-
console.log(
|
|
402
|
+
console.log(`\n\x1b[32m✔ Model changed to: ${selected}\x1b[0m\n`);
|
|
482
403
|
ask();
|
|
483
404
|
});
|
|
484
405
|
return;
|
|
@@ -494,22 +415,22 @@ function startInteractiveMode() {
|
|
|
494
415
|
ask();
|
|
495
416
|
}
|
|
496
417
|
|
|
418
|
+
// Command handling
|
|
497
419
|
if (command === 'login') login();
|
|
498
420
|
else if (command === 'logout') logout();
|
|
499
421
|
else if (command === 'help' || command === '--help') {
|
|
500
422
|
printLogo();
|
|
501
|
-
console.log(
|
|
502
|
-
console.log(
|
|
503
|
-
console.log(
|
|
504
|
-
console.log(
|
|
505
|
-
console.log(
|
|
506
|
-
console.log(' \x1b[36m/model\x1b[0m Change AI Model\n');
|
|
423
|
+
console.log(`\n \x1b[32mnoxyai\x1b[0m Start Interactive Mode`);
|
|
424
|
+
console.log(` \x1b[32mnoxyai chat "<prompt>"\x1b[0m Run single prompt`);
|
|
425
|
+
console.log(`\n Interactive Commands:`);
|
|
426
|
+
console.log(` \x1b[36m/agent\x1b[0m Toggle Agent Mode (3-model collaboration)`);
|
|
427
|
+
console.log(` \x1b[36m/model\x1b[0m Change AI Model\n`);
|
|
507
428
|
}
|
|
508
429
|
else if (command === 'chat') {
|
|
509
430
|
chat(args.slice(1).join(' ')).then(() => process.exit(0));
|
|
510
431
|
}
|
|
511
432
|
else if (!command) startInteractiveMode();
|
|
512
433
|
else {
|
|
513
|
-
console.error(
|
|
434
|
+
console.error(`❌ Unknown command. Run "noxyai help"`);
|
|
514
435
|
process.exit(1);
|
|
515
436
|
}
|