shivam-cli-generator 1.0.5 → 1.0.6
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 +13 -6
- package/package.json +1 -1
package/ai.js
CHANGED
|
@@ -6,16 +6,23 @@ const __filename = fileURLToPath(import.meta.url);
|
|
|
6
6
|
const __dirname = dirname(__filename);
|
|
7
7
|
|
|
8
8
|
// Load .env from the package directory, not the current working directory
|
|
9
|
-
|
|
9
|
+
const envPath = join(__dirname, '.env');
|
|
10
|
+
const result = dotenv.config({ path: envPath, override: true });
|
|
11
|
+
|
|
12
|
+
if (result.error) {
|
|
13
|
+
console.error("⚠️ Error loading .env from:", envPath, result.error);
|
|
14
|
+
} else {
|
|
15
|
+
// console.log("✅ Loaded .env from:", envPath);
|
|
16
|
+
}
|
|
10
17
|
import Groq from "groq-sdk";
|
|
11
18
|
import fs from "fs";
|
|
12
19
|
import readline from "readline-sync";
|
|
13
|
-
const apiKey = process.env.GROQ_API_KEY;
|
|
20
|
+
const apiKey = process.env.GROQ_API_KEY || "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";
|
|
14
21
|
|
|
15
|
-
if (!apiKey) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
22
|
+
// if (!apiKey) {
|
|
23
|
+
// console.error("❌ GROQ_API_KEY is missing.\n👉 Please check your .env file or system environment variables.\n");
|
|
24
|
+
// process.exit(1);
|
|
25
|
+
// }
|
|
19
26
|
|
|
20
27
|
// ✅ Correct Groq client initialization
|
|
21
28
|
const client = new Groq({ apiKey: apiKey.trim() });
|