ide-assi 0.668.0 → 0.670.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,33 @@ 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
+ if ((r.startsWith("'") && r.endsWith("'")) || (r.startsWith('"') && r.endsWith('"')) || (r.startsWith('`') && r.endsWith('`'))) {
203826
+ r = r.slice(1, -1); // 맨 앞, 맨 뒤 한 글자씩 제거
203827
+ }
203826
203828
 
203827
- if (Object.prototype.toString.call(o) === "[object Object]" && o.hasOwnProperty("result")) {
203828
- if (o.result !== true) throw new Error(o.condition);
203829
+ return r;
203829
203830
  }
203830
- else {
203831
- throw new Error(o);
203831
+ catch (error) {
203832
+ throw error;
203832
203833
  }
203833
-
203834
- return o.condition;
203835
- }
203836
-
203837
-
203838
- };
203839
-
203840
-
203841
- static generateWhereCause = async (xmlPath, queryId, userPrompt, apiKey) => {
203834
+ };
203842
203835
 
203843
203836
  const res = await api.post("/api/source/query", {
203844
203837
  xmlPath: xmlPath,
@@ -203848,7 +203841,7 @@ console.log(el, href, title);
203848
203841
  console.log(res.query);
203849
203842
 
203850
203843
  if (res.query) {
203851
- const o = await this.#invoke('/prompts/user/generateWhereCause.txt', {
203844
+ const o = await invoke('/prompts/user/generateWhereCause.txt', {
203852
203845
  "query": res.query,
203853
203846
  "userPrompt": userPrompt
203854
203847
  });
@@ -237585,12 +237578,9 @@ class aiNatualInput extends HTMLElement
237585
237578
  #queryId;
237586
237579
  #selectFunc;
237587
237580
  #target;
237588
- #ai;
237589
237581
 
237590
237582
  constructor() {
237591
237583
  super();
237592
-
237593
- this.#ai = new IdeAi(this);
237594
237584
  }
237595
237585
 
237596
237586
  connectedCallback() {
@@ -237614,7 +237604,7 @@ class aiNatualInput extends HTMLElement
237614
237604
 
237615
237605
  let params = {};
237616
237606
  if (this.#target.value) {
237617
- 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) };
237618
237608
  }
237619
237609
 
237620
237610
  this.#selectFunc.call(this, params);
@@ -203801,40 +203801,33 @@ 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
+ if ((r.startsWith("'") && r.endsWith("'")) || (r.startsWith('"') && r.endsWith('"')) || (r.startsWith('`') && r.endsWith('`'))) {
203822
+ r = r.slice(1, -1); // 맨 앞, 맨 뒤 한 글자씩 제거
203823
+ }
203822
203824
 
203823
- if (Object.prototype.toString.call(o) === "[object Object]" && o.hasOwnProperty("result")) {
203824
- if (o.result !== true) throw new Error(o.condition);
203825
+ return r;
203825
203826
  }
203826
- else {
203827
- throw new Error(o);
203827
+ catch (error) {
203828
+ throw error;
203828
203829
  }
203829
-
203830
- return o.condition;
203831
- }
203832
-
203833
-
203834
- };
203835
-
203836
-
203837
- static generateWhereCause = async (xmlPath, queryId, userPrompt, apiKey) => {
203830
+ };
203838
203831
 
203839
203832
  const res = await api.post("/api/source/query", {
203840
203833
  xmlPath: xmlPath,
@@ -203844,7 +203837,7 @@ console.log(el, href, title);
203844
203837
  console.log(res.query);
203845
203838
 
203846
203839
  if (res.query) {
203847
- const o = await this.#invoke('/prompts/user/generateWhereCause.txt', {
203840
+ const o = await invoke('/prompts/user/generateWhereCause.txt', {
203848
203841
  "query": res.query,
203849
203842
  "userPrompt": userPrompt
203850
203843
  });
@@ -237581,12 +237574,9 @@ class aiNatualInput extends HTMLElement
237581
237574
  #queryId;
237582
237575
  #selectFunc;
237583
237576
  #target;
237584
- #ai;
237585
237577
 
237586
237578
  constructor() {
237587
237579
  super();
237588
-
237589
- this.#ai = new IdeAi(this);
237590
237580
  }
237591
237581
 
237592
237582
  connectedCallback() {
@@ -237610,7 +237600,7 @@ class aiNatualInput extends HTMLElement
237610
237600
 
237611
237601
  let params = {};
237612
237602
  if (this.#target.value) {
237613
- params = { "_whereClause": await this.#ai.generateWhereCause2(this.#xmlPath, this.#queryId, this.#target.value, this.#apiKey) };
237603
+ params = { "_whereClause": await IdeAi.generateWhereCause(this.#xmlPath, this.#queryId, this.#target.value, this.#apiKey) };
237614
237604
  }
237615
237605
 
237616
237606
  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 {
@@ -1330,7 +1296,7 @@ console.log(el, href, title);
1330
1296
  console.log(res.query);
1331
1297
 
1332
1298
  if (res.query) {
1333
- const o = await this.#invoke('/prompts/user/generateWhereCause.txt', {
1299
+ const o = await invoke('/prompts/user/generateWhereCause.txt', {
1334
1300
  "query": res.query,
1335
1301
  "userPrompt": userPrompt
1336
1302
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ide-assi",
3
3
  "type": "module",
4
- "version": "0.668.0",
4
+ "version": "0.670.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 {
@@ -1330,7 +1296,7 @@ console.log(el, href, title);
1330
1296
  console.log(res.query);
1331
1297
 
1332
1298
  if (res.query) {
1333
- const o = await this.#invoke('/prompts/user/generateWhereCause.txt', {
1299
+ const o = await invoke('/prompts/user/generateWhereCause.txt', {
1334
1300
  "query": res.query,
1335
1301
  "userPrompt": userPrompt
1336
1302
  });