draftify-cli 1.0.3 → 1.0.4
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/dist/utils/api.js +3 -2
- package/dist/utils/config.js +5 -0
- package/package.json +1 -1
package/dist/utils/api.js
CHANGED
|
@@ -10,10 +10,11 @@ const genai_1 = require("@google/genai");
|
|
|
10
10
|
const dotenv_1 = __importDefault(require("dotenv"));
|
|
11
11
|
dotenv_1.default.config();
|
|
12
12
|
async function refactorCodeApi(fileName, code, instruction, history, modelName, skillsData, thinkingLevel, onChunk, abortSignal) {
|
|
13
|
+
const apiKey = process.env.GEMINI_API_KEY || (0, config_1.getGeminiApiKey)();
|
|
13
14
|
// 1. HELYI VÉGREHAJTÁS (Ha van GEMINI_API_KEY a .env-ben, közvetlenül a Geminit hívjuk)
|
|
14
15
|
// Ez tökéletes a helyi teszteléshez, mielőtt a backendre (Vercel) kerül a kód.
|
|
15
|
-
if (
|
|
16
|
-
const ai = new genai_1.GoogleGenAI({ apiKey:
|
|
16
|
+
if (apiKey) {
|
|
17
|
+
const ai = new genai_1.GoogleGenAI({ apiKey: apiKey });
|
|
17
18
|
// Modell kiválasztása a kívánt logika alapján
|
|
18
19
|
let geminiModel = 'gemini-3.5-flash'; // Alapértelmezett (Medium, Low, Adaptive)
|
|
19
20
|
if (thinkingLevel === 'High') {
|
package/dist/utils/config.js
CHANGED
|
@@ -13,6 +13,7 @@ exports.getSkills = getSkills;
|
|
|
13
13
|
exports.setSkills = setSkills;
|
|
14
14
|
exports.getThinkingLevel = getThinkingLevel;
|
|
15
15
|
exports.setThinkingLevel = setThinkingLevel;
|
|
16
|
+
exports.getGeminiApiKey = getGeminiApiKey;
|
|
16
17
|
const os_1 = __importDefault(require("os"));
|
|
17
18
|
const fs_1 = __importDefault(require("fs"));
|
|
18
19
|
const path_1 = __importDefault(require("path"));
|
|
@@ -71,3 +72,7 @@ function getThinkingLevel() {
|
|
|
71
72
|
function setThinkingLevel(level) {
|
|
72
73
|
saveConfig({ thinkingLevel: level });
|
|
73
74
|
}
|
|
75
|
+
function getGeminiApiKey() {
|
|
76
|
+
const config = getConfig();
|
|
77
|
+
return config.geminiApiKey || null;
|
|
78
|
+
}
|