ide-assi 0.669.0 → 0.671.0

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.
@@ -203805,40 +203805,37 @@ console.log(el, href, title);
203805
203805
  }
203806
203806
  }
203807
203807
 
203808
- generateWhereCause2 = async (xmlPath, queryId, userPrompt, apiKey) => {
203808
+ static generateWhereCause = async (xmlPath, queryId, userPrompt, apiKey) => {
203809
203809
 
203810
- this.#createModel();
203810
+ const invoke = async (path, params) => {
203811
+ const prompt = await IdeUtils.generatePrompt(path, params);
203812
+ //console.log(prompt);
203811
203813
 
203812
- const res = await api.post("/api/source/query", {
203813
- xmlPath: xmlPath,
203814
- queryId: queryId
203815
- });
203814
+ try {
203815
+ const model = new ChatGoogleGenerativeAI({ model: "gemini-2.5-flash", apiKey: apiKey, temperature: 0,});
203816
203816
 
203817
- console.log(res.query);
203817
+ const response = await model.invoke([
203818
+ //new SystemMessage(systemMessage),
203819
+ new HumanMessage(prompt),
203820
+ ]);
203818
203821
 
203819
- if (res.query) {
203820
- const o = await this.#invoke('/prompts/user/generateWhereCause.txt', {
203821
- "query": res.query,
203822
- "userPrompt": userPrompt
203823
- });
203822
+ console.log(response);
203824
203823
 
203825
- console.log(o);
203824
+ let r = IdeUtils.extractResponse(response, "gemini");
203825
+ console.log(r);
203826
203826
 
203827
- if (Object.prototype.toString.call(o) === "[object Object]" && o.hasOwnProperty("result")) {
203828
- if (o.result !== true) throw new Error(o.condition);
203829
- }
203830
- else {
203831
- throw new Error(o);
203832
- }
203833
-
203834
- return o.condition;
203835
- }
203836
-
203837
-
203838
- };
203827
+ /**
203828
+ if ((r.startsWith("'") && r.endsWith("'")) || (r.startsWith('"') && r.endsWith('"')) || (r.startsWith('`') && r.endsWith('`'))) {
203829
+ r = r.slice(1, -1); // 맨 앞, 맨 뒤 한 글자씩 제거
203830
+ } */
203839
203831
 
203840
203832
 
203841
- static generateWhereCause = async (xmlPath, queryId, userPrompt, apiKey) => {
203833
+ return r;
203834
+ }
203835
+ catch (error) {
203836
+ throw error;
203837
+ }
203838
+ };
203842
203839
 
