draftify-cli 1.0.69 → 1.0.71
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 +11 -9
- package/package.json +1 -1
package/dist/utils/api.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.refactorCodeApi = refactorCodeApi;
|
|
7
7
|
exports.getUserProfile = getUserProfile;
|
|
8
8
|
const config_1 = require("./config");
|
|
9
|
-
const
|
|
9
|
+
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) {
|
|
@@ -14,7 +14,7 @@ async function refactorCodeApi(fileName, code, instruction, history, modelName,
|
|
|
14
14
|
// 1. HELYI VÉGREHAJTÁS (Ha van GEMINI_API_KEY a .env-ben, közvetlenül a Geminit hívjuk)
|
|
15
15
|
// Ez tökéletes a helyi teszteléshez, mielőtt a backendre (Vercel) kerül a kód.
|
|
16
16
|
if (apiKey) {
|
|
17
|
-
const ai = new
|
|
17
|
+
const ai = new genai_1.GoogleGenAI({ apiKey });
|
|
18
18
|
// Modell kiválasztása a kívánt logika alapján
|
|
19
19
|
let geminiModel = 'gemini-3.5-flash'; // Alapértelmezett (Medium, Low, Adaptive)
|
|
20
20
|
if (thinkingLevel === 'High') {
|
|
@@ -300,21 +300,23 @@ Throughout, balance deep technical proficiency with an accessible, friendly, wel
|
|
|
300
300
|
abortSignal.addEventListener("abort", onAbort);
|
|
301
301
|
}
|
|
302
302
|
try {
|
|
303
|
-
const
|
|
303
|
+
const responseStream = await ai.models.generateContentStream({
|
|
304
304
|
model: geminiModel,
|
|
305
|
-
systemInstruction: { role: 'system', parts: [{ text: systemInstruction }] }
|
|
306
|
-
});
|
|
307
|
-
const responseStream = await generativeModel.generateContentStream({
|
|
308
305
|
contents: contents,
|
|
309
|
-
|
|
306
|
+
config: {
|
|
307
|
+
systemInstruction: systemInstruction,
|
|
308
|
+
maxOutputTokens: generationConfig.maxOutputTokens,
|
|
309
|
+
temperature: generationConfig.temperature,
|
|
310
|
+
thinkingConfig: generationConfig.thinkingConfig
|
|
311
|
+
}
|
|
310
312
|
});
|
|
311
313
|
let tempResult = "";
|
|
312
|
-
for await (const chunk of responseStream
|
|
314
|
+
for await (const chunk of responseStream) {
|
|
313
315
|
if (abortSignal?.aborted) {
|
|
314
316
|
reject(new Error("Aborted"));
|
|
315
317
|
return;
|
|
316
318
|
}
|
|
317
|
-
const text = chunk.
|
|
319
|
+
const text = chunk.text || "";
|
|
318
320
|
if (text) {
|
|
319
321
|
tempResult += text;
|
|
320
322
|
if (onChunk)
|