aionix 1.1.0 → 1.1.2
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/bin/index.js +5 -4
- package/lib/chatai.js +49 -0
- package/lib/imgtotextai.js +59 -0
- package/lib/numinfo.js +52 -0
- package/package.json +7 -2
package/bin/index.js
CHANGED
|
@@ -136,14 +136,15 @@ async function main() {
|
|
|
136
136
|
|
|
137
137
|
await showPortTable(config.port || 3000);
|
|
138
138
|
|
|
139
|
-
const stopSpin = spinner('Starting AIONIX server...');
|
|
140
|
-
await sleep(600);
|
|
141
|
-
stopSpin();
|
|
142
|
-
|
|
143
139
|
process.env.AIONIX_PORT = config.port || 3000;
|
|
144
140
|
process.env.AIONIX_AUTO_OPEN = config.autoOpen !== false ? 'true' : 'false';
|
|
145
141
|
process.env.AIONIX_NAME = config.name || 'Developer';
|
|
146
142
|
|
|
143
|
+
const stopSpin = spinner('Starting AIONIX server...');
|
|
144
|
+
await sleep(500);
|
|
145
|
+
stopSpin();
|
|
146
|
+
console.log();
|
|
147
|
+
|
|
147
148
|
require('../server/app');
|
|
148
149
|
}
|
|
149
150
|
|
package/lib/chatai.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const https = require('https');
|
|
5
|
+
|
|
6
|
+
const MODELS = {
|
|
7
|
+
1: '🦙 Llama 3.3 70B Pro',
|
|
8
|
+
2: '🚀 DeepAI Pro Max',
|
|
9
|
+
3: '💎 DeepSeek V3 Ultra',
|
|
10
|
+
4: '⚡ Gemma 3B Turbo',
|
|
11
|
+
5: '🌪️ Mistral 3.2 Pro',
|
|
12
|
+
6: '🤖 Claude 3.5 Sonnet',
|
|
13
|
+
7: '🔬 GPT-4o Mini',
|
|
14
|
+
8: '🎨 Creative AI Max'
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
function fetchUrl(url) {
|
|
18
|
+
return new Promise((resolve, reject) => {
|
|
19
|
+
https.get(url, (res) => {
|
|
20
|
+
let data = '';
|
|
21
|
+
res.on('data', chunk => data += chunk);
|
|
22
|
+
res.on('end', () => {
|
|
23
|
+
try { resolve(JSON.parse(data)); }
|
|
24
|
+
catch(e) { reject(new Error('Invalid JSON response')); }
|
|
25
|
+
});
|
|
26
|
+
}).on('error', reject);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async function chatai(prompt, options = {}) {
|
|
31
|
+
if (!prompt) throw new Error('Prompt is required');
|
|
32
|
+
const model = options.model || 1;
|
|
33
|
+
if (!MODELS[model]) throw new Error(`Invalid model. Choose 1-8`);
|
|
34
|
+
const encoded = encodeURIComponent(prompt);
|
|
35
|
+
const url = `https://gptxnexu.vercel.app/mode=${model}/?txt=${encoded}`;
|
|
36
|
+
const data = await fetchUrl(url);
|
|
37
|
+
if (!data.success) throw new Error('API request failed');
|
|
38
|
+
return {
|
|
39
|
+
response: data.response,
|
|
40
|
+
model: data.model,
|
|
41
|
+
model_id: data.model_id,
|
|
42
|
+
words: data.words,
|
|
43
|
+
characters: data.characters,
|
|
44
|
+
timestamp: data.timestamp
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
chatai.models = MODELS;
|
|
49
|
+
module.exports = chatai;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const https = require('https');
|
|
5
|
+
|
|
6
|
+
function fetchUrl(url) {
|
|
7
|
+
return new Promise((resolve, reject) => {
|
|
8
|
+
https.get(url, (res) => {
|
|
9
|
+
let data = '';
|
|
10
|
+
res.on('data', chunk => data += chunk);
|
|
11
|
+
res.on('end', () => {
|
|
12
|
+
try { resolve(JSON.parse(data)); }
|
|
13
|
+
catch(e) { reject(new Error('Invalid JSON response')); }
|
|
14
|
+
});
|
|
15
|
+
}).on('error', reject);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async function imgtotextai(prompt, options = {}) {
|
|
20
|
+
if (!prompt) throw new Error('Prompt is required');
|
|
21
|
+
const encoded = encodeURIComponent(prompt);
|
|
22
|
+
|
|
23
|
+
// Primary API
|
|
24
|
+
const primaryUrl = `https://nexeoimage.vercel.app/apiv1/image?text=${encoded}`;
|
|
25
|
+
// Fallback API
|
|
26
|
+
const fallbackUrl = `https://imagexnexu.vercel.app/?prompt=${encoded}`;
|
|
27
|
+
|
|
28
|
+
try {
|
|
29
|
+
const data = await fetchUrl(primaryUrl);
|
|
30
|
+
if (data && data.url) {
|
|
31
|
+
return {
|
|
32
|
+
url: data.url,
|
|
33
|
+
prompt: prompt,
|
|
34
|
+
source: 'primary'
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
throw new Error('Primary API failed');
|
|
38
|
+
} catch(e) {
|
|
39
|
+
// Fallback
|
|
40
|
+
const data = await fetchUrl(fallbackUrl);
|
|
41
|
+
let result;
|
|
42
|
+
try {
|
|
43
|
+
result = typeof data.result === 'string' ? JSON.parse(data.result) : data.result;
|
|
44
|
+
} catch(e) {
|
|
45
|
+
throw new Error('Both APIs failed');
|
|
46
|
+
}
|
|
47
|
+
if (!result?.data?.url) throw new Error('Image generation failed');
|
|
48
|
+
return {
|
|
49
|
+
url: result.data.url,
|
|
50
|
+
filename: result.data.filename,
|
|
51
|
+
size: result.data.size,
|
|
52
|
+
expired: result.data.expired,
|
|
53
|
+
prompt: prompt,
|
|
54
|
+
source: 'fallback'
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
module.exports = imgtotextai;
|
package/lib/numinfo.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const https = require('https');
|
|
5
|
+
|
|
6
|
+
function fetchUrl(url) {
|
|
7
|
+
return new Promise((resolve, reject) => {
|
|
8
|
+
https.get(url, (res) => {
|
|
9
|
+
let data = '';
|
|
10
|
+
res.on('data', chunk => data += chunk);
|
|
11
|
+
res.on('end', () => {
|
|
12
|
+
try { resolve(JSON.parse(data)); }
|
|
13
|
+
catch(e) { reject(new Error('Invalid JSON response')); }
|
|
14
|
+
});
|
|
15
|
+
}).on('error', reject);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Rate limiting
|
|
20
|
+
const callLog = {};
|
|
21
|
+
const LIMIT = 5; // 5 calls per number per day
|
|
22
|
+
|
|
23
|
+
function checkLimit(number) {
|
|
24
|
+
const today = new Date().toDateString();
|
|
25
|
+
const key = `${number}_${today}`;
|
|
26
|
+
callLog[key] = (callLog[key] || 0) + 1;
|
|
27
|
+
if (callLog[key] > LIMIT) throw new Error(`Daily limit reached for this number (${LIMIT}/day)`);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async function numinfo(number) {
|
|
31
|
+
if (!number) throw new Error('Number is required');
|
|
32
|
+
const cleaned = String(number).replace(/\D/g, '');
|
|
33
|
+
if (cleaned.length < 10) throw new Error('Invalid number format');
|
|
34
|
+
|
|
35
|
+
checkLimit(cleaned);
|
|
36
|
+
|
|
37
|
+
const url = `https://nmdllpezcocquamhgpmb.supabase.co/functions/v1/lookup?number=${cleaned}`;
|
|
38
|
+
const data = await fetchUrl(url);
|
|
39
|
+
|
|
40
|
+
if (!data.result || !data.result.length) throw new Error('No info found for this number');
|
|
41
|
+
|
|
42
|
+
const info = data.result[0];
|
|
43
|
+
|
|
44
|
+
// Only return basic info — no sensitive data
|
|
45
|
+
return {
|
|
46
|
+
name: info.name || null,
|
|
47
|
+
fname: info.fname || null,
|
|
48
|
+
circle: info.circle || null
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
module.exports = numinfo;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aionix",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Offline Developer Toolkit - Learning, Tools & Productivity",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -10,7 +10,12 @@
|
|
|
10
10
|
"bin/",
|
|
11
11
|
"server/",
|
|
12
12
|
"client/",
|
|
13
|
-
"db/"
|
|
13
|
+
"db/",
|
|
14
|
+
"bin/",
|
|
15
|
+
"server/",
|
|
16
|
+
"client/",
|
|
17
|
+
"db/",
|
|
18
|
+
"lib/"
|
|
14
19
|
],
|
|
15
20
|
"keywords": [
|
|
16
21
|
"developer",
|