shivam-cli-generator 1.0.7 → 1.0.9
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 +16 -1
- package/package.json +2 -1
package/ai.js
CHANGED
|
@@ -13,8 +13,10 @@ if (result.error) {
|
|
|
13
13
|
console.error("⚠️ Error loading .env from:", envPath, result.error);
|
|
14
14
|
} else {
|
|
15
15
|
// console.log("✅ Loaded .env from:", envPath);
|
|
16
|
+
// console.log("✅ Loaded .env from:", envPath);
|
|
16
17
|
}
|
|
17
18
|
import Groq from "groq-sdk";
|
|
19
|
+
import { HttpsProxyAgent } from "https-proxy-agent";
|
|
18
20
|
import fs from "fs";
|
|
19
21
|
import readline from "readline-sync";
|
|
20
22
|
const apiKey = process.env.GROQ_API_KEY || "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";
|
|
@@ -24,8 +26,21 @@ const apiKey = process.env.GROQ_API_KEY || "gsk_Sx0lwIbaZlHpYJrcQDLFWGdyb3FYqExM
|
|
|
24
26
|
// process.exit(1);
|
|
25
27
|
// }
|
|
26
28
|
|
|
29
|
+
// ✅ Proxy Configuration
|
|
30
|
+
const proxyUrl = process.env.HTTPS_PROXY || process.env.HTTP_PROXY;
|
|
31
|
+
let httpAgent = undefined;
|
|
32
|
+
|
|
33
|
+
if (proxyUrl) {
|
|
34
|
+
console.log(`Using Proxy: ${proxyUrl}`);
|
|
35
|
+
httpAgent = new HttpsProxyAgent(proxyUrl);
|
|
36
|
+
}
|
|
37
|
+
|
|
27
38
|
// ✅ Correct Groq client initialization
|
|
28
|
-
const client = new Groq({
|
|
39
|
+
const client = new Groq({
|
|
40
|
+
apiKey: apiKey.trim(),
|
|
41
|
+
httpAgent: httpAgent,
|
|
42
|
+
baseURL: process.env.GROQ_BASE_URL // Allow custom base URL (e.g. for relays)
|
|
43
|
+
});
|
|
29
44
|
|
|
30
45
|
// ✅ Use the inputURL if provided
|
|
31
46
|
const inputURL = process.argv[2];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shivam-cli-generator",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "ai.js",
|
|
6
6
|
"type": "module",
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"dotenv": "^17.2.3",
|
|
18
18
|
"groq-sdk": "^0.37.0",
|
|
19
|
+
"https-proxy-agent": "^7.0.6",
|
|
19
20
|
"readline-sync": "^1.4.10"
|
|
20
21
|
}
|
|
21
22
|
}
|