shivam-cli-generator 1.1.1 ā 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/ai.js +21 -10
- package/package.json +2 -2
package/ai.js
CHANGED
|
@@ -1,16 +1,25 @@
|
|
|
1
|
-
// Version 1.
|
|
1
|
+
// Version 1.1.2
|
|
2
2
|
import dotenv from 'dotenv';
|
|
3
3
|
import { fileURLToPath } from 'url';
|
|
4
4
|
import { dirname, join } from 'path';
|
|
5
5
|
|
|
6
|
+
import Groq from "groq-sdk";
|
|
7
|
+
import fs from "fs";
|
|
8
|
+
import readline from "readline-sync";
|
|
9
|
+
import { HttpsProxyAgent } from "https-proxy-agent"; // ā Fixed import
|
|
10
|
+
|
|
6
11
|
const __filename = fileURLToPath(import.meta.url);
|
|
7
12
|
const __dirname = dirname(__filename);
|
|
8
13
|
|
|
9
|
-
// Load .env from the package directory
|
|
14
|
+
// Load .env from the package directory
|
|
10
15
|
dotenv.config({ path: join(__dirname, '.env') });
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
16
|
+
|
|
17
|
+
// š FIREWALL BYPASS PROXY URL (change if blocked)
|
|
18
|
+
const proxyUrl = "http://global.freeproxy.ai:80";
|
|
19
|
+
|
|
20
|
+
// Create proxy agent
|
|
21
|
+
const proxyAgent = new HttpsProxyAgent(proxyUrl);
|
|
22
|
+
|
|
14
23
|
const apiKey = process.env.GROQ_API_KEY;
|
|
15
24
|
|
|
16
25
|
if (!apiKey) {
|
|
@@ -18,8 +27,12 @@ if (!apiKey) {
|
|
|
18
27
|
process.exit(1);
|
|
19
28
|
}
|
|
20
29
|
|
|
21
|
-
//
|
|
22
|
-
const client = new Groq({
|
|
30
|
+
// ā Updated Groq client initialization WITH PROXY
|
|
31
|
+
const client = new Groq({
|
|
32
|
+
apiKey,
|
|
33
|
+
httpAgent: proxyAgent,
|
|
34
|
+
httpsAgent: proxyAgent
|
|
35
|
+
});
|
|
23
36
|
|
|
24
37
|
// ā
Use the inputURL if provided
|
|
25
38
|
const inputURL = process.argv[2];
|
|
@@ -75,9 +88,7 @@ async function main() {
|
|
|
75
88
|
|
|
76
89
|
} catch (error) {
|
|
77
90
|
console.error("\nā Error communicating with AI:", error.message);
|
|
78
|
-
|
|
79
|
-
console.error("š Check your internet connection.\n");
|
|
80
|
-
}
|
|
91
|
+
console.error("š The firewall proxy may be blocked. Try changing proxy URL at the top.\n");
|
|
81
92
|
}
|
|
82
93
|
}
|
|
83
94
|
}
|
package/package.json
CHANGED