ide-assi 0.194.0 → 0.196.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.
- package/dist/bundle.cjs.js +61 -44
- package/dist/bundle.esm.js +61 -44
- package/dist/components/ideAi.js +22 -5
- package/dist/components/ideUtils.js +3 -2
- package/package.json +1 -1
- package/src/components/ideAi.js +22 -5
- package/src/components/ideUtils.js +3 -2
package/dist/bundle.cjs.js
CHANGED
|
@@ -193345,14 +193345,15 @@ class IdeUtils
|
|
|
193345
193345
|
static getSourcePath = (menuUrl) => {
|
|
193346
193346
|
const path = menuUrl.replace(/^\/+/, '');
|
|
193347
193347
|
|
|
193348
|
-
const packageName = `${this.#parent.config.basePackage}.${path.split("/").slice(0, -1).join(".").toLowerCase()}`;
|
|
193348
|
+
//const packageName = `${this.#parent.config.basePackage}.${path.split("/").slice(0, -1).join(".").toLowerCase()}`;
|
|
193349
|
+
const packageName = `${path.split("/").slice(0, -1).join(".").toLowerCase()}`;
|
|
193349
193350
|
const namespace = path.split("/").slice(0, -1).join(".").toLowerCase();
|
|
193350
193351
|
const fileName = path.split("/").at(-1).toLowerCase().split('-').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join('');
|
|
193351
193352
|
|
|
193352
193353
|
//console.log(this.#parent, this.#parent.config, packageName, namespace, fileName);
|
|
193353
193354
|
|
|
193354
193355
|
return {
|
|
193355
|
-
|
|
193356
|
+
package: packageName,
|
|
193356
193357
|
namespace: namespace,
|
|
193357
193358
|
controller: `${packageName.replaceAll(".", "/")}/controller/${fileName}Controller.java`,
|
|
193358
193359
|
service: `${packageName.replaceAll(".", "/")}/service/${fileName}Service.java`,
|
|
@@ -193410,6 +193411,45 @@ class IdeUtils
|
|
|
193410
193411
|
};
|
|
193411
193412
|
}
|
|
193412
193413
|
|
|
193414
|
+
class IdeFetch {
|
|
193415
|
+
|
|
193416
|
+
static #request = (method, url, data = {}) => {
|
|
193417
|
+
|
|
193418
|
+
//console.log(method, url, data);
|
|
193419
|
+
|
|
193420
|
+
if (method === "GET") url += `?${new URLSearchParams(data)}`;
|
|
193421
|
+
|
|
193422
|
+
const options = {
|
|
193423
|
+
method,
|
|
193424
|
+
headers: { "Content-Type": "application/json" }
|
|
193425
|
+
};
|
|
193426
|
+
|
|
193427
|
+
if (method !== "GET") {
|
|
193428
|
+
options.body = JSON.stringify(data);
|
|
193429
|
+
}
|
|
193430
|
+
|
|
193431
|
+
return fetch(url, options)
|
|
193432
|
+
.then(res => {
|
|
193433
|
+
if (!res.ok) {
|
|
193434
|
+
return res.text().then(text => {
|
|
193435
|
+
throw new Error(`API 오류 (${res.status}): ${text}`);
|
|
193436
|
+
});
|
|
193437
|
+
}
|
|
193438
|
+
return res.json();
|
|
193439
|
+
})
|
|
193440
|
+
.catch(err => {
|
|
193441
|
+
console.error(`[fetch.${method.toLowerCase()}] ${url} 실패:`, err);
|
|
193442
|
+
throw err;
|
|
193443
|
+
});
|
|
193444
|
+
};
|
|
193445
|
+
|
|
193446
|
+
static get = (url, data = {}) => IdeFetch.#request("GET", url, data);
|
|
193447
|
+
|
|
193448
|
+
static post = (url, data = {}) => IdeFetch.#request("POST", url, data);
|
|
193449
|
+
}
|
|
193450
|
+
|
|
193451
|
+
const api = IdeFetch;
|
|
193452
|
+
|
|
193413
193453
|
class IdeAi
|
|
193414
193454
|
{
|
|
193415
193455
|
#API_URL = "http://localhost:8091";
|
|
@@ -193653,6 +193693,11 @@ class IdeAi
|
|
|
193653
193693
|
|
|
193654
193694
|
const src = await this.#invoke(promptFile, params);
|
|
193655
193695
|
|
|
193696
|
+
await api.post(`/api/source/generateTmplFile`, {
|
|
193697
|
+
fileNm: generateFileName,
|
|
193698
|
+
contents: src,
|
|
193699
|
+
});
|
|
193700
|
+
/**
|
|
193656
193701
|
await fetch(`/api/source/generateTmplFile`, {
|
|
193657
193702
|
method: "POST",
|
|
193658
193703
|
headers: { "Content-Type": "application/json" },
|
|
@@ -193661,6 +193706,7 @@ class IdeAi
|
|
|
193661
193706
|
contents: src,
|
|
193662
193707
|
})
|
|
193663
193708
|
});
|
|
193709
|
+
*/
|
|
193664
193710
|
|
|
193665
193711
|
return src;
|
|
193666
193712
|
};
|
|
@@ -193675,23 +193721,33 @@ class IdeAi
|
|
|
193675
193721
|
|
|
193676
193722
|
const where = await this.#where(userPrompt, this.#getMenuInfo(), await this.#getTableList());
|
|
193677
193723
|
this.#parent.addMessage("대상 메뉴와 테이블을 찾았습니다.");
|
|
193724
|
+
|
|
193725
|
+
|
|
193678
193726
|
console.log(where);
|
|
193679
193727
|
|
|
193680
|
-
|
|
193728
|
+
//packageName
|
|
193729
|
+
const srcPath = IdeUtils.getSourcePath(where.menu.url);
|
|
193730
|
+
srcPath.package = this.#parent.config.basePackage + "." + srcPath.package;
|
|
193731
|
+
|
|
193732
|
+
console.log(srcPath);
|
|
193733
|
+
|
|
193734
|
+
|
|
193681
193735
|
|
|
193682
193736
|
const columnInfo = await this.#getColumnInfo(where.table);
|
|
193683
193737
|
|
|
193684
|
-
const namespace = where.package;
|
|
193738
|
+
//const namespace = where.package;
|
|
193685
193739
|
const classPackage = "ide.assi.be." + where.package.split(".").slice(0, -1).join(".");
|
|
193686
193740
|
|
|
193687
193741
|
//const mybatisXmlSource = await this.#generateMyBatis(userPrompt, where.package, columnInfo);
|
|
193688
193742
|
const mybatisXmlSource = await this.#generateTmplFile("/prompts/meta/BuildMyBatisMapper.txt", "mybatis.xml", {
|
|
193689
193743
|
"userPrompt": userPrompt,
|
|
193690
|
-
"namespace": namespace,
|
|
193744
|
+
"namespace": srcPath.namespace,
|
|
193691
193745
|
"tableDefinitions": columnInfo
|
|
193692
193746
|
});
|
|
193693
193747
|
this.#parent.addMessage("MyBatis 소스파일을 생성했습니다.");
|
|
193694
193748
|
|
|
193749
|
+
return "OKKKK";
|
|
193750
|
+
|
|
193695
193751
|
const serviceSrc = await this.#generateTmplFile("/prompts/meta/BuildService.txt", "service.java", {
|
|
193696
193752
|
userPrompt: userPrompt,
|
|
193697
193753
|
menuUrl: where.menu.url,
|
|
@@ -193731,45 +193787,6 @@ class IdeAi
|
|
|
193731
193787
|
}
|
|
193732
193788
|
}
|
|
193733
193789
|
|
|
193734
|
-
class IdeFetch {
|
|
193735
|
-
|
|
193736
|
-
static #request = (method, url, data = {}) => {
|
|
193737
|
-
|
|
193738
|
-
//console.log(method, url, data);
|
|
193739
|
-
|
|
193740
|
-
if (method === "GET") url += `?${new URLSearchParams(data)}`;
|
|
193741
|
-
|
|
193742
|
-
const options = {
|
|
193743
|
-
method,
|
|
193744
|
-
headers: { "Content-Type": "application/json" }
|
|
193745
|
-
};
|
|
193746
|
-
|
|
193747
|
-
if (method !== "GET") {
|
|
193748
|
-
options.body = JSON.stringify(data);
|
|
193749
|
-
}
|
|
193750
|
-
|
|
193751
|
-
return fetch(url, options)
|
|
193752
|
-
.then(res => {
|
|
193753
|
-
if (!res.ok) {
|
|
193754
|
-
return res.text().then(text => {
|
|
193755
|
-
throw new Error(`API 오류 (${res.status}): ${text}`);
|
|
193756
|
-
});
|
|
193757
|
-
}
|
|
193758
|
-
return res.json();
|
|
193759
|
-
})
|
|
193760
|
-
.catch(err => {
|
|
193761
|
-
console.error(`[fetch.${method.toLowerCase()}] ${url} 실패:`, err);
|
|
193762
|
-
throw err;
|
|
193763
|
-
});
|
|
193764
|
-
};
|
|
193765
|
-
|
|
193766
|
-
static get = (url, data = {}) => IdeFetch.#request("GET", url, data);
|
|
193767
|
-
|
|
193768
|
-
static post = (url, data = {}) => IdeFetch.#request("POST", url, data);
|
|
193769
|
-
}
|
|
193770
|
-
|
|
193771
|
-
const api = IdeFetch;
|
|
193772
|
-
|
|
193773
193790
|
class IdeAssi extends HTMLElement
|
|
193774
193791
|
{
|
|
193775
193792
|
#ing = false;
|
package/dist/bundle.esm.js
CHANGED
|
@@ -193341,14 +193341,15 @@ class IdeUtils
|
|
|
193341
193341
|
static getSourcePath = (menuUrl) => {
|
|
193342
193342
|
const path = menuUrl.replace(/^\/+/, '');
|
|
193343
193343
|
|
|
193344
|
-
const packageName = `${this.#parent.config.basePackage}.${path.split("/").slice(0, -1).join(".").toLowerCase()}`;
|
|
193344
|
+
//const packageName = `${this.#parent.config.basePackage}.${path.split("/").slice(0, -1).join(".").toLowerCase()}`;
|
|
193345
|
+
const packageName = `${path.split("/").slice(0, -1).join(".").toLowerCase()}`;
|
|
193345
193346
|
const namespace = path.split("/").slice(0, -1).join(".").toLowerCase();
|
|
193346
193347
|
const fileName = path.split("/").at(-1).toLowerCase().split('-').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join('');
|
|
193347
193348
|
|
|
193348
193349
|
//console.log(this.#parent, this.#parent.config, packageName, namespace, fileName);
|
|
193349
193350
|
|
|
193350
193351
|
return {
|
|
193351
|
-
|
|
193352
|
+
package: packageName,
|
|
193352
193353
|
namespace: namespace,
|
|
193353
193354
|
controller: `${packageName.replaceAll(".", "/")}/controller/${fileName}Controller.java`,
|
|
193354
193355
|
service: `${packageName.replaceAll(".", "/")}/service/${fileName}Service.java`,
|
|
@@ -193406,6 +193407,45 @@ class IdeUtils
|
|
|
193406
193407
|
};
|
|
193407
193408
|
}
|
|
193408
193409
|
|
|
193410
|
+
class IdeFetch {
|
|
193411
|
+
|
|
193412
|
+
static #request = (method, url, data = {}) => {
|
|
193413
|
+
|
|
193414
|
+
//console.log(method, url, data);
|
|
193415
|
+
|
|
193416
|
+
if (method === "GET") url += `?${new URLSearchParams(data)}`;
|
|
193417
|
+
|
|
193418
|
+
const options = {
|
|
193419
|
+
method,
|
|
193420
|
+
headers: { "Content-Type": "application/json" }
|
|
193421
|
+
};
|
|
193422
|
+
|
|
193423
|
+
if (method !== "GET") {
|
|
193424
|
+
options.body = JSON.stringify(data);
|
|
193425
|
+
}
|
|
193426
|
+
|
|
193427
|
+
return fetch(url, options)
|
|
193428
|
+
.then(res => {
|
|
193429
|
+
if (!res.ok) {
|
|
193430
|
+
return res.text().then(text => {
|
|
193431
|
+
throw new Error(`API 오류 (${res.status}): ${text}`);
|
|
193432
|
+
});
|
|
193433
|
+
}
|
|
193434
|
+
return res.json();
|
|
193435
|
+
})
|
|
193436
|
+
.catch(err => {
|
|
193437
|
+
console.error(`[fetch.${method.toLowerCase()}] ${url} 실패:`, err);
|
|
193438
|
+
throw err;
|
|
193439
|
+
});
|
|
193440
|
+
};
|
|
193441
|
+
|
|
193442
|
+
static get = (url, data = {}) => IdeFetch.#request("GET", url, data);
|
|
193443
|
+
|
|
193444
|
+
static post = (url, data = {}) => IdeFetch.#request("POST", url, data);
|
|
193445
|
+
}
|
|
193446
|
+
|
|
193447
|
+
const api = IdeFetch;
|
|
193448
|
+
|
|
193409
193449
|
class IdeAi
|
|
193410
193450
|
{
|
|
193411
193451
|
#API_URL = "http://localhost:8091";
|
|
@@ -193649,6 +193689,11 @@ class IdeAi
|
|
|
193649
193689
|
|
|
193650
193690
|
const src = await this.#invoke(promptFile, params);
|
|
193651
193691
|
|
|
193692
|
+
await api.post(`/api/source/generateTmplFile`, {
|
|
193693
|
+
fileNm: generateFileName,
|
|
193694
|
+
contents: src,
|
|
193695
|
+
});
|
|
193696
|
+
/**
|
|
193652
193697
|
await fetch(`/api/source/generateTmplFile`, {
|
|
193653
193698
|
method: "POST",
|
|
193654
193699
|
headers: { "Content-Type": "application/json" },
|
|
@@ -193657,6 +193702,7 @@ class IdeAi
|
|
|
193657
193702
|
contents: src,
|
|
193658
193703
|
})
|
|
193659
193704
|
});
|
|
193705
|
+
*/
|
|
193660
193706
|
|
|
193661
193707
|
return src;
|
|
193662
193708
|
};
|
|
@@ -193671,23 +193717,33 @@ class IdeAi
|
|
|
193671
193717
|
|
|
193672
193718
|
const where = await this.#where(userPrompt, this.#getMenuInfo(), await this.#getTableList());
|
|
193673
193719
|
this.#parent.addMessage("대상 메뉴와 테이블을 찾았습니다.");
|
|
193720
|
+
|
|
193721
|
+
|
|
193674
193722
|
console.log(where);
|
|
193675
193723
|
|
|
193676
|
-
|
|
193724
|
+
//packageName
|
|
193725
|
+
const srcPath = IdeUtils.getSourcePath(where.menu.url);
|
|
193726
|
+
srcPath.package = this.#parent.config.basePackage + "." + srcPath.package;
|
|
193727
|
+
|
|
193728
|
+
console.log(srcPath);
|
|
193729
|
+
|
|
193730
|
+
|
|
193677
193731
|
|
|
193678
193732
|
const columnInfo = await this.#getColumnInfo(where.table);
|
|
193679
193733
|
|
|
193680
|
-
const namespace = where.package;
|
|
193734
|
+
//const namespace = where.package;
|
|
193681
193735
|
const classPackage = "ide.assi.be." + where.package.split(".").slice(0, -1).join(".");
|
|
193682
193736
|
|
|
193683
193737
|
//const mybatisXmlSource = await this.#generateMyBatis(userPrompt, where.package, columnInfo);
|
|
193684
193738
|
const mybatisXmlSource = await this.#generateTmplFile("/prompts/meta/BuildMyBatisMapper.txt", "mybatis.xml", {
|
|
193685
193739
|
"userPrompt": userPrompt,
|
|
193686
|
-
"namespace": namespace,
|
|
193740
|
+
"namespace": srcPath.namespace,
|
|
193687
193741
|
"tableDefinitions": columnInfo
|
|
193688
193742
|
});
|
|
193689
193743
|
this.#parent.addMessage("MyBatis 소스파일을 생성했습니다.");
|
|
193690
193744
|
|
|
193745
|
+
return "OKKKK";
|
|
193746
|
+
|
|
193691
193747
|
const serviceSrc = await this.#generateTmplFile("/prompts/meta/BuildService.txt", "service.java", {
|
|
193692
193748
|
userPrompt: userPrompt,
|
|
193693
193749
|
menuUrl: where.menu.url,
|
|
@@ -193727,45 +193783,6 @@ class IdeAi
|
|
|
193727
193783
|
}
|
|
193728
193784
|
}
|
|
193729
193785
|
|
|
193730
|
-
class IdeFetch {
|
|
193731
|
-
|
|
193732
|
-
static #request = (method, url, data = {}) => {
|
|
193733
|
-
|
|
193734
|
-
//console.log(method, url, data);
|
|
193735
|
-
|
|
193736
|
-
if (method === "GET") url += `?${new URLSearchParams(data)}`;
|
|
193737
|
-
|
|
193738
|
-
const options = {
|
|
193739
|
-
method,
|
|
193740
|
-
headers: { "Content-Type": "application/json" }
|
|
193741
|
-
};
|
|
193742
|
-
|
|
193743
|
-
if (method !== "GET") {
|
|
193744
|
-
options.body = JSON.stringify(data);
|
|
193745
|
-
}
|
|
193746
|
-
|
|
193747
|
-
return fetch(url, options)
|
|
193748
|
-
.then(res => {
|
|
193749
|
-
if (!res.ok) {
|
|
193750
|
-
return res.text().then(text => {
|
|
193751
|
-
throw new Error(`API 오류 (${res.status}): ${text}`);
|
|
193752
|
-
});
|
|
193753
|
-
}
|
|
193754
|
-
return res.json();
|
|
193755
|
-
})
|
|
193756
|
-
.catch(err => {
|
|
193757
|
-
console.error(`[fetch.${method.toLowerCase()}] ${url} 실패:`, err);
|
|
193758
|
-
throw err;
|
|
193759
|
-
});
|
|
193760
|
-
};
|
|
193761
|
-
|
|
193762
|
-
static get = (url, data = {}) => IdeFetch.#request("GET", url, data);
|
|
193763
|
-
|
|
193764
|
-
static post = (url, data = {}) => IdeFetch.#request("POST", url, data);
|
|
193765
|
-
}
|
|
193766
|
-
|
|
193767
|
-
const api = IdeFetch;
|
|
193768
|
-
|
|
193769
193786
|
class IdeAssi extends HTMLElement
|
|
193770
193787
|
{
|
|
193771
193788
|
#ing = false;
|
package/dist/components/ideAi.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import ninegrid from "ninegrid2";
|
|
2
2
|
import { IdeUtils } from "./ideUtils.js";
|
|
3
|
+
import { api } from "./ideFetch.js";
|
|
3
4
|
import { HumanMessage, SystemMessage } from '@langchain/core/messages';
|
|
4
5
|
import { ChatGoogleGenerativeAI } from "@langchain/google-genai";
|
|
5
6
|
import { Ollama } from "@langchain/ollama";
|
|
6
7
|
import { ChatOpenAI } from '@langchain/openai';
|
|
7
|
-
import {PromptTemplate} from "@langchain/core/prompts";
|
|
8
|
+
import { PromptTemplate } from "@langchain/core/prompts";
|
|
8
9
|
|
|
9
10
|
export class IdeAi
|
|
10
11
|
{
|
|
@@ -263,6 +264,11 @@ export class IdeAi
|
|
|
263
264
|
|
|
264
265
|
const src = await this.#invoke(promptFile, params);
|
|
265
266
|
|
|
267
|
+
await api.post(`/api/source/generateTmplFile`, {
|
|
268
|
+
fileNm: generateFileName,
|
|
269
|
+
contents: src,
|
|
270
|
+
});
|
|
271
|
+
/**
|
|
266
272
|
await fetch(`/api/source/generateTmplFile`, {
|
|
267
273
|
method: "POST",
|
|
268
274
|
headers: { "Content-Type": "application/json" },
|
|
@@ -271,6 +277,7 @@ export class IdeAi
|
|
|
271
277
|
contents: src,
|
|
272
278
|
})
|
|
273
279
|
});
|
|
280
|
+
*/
|
|
274
281
|
|
|
275
282
|
return src;
|
|
276
283
|
};
|
|
@@ -284,24 +291,34 @@ export class IdeAi
|
|
|
284
291
|
this.#parent.addMessage("명령을 이해했습니다.");
|
|
285
292
|
|
|
286
293
|
const where = await this.#where(userPrompt, this.#getMenuInfo(), await this.#getTableList());
|
|
287
|
-
this.#parent.addMessage("대상 메뉴와 테이블을 찾았습니다.")
|
|
294
|
+
this.#parent.addMessage("대상 메뉴와 테이블을 찾았습니다.")
|
|
295
|
+
|
|
296
|
+
|
|
288
297
|
console.log(where);
|
|
289
298
|
|
|
290
|
-
|
|
299
|
+
//packageName
|
|
300
|
+
const srcPath = IdeUtils.getSourcePath(where.menu.url);
|
|
301
|
+
srcPath.package = this.#parent.config.basePackage + "." + srcPath.package;
|
|
302
|
+
|
|
303
|
+
console.log(srcPath);
|
|
304
|
+
|
|
305
|
+
|
|
291
306
|
|
|
292
307
|
const columnInfo = await this.#getColumnInfo(where.table);
|
|
293
308
|
|
|
294
|
-
const namespace = where.package;
|
|
309
|
+
//const namespace = where.package;
|
|
295
310
|
const classPackage = "ide.assi.be." + where.package.split(".").slice(0, -1).join(".");
|
|
296
311
|
|
|
297
312
|
//const mybatisXmlSource = await this.#generateMyBatis(userPrompt, where.package, columnInfo);
|
|
298
313
|
const mybatisXmlSource = await this.#generateTmplFile("/prompts/meta/BuildMyBatisMapper.txt", "mybatis.xml", {
|
|
299
314
|
"userPrompt": userPrompt,
|
|
300
|
-
"namespace": namespace,
|
|
315
|
+
"namespace": srcPath.namespace,
|
|
301
316
|
"tableDefinitions": columnInfo
|
|
302
317
|
});
|
|
303
318
|
this.#parent.addMessage("MyBatis 소스파일을 생성했습니다.");
|
|
304
319
|
|
|
320
|
+
return "OKKKK";
|
|
321
|
+
|
|
305
322
|
const serviceSrc = await this.#generateTmplFile("/prompts/meta/BuildService.txt", "service.java", {
|
|
306
323
|
userPrompt: userPrompt,
|
|
307
324
|
menuUrl: where.menu.url,
|
|
@@ -35,14 +35,15 @@ export class IdeUtils
|
|
|
35
35
|
static getSourcePath = (menuUrl) => {
|
|
36
36
|
const path = menuUrl.replace(/^\/+/, '');
|
|
37
37
|
|
|
38
|
-
const packageName = `${this.#parent.config.basePackage}.${path.split("/").slice(0, -1).join(".").toLowerCase()}`;
|
|
38
|
+
//const packageName = `${this.#parent.config.basePackage}.${path.split("/").slice(0, -1).join(".").toLowerCase()}`;
|
|
39
|
+
const packageName = `${path.split("/").slice(0, -1).join(".").toLowerCase()}`;
|
|
39
40
|
const namespace = path.split("/").slice(0, -1).join(".").toLowerCase();
|
|
40
41
|
const fileName = path.split("/").at(-1).toLowerCase().split('-').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join('');
|
|
41
42
|
|
|
42
43
|
//console.log(this.#parent, this.#parent.config, packageName, namespace, fileName);
|
|
43
44
|
|
|
44
45
|
return {
|
|
45
|
-
|
|
46
|
+
package: packageName,
|
|
46
47
|
namespace: namespace,
|
|
47
48
|
controller: `${packageName.replaceAll(".", "/")}/controller/${fileName}Controller.java`,
|
|
48
49
|
service: `${packageName.replaceAll(".", "/")}/service/${fileName}Service.java`,
|
package/package.json
CHANGED
package/src/components/ideAi.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import ninegrid from "ninegrid2";
|
|
2
2
|
import { IdeUtils } from "./ideUtils.js";
|
|
3
|
+
import { api } from "./ideFetch.js";
|
|
3
4
|
import { HumanMessage, SystemMessage } from '@langchain/core/messages';
|
|
4
5
|
import { ChatGoogleGenerativeAI } from "@langchain/google-genai";
|
|
5
6
|
import { Ollama } from "@langchain/ollama";
|
|
6
7
|
import { ChatOpenAI } from '@langchain/openai';
|
|
7
|
-
import {PromptTemplate} from "@langchain/core/prompts";
|
|
8
|
+
import { PromptTemplate } from "@langchain/core/prompts";
|
|
8
9
|
|
|
9
10
|
export class IdeAi
|
|
10
11
|
{
|
|
@@ -263,6 +264,11 @@ export class IdeAi
|
|
|
263
264
|
|
|
264
265
|
const src = await this.#invoke(promptFile, params);
|
|
265
266
|
|
|
267
|
+
await api.post(`/api/source/generateTmplFile`, {
|
|
268
|
+
fileNm: generateFileName,
|
|
269
|
+
contents: src,
|
|
270
|
+
});
|
|
271
|
+
/**
|
|
266
272
|
await fetch(`/api/source/generateTmplFile`, {
|
|
267
273
|
method: "POST",
|
|
268
274
|
headers: { "Content-Type": "application/json" },
|
|
@@ -271,6 +277,7 @@ export class IdeAi
|
|
|
271
277
|
contents: src,
|
|
272
278
|
})
|
|
273
279
|
});
|
|
280
|
+
*/
|
|
274
281
|
|
|
275
282
|
return src;
|
|
276
283
|
};
|
|
@@ -284,24 +291,34 @@ export class IdeAi
|
|
|
284
291
|
this.#parent.addMessage("명령을 이해했습니다.");
|
|
285
292
|
|
|
286
293
|
const where = await this.#where(userPrompt, this.#getMenuInfo(), await this.#getTableList());
|
|
287
|
-
this.#parent.addMessage("대상 메뉴와 테이블을 찾았습니다.")
|
|
294
|
+
this.#parent.addMessage("대상 메뉴와 테이블을 찾았습니다.")
|
|
295
|
+
|
|
296
|
+
|
|
288
297
|
console.log(where);
|
|
289
298
|
|
|
290
|
-
|
|
299
|
+
//packageName
|
|
300
|
+
const srcPath = IdeUtils.getSourcePath(where.menu.url);
|
|
301
|
+
srcPath.package = this.#parent.config.basePackage + "." + srcPath.package;
|
|
302
|
+
|
|
303
|
+
console.log(srcPath);
|
|
304
|
+
|
|
305
|
+
|
|
291
306
|
|
|
292
307
|
const columnInfo = await this.#getColumnInfo(where.table);
|
|
293
308
|
|
|
294
|
-
const namespace = where.package;
|
|
309
|
+
//const namespace = where.package;
|
|
295
310
|
const classPackage = "ide.assi.be." + where.package.split(".").slice(0, -1).join(".");
|
|
296
311
|
|
|
297
312
|
//const mybatisXmlSource = await this.#generateMyBatis(userPrompt, where.package, columnInfo);
|
|
298
313
|
const mybatisXmlSource = await this.#generateTmplFile("/prompts/meta/BuildMyBatisMapper.txt", "mybatis.xml", {
|
|
299
314
|
"userPrompt": userPrompt,
|
|
300
|
-
"namespace": namespace,
|
|
315
|
+
"namespace": srcPath.namespace,
|
|
301
316
|
"tableDefinitions": columnInfo
|
|
302
317
|
});
|
|
303
318
|
this.#parent.addMessage("MyBatis 소스파일을 생성했습니다.");
|
|
304
319
|
|
|
320
|
+
return "OKKKK";
|
|
321
|
+
|
|
305
322
|
const serviceSrc = await this.#generateTmplFile("/prompts/meta/BuildService.txt", "service.java", {
|
|
306
323
|
userPrompt: userPrompt,
|
|
307
324
|
menuUrl: where.menu.url,
|
|
@@ -35,14 +35,15 @@ export class IdeUtils
|
|
|
35
35
|
static getSourcePath = (menuUrl) => {
|
|
36
36
|
const path = menuUrl.replace(/^\/+/, '');
|
|
37
37
|
|
|
38
|
-
const packageName = `${this.#parent.config.basePackage}.${path.split("/").slice(0, -1).join(".").toLowerCase()}`;
|
|
38
|
+
//const packageName = `${this.#parent.config.basePackage}.${path.split("/").slice(0, -1).join(".").toLowerCase()}`;
|
|
39
|
+
const packageName = `${path.split("/").slice(0, -1).join(".").toLowerCase()}`;
|
|
39
40
|
const namespace = path.split("/").slice(0, -1).join(".").toLowerCase();
|
|
40
41
|
const fileName = path.split("/").at(-1).toLowerCase().split('-').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join('');
|
|
41
42
|
|
|
42
43
|
//console.log(this.#parent, this.#parent.config, packageName, namespace, fileName);
|
|
43
44
|
|
|
44
45
|
return {
|
|
45
|
-
|
|
46
|
+
package: packageName,
|
|
46
47
|
namespace: namespace,
|
|
47
48
|
controller: `${packageName.replaceAll(".", "/")}/controller/${fileName}Controller.java`,
|
|
48
49
|
service: `${packageName.replaceAll(".", "/")}/service/${fileName}Service.java`,
|