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.
Files changed (2) hide show
  1. package/dist/utils/api.js +11 -9
  2. 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 vertexai_1 = require("@google-cloud/vertexai");
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 vertexai_1.VertexAI({ project: 'draftify-prod', location: 'us-central1' });
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 generativeModel = ai.getGenerativeModel({
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
- generationConfig: generationConfig
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.stream) {
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.candidates?.[0]?.content?.parts?.[0]?.text || "";
319
+ const text = chunk.text || "";
318
320
  if (text) {
319
321
  tempResult += text;
320
322
  if (onChunk)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "draftify-cli",
3
- "version": "1.0.69",
3
+ "version": "1.0.71",
4
4
  "description": "Draftify AI CLI tool",
5
5
  "main": "dist/index.js",
6
6
  "bin": {