203843
203840
  const res = await api.post("/api/source/query", {
203844
203841
  xmlPath: xmlPath,
@@ -203848,7 +203845,7 @@ console.log(el, href, title);
203848
203845
  console.log(res.query);
203849
203846
 
203850
203847
  if (res.query) {
203851
- const o = await this.#invoke('/prompts/user/generateWhereCause.txt', {
203848
+ const o = await invoke('/prompts/user/generateWhereCause.txt', {
203852
203849
  "query": res.query,
203853
203850
  "userPrompt": userPrompt
203854
203851
  });
@@ -237585,12 +237582,9 @@ class aiNatualInput extends HTMLElement
237585
237582
  #queryId;
237586
237583
  #selectFunc;
237587
237584
  #target;
237588
- #ai;
237589
237585
 
237590
237586
  constructor() {
237591
237587
  super();
237592
-
237593
- this.#ai = new IdeAi(this);
237594
237588
  }
237595
237589
 
237596
237590
  connectedCallback() {
@@ -237614,7 +237608,7 @@ class aiNatualInput extends HTMLElement
237614
237608
 
237615
237609
  let params = {};
237616
237610
  if (this.#target.value) {
237617
- params = { "_whereClause": await this.#ai.generateWhereCause2(this.#xmlPath, this.#queryId, this.#target.value, this.#apiKey) };
237611
+ params = { "_whereClause": await IdeAi.generateWhereCause(this.#xmlPath, this.#queryId, this.#target.value, this.#apiKey) };
237618
237612
  }
237619
237613
 
237620
237614
  this.#selectFunc.call(this, params);
@@ -203801,40 +203801,37 @@ console.log(el, href, title);
203801
203801
  }
203802
203802
  }
203803
203803
 
203804
- generateWhereCause2 = async (xmlPath, queryId, userPrompt, apiKey) => {
203804
+ static generateWhereCause = async (xmlPath, queryId, userPrompt, apiKey) => {
203805
203805
 
203806
- this.#createModel();
203806
+ const invoke = async (path, params) => {
203807
+ const prompt = await IdeUtils.generatePrompt(path, params);
203808
+ //console.log(prompt);
203807
203809
 
203808
- const res = await api.post("/api/source/query", {
203809
- xmlPath: xmlPath,
203810
- queryId: queryId
203811
- });
203810
+ try {
203811
+ const model = new ChatGoogleGenerativeAI({ model: "gemini-2.5-flash", apiKey: apiKey, temperature: 0,});
203812
203812
 
203813
- console.log(res.query);
203813
+ const response = await model.invoke([
203814
+ //new SystemMessage(systemMessage),
203815
+ new HumanMessage(prompt),
203816
+ ]);
203814
203817
 
203815
- if (res.query) {
203816
- const o = await this.#invoke('/prompts/user/generateWhereCause.txt', {
203817
- "query": res.query,
203818
- "userPrompt": userPrompt
203819
- });
203818
+ console.log(response);
203820
203819
 
203821
- console.log(o);
203820
+ let r = IdeUtils.extractResponse(response, "gemini");
203821
+ console.log(r);
203822
203822
 
203823
- if (Object.prototype.toString.call(o) === "[object Object]" && o.hasOwnProperty("result")) {
203824
- if (o.result !== true) throw new Error(o.condition);
203825
- }
203826
- else {
203827
- throw new Error(o);
203828
- }
203829
-
203830
- return o.condition;
203831
- }
203832
-
203833
-
203834
- };
203823
+ /**
203824
+ if ((r.startsWith("'") && r.endsWith("'")) || (r.startsWith('"') && r.endsWith('"')) || (r.startsWith('`') && r.endsWith('`'))) {
203825
+ r = r.slice(1, -1); // 맨 앞, 맨 뒤 한 글자씩 제거
203826
+ } */
203835
203827
 
203836
203828
 
203837
- static generateWhereCause = async (xmlPath, queryId, userPrompt, apiKey) => {
203829
+ return r;
203830
+ }
203831
+ catch (error) {
203832
+ throw error;
203833
+ }
203834
+ };
203838
203835
 
203839
203836
  const res = await api.post("/api/source/query", {
203840
203837
  xmlPath: xmlPath,
@@ -203844,7 +203841,7 @@ console.log(el, href, title);
203844
203841
  console.log(res.query);
203845
203842
 
203846
203843
  if (res.query) {
203847
- const o = await this.#invoke('/prompts/user/generateWhereCause.txt', {
203844
+ const o = await invoke('/prompts/user/generateWhereCause.txt', {
203848
203845
  "query": res.query,
203849
203846
  "userPrompt": userPrompt
203850
203847
  });
@@ -237581,12 +237578,9 @@ class aiNatualInput extends HTMLElement
237581
237578
  #queryId;
237582
237579
  #selectFunc;
237583
237580
  #target;
237584
- #ai;
237585
237581
 
237586
237582
  constructor() {
237587
237583
  super();
237588
-
237589
- this.#ai = new IdeAi(this);
237590
237584
  }
237591
237585
 
237592
237586
  connectedCallback() {
@@ -237610,7 +237604,7 @@ class aiNatualInput extends HTMLElement
237610
237604
 
237611
237605
  let params = {};
237612
237606
  if (this.#target.value) {
237613
- params = { "_whereClause": await this.#ai.generateWhereCause2(this.#xmlPath, this.#queryId, this.#target.value, this.#apiKey) };
237607
+ params = { "_whereClause": await IdeAi.generateWhereCause(this.#xmlPath, this.#queryId, this.#target.value, this.#apiKey) };
237614
237608
  }
237615
237609
 
237616
237610
  this.#selectFunc.call(this, params);
@@ -8,12 +8,9 @@ class aiNatualInput extends HTMLElement
8
8
  #queryId;
9
9
  #selectFunc;
10
10
  #target;
11
- #ai;
12
11
 
13
12
  constructor() {
14
13
  super();
15
-
16
- this.#ai = new IdeAi(this);
17
14
  }
18
15
 
19
16
  connectedCallback() {
@@ -37,7 +34,7 @@ class aiNatualInput extends HTMLElement
37
34
 
38
35
  let params = {};
39
36
  if (this.#target.value) {
40
- params = { "_whereClause": await this.#ai.generateWhereCause2(this.#xmlPath, this.#queryId, this.#target.value, this.#apiKey) };
37
+ params = { "_whereClause": await IdeAi.generateWhereCause(this.#xmlPath, this.#queryId, this.#target.value, this.#apiKey) };
41
38
  }
42
39
 
43
40
  this.#selectFunc.call(this, params);
@@ -1260,44 +1260,10 @@ console.log(el, href, title);
1260
1260
  }
1261
1261
  }
1262
1262
 
1263
- generateWhereCause2 = async (xmlPath, queryId, userPrompt, apiKey) => {
1264
-
1265
- this.#createModel();
1266
-
1267
- const res = await api.post("/api/source/query", {
1268
- xmlPath: xmlPath,
1269
- queryId: queryId
1270
- });
1271
-
1272
- console.log(res.query);
1273
-
1274
- if (res.query) {
1275
- const o = await this.#invoke('/prompts/user/generateWhereCause.txt', {
1276
- "query": res.query,
1277
- "userPrompt": userPrompt
1278
- });
1279
-
1280
- console.log(o);
1281
-
1282
- if (Object.prototype.toString.call(o) === "[object Object]" && o.hasOwnProperty("result")) {
1283
- if (o.result !== true) throw new Error(o.condition);
1284
- }
1285
- else {
1286
- throw new Error(o);
1287
- }
1288
-
1289
- return o.condition;
1290
- }
1291
-
1292
-
1293
- };
1294
-
1295
-
1296
1263
  static generateWhereCause = async (xmlPath, queryId, userPrompt, apiKey) => {
1297
1264
 
1298
1265
  const invoke = async (path, params) => {
1299
1266
  const prompt = await IdeUtils.generatePrompt(path, params);
1300
-
1301
1267
  //console.log(prompt);
1302
1268
 
1303
1269
  try {
@@ -1311,9 +1277,13 @@ console.log(el, href, title);
1311
1277
  console.log(response);
1312
1278
 
1313
1279
  let r = IdeUtils.extractResponse(response, "gemini");
1280
+ console.log(r);
1281
+
1282
+ /**
1314
1283
  if ((r.startsWith("'") && r.endsWith("'")) || (r.startsWith('"') && r.endsWith('"')) || (r.startsWith('`') && r.endsWith('`'))) {
1315
1284
  r = r.slice(1, -1); // 맨 앞, 맨 뒤 한 글자씩 제거
1316
- }
1285
+ } */
1286
+
1317
1287
 
1318
1288
  return r;
1319
1289
  }
@@ -1330,7 +1300,7 @@ console.log(el, href, title);
1330
1300
  console.log(res.query);
1331
1301
 
1332
1302
  if (res.query) {
1333
- const o = await this.#invoke('/prompts/user/generateWhereCause.txt', {
1303
+ const o = await invoke('/prompts/user/generateWhereCause.txt', {
1334
1304
  "query": res.query,
1335
1305
  "userPrompt": userPrompt
1336
1306
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ide-assi",
3
3
  "type": "module",
4
- "version": "0.669.0",
4
+ "version": "0.671.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
@@ -8,12 +8,9 @@ class aiNatualInput extends HTMLElement
8
8
  #queryId;
9
9
  #selectFunc;
10
10
  #target;
11
- #ai;
12
11
 
13
12
  constructor() {
14
13
  super();
15
-
16
- this.#ai = new IdeAi(this);
17
14
  }
18
15
 
19
16
  connectedCallback() {
@@ -37,7 +34,7 @@ class aiNatualInput extends HTMLElement
37
34
 
38
35
  let params = {};
39
36
  if (this.#target.value) {
40
- params = { "_whereClause": await this.#ai.generateWhereCause2(this.#xmlPath, this.#queryId, this.#target.value, this.#apiKey) };
37
+ params = { "_whereClause": await IdeAi.generateWhereCause(this.#xmlPath, this.#queryId, this.#target.value, this.#apiKey) };
41
38
  }
42
39
 
43
40
  this.#selectFunc.call(this, params);
@@ -1260,44 +1260,10 @@ console.log(el, href, title);
1260
1260
  }
1261
1261
  }
1262
1262
 
1263
- generateWhereCause2 = async (xmlPath, queryId, userPrompt, apiKey) => {
1264
-
1265
- this.#createModel();
1266
-
1267
- const res = await api.post("/api/source/query", {
1268
- xmlPath: xmlPath,
1269
- queryId: queryId
1270
- });
1271
-
1272
- console.log(res.query);
1273
-
1274
- if (res.query) {
1275
- const o = await this.#invoke('/prompts/user/generateWhereCause.txt', {
1276
- "query": res.query,
1277
- "userPrompt": userPrompt
1278
- });
1279
-
1280
- console.log(o);
1281
-
1282
- if (Object.prototype.toString.call(o) === "[object Object]" && o.hasOwnProperty("result")) {
1283
- if (o.result !== true) throw new Error(o.condition);
1284
- }
1285
- else {
1286
- throw new Error(o);
1287
- }
1288
-
1289
- return o.condition;
1290
- }
1291
-
1292
-
1293
- };
1294
-
1295
-
1296
1263
  static generateWhereCause = async (xmlPath, queryId, userPrompt, apiKey) => {
1297
1264
 
1298
1265
  const invoke = async (path, params) => {
1299
1266
  const prompt = await IdeUtils.generatePrompt(path, params);
1300
-
1301
1267
  //console.log(prompt);
1302
1268
 
1303
1269
  try {
@@ -1311,9 +1277,13 @@ console.log(el, href, title);
1311
1277
  console.log(response);
1312
1278
 
1313
1279
  let r = IdeUtils.extractResponse(response, "gemini");
1280
+ console.log(r);
1281
+
1282
+ /**
1314
1283
  if ((r.startsWith("'") && r.endsWith("'")) || (r.startsWith('"') && r.endsWith('"')) || (r.startsWith('`') && r.endsWith('`'))) {
1315
1284
  r = r.slice(1, -1); // 맨 앞, 맨 뒤 한 글자씩 제거
1316
- }
1285
+ } */
1286
+
1317
1287
 
1318
1288
  return r;
1319
1289
  }
@@ -1330,7 +1300,7 @@ console.log(el, href, title);
1330
1300
  console.log(res.query);
1331
1301
 
1332
1302
  if (res.query) {
1333
- const o = await this.#invoke('/prompts/user/generateWhereCause.txt', {
1303
+ const o = await invoke('/prompts/user/generateWhereCause.txt', {
1334
1304
  "query": res.query,
1335
1305
  "userPrompt": userPrompt
1336
1306
  });