ide-assi 0.193.0 → 0.195.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 +85 -64
- package/dist/bundle.esm.js +85 -64
- package/dist/components/ideAi.js +20 -26
- package/dist/components/ideUtils.js +29 -1
- package/package.json +1 -1
- package/src/components/ideAi.js +20 -26
- package/src/components/ideUtils.js +29 -1
package/dist/bundle.cjs.js
CHANGED
|
@@ -193326,7 +193326,7 @@ class IdeUtils
|
|
|
193326
193326
|
result : "1"
|
|
193327
193327
|
table : (3) ['t_doc', 't_doc_file', 't_doc_file_page'
|
|
193328
193328
|
*/
|
|
193329
|
-
|
|
193329
|
+
/**
|
|
193330
193330
|
static toCamelCase = str =>
|
|
193331
193331
|
str
|
|
193332
193332
|
.toLowerCase()
|
|
@@ -193340,7 +193340,35 @@ class IdeUtils
|
|
|
193340
193340
|
//.slice(0, -1)
|
|
193341
193341
|
.map(IdeUtils.toCamelCase)
|
|
193342
193342
|
.join('.');
|
|
193343
|
+
*/
|
|
193344
|
+
|
|
193345
|
+
static getSourcePath = (menuUrl) => {
|
|
193346
|
+
const path = menuUrl.replace(/^\/+/, '');
|
|
193347
|
+
|
|
193348
|
+
const packageName = `${this.#parent.config.basePackage}.${path.split("/").slice(0, -1).join(".").toLowerCase()}`;
|
|
193349
|
+
const namespace = path.split("/").slice(0, -1).join(".").toLowerCase();
|
|
193350
|
+
const fileName = path.split("/").at(-1).toLowerCase().split('-').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join('');
|
|
193343
193351
|
|
|
193352
|
+
//console.log(this.#parent, this.#parent.config, packageName, namespace, fileName);
|
|
193353
|
+
|
|
193354
|
+
return {
|
|
193355
|
+
basePackage: packageName,
|
|
193356
|
+
namespace: namespace,
|
|
193357
|
+
controller: `${packageName.replaceAll(".", "/")}/controller/${fileName}Controller.java`,
|
|
193358
|
+
service: `${packageName.replaceAll(".", "/")}/service/${fileName}Service.java`,
|
|
193359
|
+
mybatis: `${path.split("/").slice(0, -1).join("/").toLowerCase()}/${fileName}Mapper.xml`,
|
|
193360
|
+
javascript: `${path.split("/").slice(0, -1).join("/").toLowerCase()}/${path.split("/").at(-1)}.jsx`,
|
|
193361
|
+
};
|
|
193362
|
+
/***
|
|
193363
|
+
return {
|
|
193364
|
+
basePackage: packageName,
|
|
193365
|
+
namespace: namespace,
|
|
193366
|
+
controller: `/src/main/java/${packageName.replaceAll(".", "/")}/controller/${fileName}Controller.java`,
|
|
193367
|
+
service: `/src/main/java/${packageName.replaceAll(".", "/")}/service/${fileName}Service.java`,
|
|
193368
|
+
mybatis: `/src/main/resource/mapper/${path.split("/").slice(0, -1).join("/").toLowerCase()}/${fileName}Mapper.xml`,
|
|
193369
|
+
javascript: `/${jsroot}/${path.split("/").slice(0, -1).join("/").toLowerCase()}/${path.split("/").at(-1)}.jsx`,
|
|
193370
|
+
};*/
|
|
193371
|
+
};
|
|
193344
193372
|
|
|
193345
193373
|
static generatePrompt = async (path, params) => {
|
|
193346
193374
|
|
|
@@ -193382,6 +193410,45 @@ class IdeUtils
|
|
|
193382
193410
|
};
|
|
193383
193411
|
}
|
|
193384
193412
|
|
|
193413
|
+
class IdeFetch {
|
|
193414
|
+
|
|
193415
|
+
static #request = (method, url, data = {}) => {
|
|
193416
|
+
|
|
193417
|
+
//console.log(method, url, data);
|
|
193418
|
+
|
|
193419
|
+
if (method === "GET") url += `?${new URLSearchParams(data)}`;
|
|
193420
|
+
|
|
193421
|
+
const options = {
|
|
193422
|
+
method,
|
|
193423
|
+
headers: { "Content-Type": "application/json" }
|
|
193424
|
+
};
|
|
193425
|
+
|
|
193426
|
+
if (method !== "GET") {
|
|
193427
|
+
options.body = JSON.stringify(data);
|
|
193428
|
+
}
|
|
193429
|
+
|
|
193430
|
+
return fetch(url, options)
|
|
193431
|
+
.then(res => {
|
|
193432
|
+
if (!res.ok) {
|
|
193433
|
+
return res.text().then(text => {
|
|
193434
|
+
throw new Error(`API 오류 (${res.status}): ${text}`);
|
|
193435
|
+
});
|
|
193436
|
+
}
|
|
193437
|
+
return res.json();
|
|
193438
|
+
})
|
|
193439
|
+
.catch(err => {
|
|
193440
|
+
console.error(`[fetch.${method.toLowerCase()}] ${url} 실패:`, err);
|
|
193441
|
+
throw err;
|
|
193442
|
+
});
|
|
193443
|
+
};
|
|
193444
|
+
|
|
193445
|
+
static get = (url, data = {}) => IdeFetch.#request("GET", url, data);
|
|
193446
|
+
|
|
193447
|
+
static post = (url, data = {}) => IdeFetch.#request("POST", url, data);
|
|
193448
|
+
}
|
|
193449
|
+
|
|
193450
|
+
const api = IdeFetch;
|
|
193451
|
+
|
|
193385
193452
|
class IdeAi
|
|
193386
193453
|
{
|
|
193387
193454
|
#API_URL = "http://localhost:8091";
|
|
@@ -193577,9 +193644,6 @@ class IdeAi
|
|
|
193577
193644
|
throw new Error(o);
|
|
193578
193645
|
}
|
|
193579
193646
|
|
|
193580
|
-
const a = IdeUtils.transformPath("aaa-bbb/ccc-ddd");
|
|
193581
|
-
console.log(a);
|
|
193582
|
-
|
|
193583
193647
|
return o.result;
|
|
193584
193648
|
};
|
|
193585
193649
|
|
|
@@ -193601,24 +193665,6 @@ class IdeAi
|
|
|
193601
193665
|
}
|
|
193602
193666
|
|
|
193603
193667
|
|
|
193604
|
-
//aaaBbb.cccDdd
|
|
193605
|
-
const path = o.menu.url.replace(/^\/+/, '');//IdeUtils.transformPath(o.menu.url);
|
|
193606
|
-
const packageName = `${this.#parent.config.basePackage}.${path.split("/").slice(0, -1).join(".").toLowerCase()}`;
|
|
193607
|
-
const namespace = path.split("/").slice(0, -1).join(".").toLowerCase();
|
|
193608
|
-
const fileName = path.split("/").at(-1).toLowerCase().split('-').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join('');
|
|
193609
|
-
|
|
193610
|
-
console.log(this.#parent, this.#parent.config, packageName, namespace, fileName);
|
|
193611
|
-
|
|
193612
|
-
o.source = {
|
|
193613
|
-
basePackage: packageName,
|
|
193614
|
-
controller: `/src/main/java/${packageName.replaceAll(".", "/")}/controller/${fileName}Controller.java`,
|
|
193615
|
-
service: `/src/main/java/${packageName.replaceAll(".", "/")}/service/${fileName}Service.java`,
|
|
193616
|
-
mybatis: `/src/main/resource/mapper/${path.split("/").slice(0, -1).join("/").toLowerCase()}/${fileName}Mapper.xml`,
|
|
193617
|
-
javascript: `${path.split("/").slice(0, -1).join("/").toLowerCase()}/${path.split("/").at(-1)}.jsx`,
|
|
193618
|
-
};
|
|
193619
|
-
|
|
193620
|
-
console.log(o.source);
|
|
193621
|
-
|
|
193622
193668
|
return o;
|
|
193623
193669
|
};
|
|
193624
193670
|
|
|
@@ -193646,6 +193692,11 @@ class IdeAi
|
|
|
193646
193692
|
|
|
193647
193693
|
const src = await this.#invoke(promptFile, params);
|
|
193648
193694
|
|
|
193695
|
+
await api.post(`/api/source/generateTmplFile`, {
|
|
193696
|
+
fileNm: generateFileName,
|
|
193697
|
+
contents: src,
|
|
193698
|
+
});
|
|
193699
|
+
/**
|
|
193649
193700
|
await fetch(`/api/source/generateTmplFile`, {
|
|
193650
193701
|
method: "POST",
|
|
193651
193702
|
headers: { "Content-Type": "application/json" },
|
|
@@ -193654,6 +193705,7 @@ class IdeAi
|
|
|
193654
193705
|
contents: src,
|
|
193655
193706
|
})
|
|
193656
193707
|
});
|
|
193708
|
+
*/
|
|
193657
193709
|
|
|
193658
193710
|
return src;
|
|
193659
193711
|
};
|
|
@@ -193668,23 +193720,31 @@ class IdeAi
|
|
|
193668
193720
|
|
|
193669
193721
|
const where = await this.#where(userPrompt, this.#getMenuInfo(), await this.#getTableList());
|
|
193670
193722
|
this.#parent.addMessage("대상 메뉴와 테이블을 찾았습니다.");
|
|
193723
|
+
|
|
193724
|
+
|
|
193671
193725
|
console.log(where);
|
|
193672
193726
|
|
|
193673
|
-
|
|
193727
|
+
const srcPath = IdeUtils.getSourcePath(where.menu.url);
|
|
193728
|
+
|
|
193729
|
+
console.log(srcPath);
|
|
193730
|
+
|
|
193731
|
+
|
|
193674
193732
|
|
|
193675
193733
|
const columnInfo = await this.#getColumnInfo(where.table);
|
|
193676
193734
|
|
|
193677
|
-
const namespace = where.package;
|
|
193735
|
+
//const namespace = where.package;
|
|
193678
193736
|
const classPackage = "ide.assi.be." + where.package.split(".").slice(0, -1).join(".");
|
|
193679
193737
|
|
|
193680
193738
|
//const mybatisXmlSource = await this.#generateMyBatis(userPrompt, where.package, columnInfo);
|
|
193681
193739
|
const mybatisXmlSource = await this.#generateTmplFile("/prompts/meta/BuildMyBatisMapper.txt", "mybatis.xml", {
|
|
193682
193740
|
"userPrompt": userPrompt,
|
|
193683
|
-
"namespace": namespace,
|
|
193741
|
+
"namespace": srcPath.namespace,
|
|
193684
193742
|
"tableDefinitions": columnInfo
|
|
193685
193743
|
});
|
|
193686
193744
|
this.#parent.addMessage("MyBatis 소스파일을 생성했습니다.");
|
|
193687
193745
|
|
|
193746
|
+
return "OKKKK";
|
|
193747
|
+
|
|
193688
193748
|
const serviceSrc = await this.#generateTmplFile("/prompts/meta/BuildService.txt", "service.java", {
|
|
193689
193749
|
userPrompt: userPrompt,
|
|
193690
193750
|
menuUrl: where.menu.url,
|
|
@@ -193724,45 +193784,6 @@ class IdeAi
|
|
|
193724
193784
|
}
|
|
193725
193785
|
}
|
|
193726
193786
|
|
|
193727
|
-
class IdeFetch {
|
|
193728
|
-
|
|
193729
|
-
static #request = (method, url, data = {}) => {
|
|
193730
|
-
|
|
193731
|
-
//console.log(method, url, data);
|
|
193732
|
-
|
|
193733
|
-
if (method === "GET") url += `?${new URLSearchParams(data)}`;
|
|
193734
|
-
|
|
193735
|
-
const options = {
|
|
193736
|
-
method,
|
|
193737
|
-
headers: { "Content-Type": "application/json" }
|
|
193738
|
-
};
|
|
193739
|
-
|
|
193740
|
-
if (method !== "GET") {
|
|
193741
|
-
options.body = JSON.stringify(data);
|
|
193742
|
-
}
|
|
193743
|
-
|
|
193744
|
-
return fetch(url, options)
|
|
193745
|
-
.then(res => {
|
|
193746
|
-
if (!res.ok) {
|
|
193747
|
-
return res.text().then(text => {
|
|
193748
|
-
throw new Error(`API 오류 (${res.status}): ${text}`);
|
|
193749
|
-
});
|
|
193750
|
-
}
|
|
193751
|
-
return res.json();
|
|
193752
|
-
})
|
|
193753
|
-
.catch(err => {
|
|
193754
|
-
console.error(`[fetch.${method.toLowerCase()}] ${url} 실패:`, err);
|
|
193755
|
-
throw err;
|
|
193756
|
-
});
|
|
193757
|
-
};
|
|
193758
|
-
|
|
193759
|
-
static get = (url, data = {}) => IdeFetch.#request("GET", url, data);
|
|
193760
|
-
|
|
193761
|
-
static post = (url, data = {}) => IdeFetch.#request("POST", url, data);
|
|
193762
|
-
}
|
|
193763
|
-
|
|
193764
|
-
const api = IdeFetch;
|
|
193765
|
-
|
|
193766
193787
|
class IdeAssi extends HTMLElement
|
|
193767
193788
|
{
|
|
193768
193789
|
#ing = false;
|
package/dist/bundle.esm.js
CHANGED
|
@@ -193322,7 +193322,7 @@ class IdeUtils
|
|
|
193322
193322
|
result : "1"
|
|
193323
193323
|
table : (3) ['t_doc', 't_doc_file', 't_doc_file_page'
|
|
193324
193324
|
*/
|
|
193325
|
-
|
|
193325
|
+
/**
|
|
193326
193326
|
static toCamelCase = str =>
|
|
193327
193327
|
str
|
|
193328
193328
|
.toLowerCase()
|
|
@@ -193336,7 +193336,35 @@ class IdeUtils
|
|
|
193336
193336
|
//.slice(0, -1)
|
|
193337
193337
|
.map(IdeUtils.toCamelCase)
|
|
193338
193338
|
.join('.');
|
|
193339
|
+
*/
|
|
193340
|
+
|
|
193341
|
+
static getSourcePath = (menuUrl) => {
|
|
193342
|
+
const path = menuUrl.replace(/^\/+/, '');
|
|
193343
|
+
|
|
193344
|
+
const packageName = `${this.#parent.config.basePackage}.${path.split("/").slice(0, -1).join(".").toLowerCase()}`;
|
|
193345
|
+
const namespace = path.split("/").slice(0, -1).join(".").toLowerCase();
|
|
193346
|
+
const fileName = path.split("/").at(-1).toLowerCase().split('-').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join('');
|
|
193339
193347
|
|
|
193348
|
+
//console.log(this.#parent, this.#parent.config, packageName, namespace, fileName);
|
|
193349
|
+
|
|
193350
|
+
return {
|
|
193351
|
+
basePackage: packageName,
|
|
193352
|
+
namespace: namespace,
|
|
193353
|
+
controller: `${packageName.replaceAll(".", "/")}/controller/${fileName}Controller.java`,
|
|
193354
|
+
service: `${packageName.replaceAll(".", "/")}/service/${fileName}Service.java`,
|
|
193355
|
+
mybatis: `${path.split("/").slice(0, -1).join("/").toLowerCase()}/${fileName}Mapper.xml`,
|
|
193356
|
+
javascript: `${path.split("/").slice(0, -1).join("/").toLowerCase()}/${path.split("/").at(-1)}.jsx`,
|
|
193357
|
+
};
|
|
193358
|
+
/***
|
|
193359
|
+
return {
|
|
193360
|
+
basePackage: packageName,
|
|
193361
|
+
namespace: namespace,
|
|
193362
|
+
controller: `/src/main/java/${packageName.replaceAll(".", "/")}/controller/${fileName}Controller.java`,
|
|
193363
|
+
service: `/src/main/java/${packageName.replaceAll(".", "/")}/service/${fileName}Service.java`,
|
|
193364
|
+
mybatis: `/src/main/resource/mapper/${path.split("/").slice(0, -1).join("/").toLowerCase()}/${fileName}Mapper.xml`,
|
|
193365
|
+
javascript: `/${jsroot}/${path.split("/").slice(0, -1).join("/").toLowerCase()}/${path.split("/").at(-1)}.jsx`,
|
|
193366
|
+
};*/
|
|
193367
|
+
};
|
|
193340
193368
|
|
|
193341
193369
|
static generatePrompt = async (path, params) => {
|
|
193342
193370
|
|
|
@@ -193378,6 +193406,45 @@ class IdeUtils
|
|
|
193378
193406
|
};
|
|
193379
193407
|
}
|
|
193380
193408
|
|
|
193409
|
+
class IdeFetch {
|
|
193410
|
+
|
|
193411
|
+
static #request = (method, url, data = {}) => {
|
|
193412
|
+
|
|
193413
|
+
//console.log(method, url, data);
|
|
193414
|
+
|
|
193415
|
+
if (method === "GET") url += `?${new URLSearchParams(data)}`;
|
|
193416
|
+
|
|
193417
|
+
const options = {
|
|
193418
|
+
method,
|
|
193419
|
+
headers: { "Content-Type": "application/json" }
|
|
193420
|
+
};
|
|
193421
|
+
|
|
193422
|
+
if (method !== "GET") {
|
|
193423
|
+
options.body = JSON.stringify(data);
|
|
193424
|
+
}
|
|
193425
|
+
|
|
193426
|
+
return fetch(url, options)
|
|
193427
|
+
.then(res => {
|
|
193428
|
+
if (!res.ok) {
|
|
193429
|
+
return res.text().then(text => {
|
|
193430
|
+
throw new Error(`API 오류 (${res.status}): ${text}`);
|
|
193431
|
+
});
|
|
193432
|
+
}
|
|
193433
|
+
return res.json();
|
|
193434
|
+
})
|
|
193435
|
+
.catch(err => {
|
|
193436
|
+
console.error(`[fetch.${method.toLowerCase()}] ${url} 실패:`, err);
|
|
193437
|
+
throw err;
|
|
193438
|
+
});
|
|
193439
|
+
};
|
|
193440
|
+
|
|
193441
|
+
static get = (url, data = {}) => IdeFetch.#request("GET", url, data);
|
|
193442
|
+
|
|
193443
|
+
static post = (url, data = {}) => IdeFetch.#request("POST", url, data);
|
|
193444
|
+
}
|
|
193445
|
+
|
|
193446
|
+
const api = IdeFetch;
|
|
193447
|
+
|
|
193381
193448
|
class IdeAi
|
|
193382
193449
|
{
|
|
193383
193450
|
#API_URL = "http://localhost:8091";
|
|
@@ -193573,9 +193640,6 @@ class IdeAi
|
|
|
193573
193640
|
throw new Error(o);
|
|
193574
193641
|
}
|
|
193575
193642
|
|
|
193576
|
-
const a = IdeUtils.transformPath("aaa-bbb/ccc-ddd");
|
|
193577
|
-
console.log(a);
|
|
193578
|
-
|
|
193579
193643
|
return o.result;
|
|
193580
193644
|
};
|
|
193581
193645
|
|
|
@@ -193597,24 +193661,6 @@ class IdeAi
|
|
|
193597
193661
|
}
|
|
193598
193662
|
|
|
193599
193663
|
|
|
193600
|
-
//aaaBbb.cccDdd
|
|
193601
|
-
const path = o.menu.url.replace(/^\/+/, '');//IdeUtils.transformPath(o.menu.url);
|
|
193602
|
-
const packageName = `${this.#parent.config.basePackage}.${path.split("/").slice(0, -1).join(".").toLowerCase()}`;
|
|
193603
|
-
const namespace = path.split("/").slice(0, -1).join(".").toLowerCase();
|
|
193604
|
-
const fileName = path.split("/").at(-1).toLowerCase().split('-').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join('');
|
|
193605
|
-
|
|
193606
|
-
console.log(this.#parent, this.#parent.config, packageName, namespace, fileName);
|
|
193607
|
-
|
|
193608
|
-
o.source = {
|
|
193609
|
-
basePackage: packageName,
|
|
193610
|
-
controller: `/src/main/java/${packageName.replaceAll(".", "/")}/controller/${fileName}Controller.java`,
|
|
193611
|
-
service: `/src/main/java/${packageName.replaceAll(".", "/")}/service/${fileName}Service.java`,
|
|
193612
|
-
mybatis: `/src/main/resource/mapper/${path.split("/").slice(0, -1).join("/").toLowerCase()}/${fileName}Mapper.xml`,
|
|
193613
|
-
javascript: `${path.split("/").slice(0, -1).join("/").toLowerCase()}/${path.split("/").at(-1)}.jsx`,
|
|
193614
|
-
};
|
|
193615
|
-
|
|
193616
|
-
console.log(o.source);
|
|
193617
|
-
|
|
193618
193664
|
return o;
|
|
193619
193665
|
};
|
|
193620
193666
|
|
|
@@ -193642,6 +193688,11 @@ class IdeAi
|
|
|
193642
193688
|
|
|
193643
193689
|
const src = await this.#invoke(promptFile, params);
|
|
193644
193690
|
|
|
193691
|
+
await api.post(`/api/source/generateTmplFile`, {
|
|
193692
|
+
fileNm: generateFileName,
|
|
193693
|
+
contents: src,
|
|
193694
|
+
});
|
|
193695
|
+
/**
|
|
193645
193696
|
await fetch(`/api/source/generateTmplFile`, {
|
|
193646
193697
|
method: "POST",
|
|
193647
193698
|
headers: { "Content-Type": "application/json" },
|
|
@@ -193650,6 +193701,7 @@ class IdeAi
|
|
|
193650
193701
|
contents: src,
|
|
193651
193702
|
})
|
|
193652
193703
|
});
|
|
193704
|
+
*/
|
|
193653
193705
|
|
|
193654
193706
|
return src;
|
|
193655
193707
|
};
|
|
@@ -193664,23 +193716,31 @@ class IdeAi
|
|
|
193664
193716
|
|
|
193665
193717
|
const where = await this.#where(userPrompt, this.#getMenuInfo(), await this.#getTableList());
|
|
193666
193718
|
this.#parent.addMessage("대상 메뉴와 테이블을 찾았습니다.");
|
|
193719
|
+
|
|
193720
|
+
|
|
193667
193721
|
console.log(where);
|
|
193668
193722
|
|
|
193669
|
-
|
|
193723
|
+
const srcPath = IdeUtils.getSourcePath(where.menu.url);
|
|
193724
|
+
|
|
193725
|
+
console.log(srcPath);
|
|
193726
|
+
|
|
193727
|
+
|
|
193670
193728
|
|
|
193671
193729
|
const columnInfo = await this.#getColumnInfo(where.table);
|
|
193672
193730
|
|
|
193673
|
-
const namespace = where.package;
|
|
193731
|
+
//const namespace = where.package;
|
|
193674
193732
|
const classPackage = "ide.assi.be." + where.package.split(".").slice(0, -1).join(".");
|
|
193675
193733
|
|
|
193676
193734
|
//const mybatisXmlSource = await this.#generateMyBatis(userPrompt, where.package, columnInfo);
|
|
193677
193735
|
const mybatisXmlSource = await this.#generateTmplFile("/prompts/meta/BuildMyBatisMapper.txt", "mybatis.xml", {
|
|
193678
193736
|
"userPrompt": userPrompt,
|
|
193679
|
-
"namespace": namespace,
|
|
193737
|
+
"namespace": srcPath.namespace,
|
|
193680
193738
|
"tableDefinitions": columnInfo
|
|
193681
193739
|
});
|
|
193682
193740
|
this.#parent.addMessage("MyBatis 소스파일을 생성했습니다.");
|
|
193683
193741
|
|
|
193742
|
+
return "OKKKK";
|
|
193743
|
+
|
|
193684
193744
|
const serviceSrc = await this.#generateTmplFile("/prompts/meta/BuildService.txt", "service.java", {
|
|
193685
193745
|
userPrompt: userPrompt,
|
|
193686
193746
|
menuUrl: where.menu.url,
|
|
@@ -193720,45 +193780,6 @@ class IdeAi
|
|
|
193720
193780
|
}
|
|
193721
193781
|
}
|
|
193722
193782
|
|
|
193723
|
-
class IdeFetch {
|
|
193724
|
-
|
|
193725
|
-
static #request = (method, url, data = {}) => {
|
|
193726
|
-
|
|
193727
|
-
//console.log(method, url, data);
|
|
193728
|
-
|
|
193729
|
-
if (method === "GET") url += `?${new URLSearchParams(data)}`;
|
|
193730
|
-
|
|
193731
|
-
const options = {
|
|
193732
|
-
method,
|
|
193733
|
-
headers: { "Content-Type": "application/json" }
|
|
193734
|
-
};
|
|
193735
|
-
|
|
193736
|
-
if (method !== "GET") {
|
|
193737
|
-
options.body = JSON.stringify(data);
|
|
193738
|
-
}
|
|
193739
|
-
|
|
193740
|
-
return fetch(url, options)
|
|
193741
|
-
.then(res => {
|
|
193742
|
-
if (!res.ok) {
|
|
193743
|
-
return res.text().then(text => {
|
|
193744
|
-
throw new Error(`API 오류 (${res.status}): ${text}`);
|
|
193745
|
-
});
|
|
193746
|
-
}
|
|
193747
|
-
return res.json();
|
|
193748
|
-
})
|
|
193749
|
-
.catch(err => {
|
|
193750
|
-
console.error(`[fetch.${method.toLowerCase()}] ${url} 실패:`, err);
|
|
193751
|
-
throw err;
|
|
193752
|
-
});
|
|
193753
|
-
};
|
|
193754
|
-
|
|
193755
|
-
static get = (url, data = {}) => IdeFetch.#request("GET", url, data);
|
|
193756
|
-
|
|
193757
|
-
static post = (url, data = {}) => IdeFetch.#request("POST", url, data);
|
|
193758
|
-
}
|
|
193759
|
-
|
|
193760
|
-
const api = IdeFetch;
|
|
193761
|
-
|
|
193762
193783
|
class IdeAssi extends HTMLElement
|
|
193763
193784
|
{
|
|
193764
193785
|
#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
|
{
|
|
@@ -201,9 +202,6 @@ export class IdeAi
|
|
|
201
202
|
throw new Error(o);
|
|
202
203
|
}
|
|
203
204
|
|
|
204
|
-
const a = IdeUtils.transformPath("aaa-bbb/ccc-ddd");
|
|
205
|
-
console.log(a);
|
|
206
|
-
|
|
207
205
|
return o.result;
|
|
208
206
|
};
|
|
209
207
|
|
|
@@ -225,24 +223,6 @@ export class IdeAi
|
|
|
225
223
|
}
|
|
226
224
|
|
|
227
225
|
|
|
228
|
-
//aaaBbb.cccDdd
|
|
229
|
-
const path = o.menu.url.replace(/^\/+/, '');//IdeUtils.transformPath(o.menu.url);
|
|
230
|
-
const packageName = `${this.#parent.config.basePackage}.${path.split("/").slice(0, -1).join(".").toLowerCase()}`;
|
|
231
|
-
const namespace = path.split("/").slice(0, -1).join(".").toLowerCase();
|
|
232
|
-
const fileName = path.split("/").at(-1).toLowerCase().split('-').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join('');
|
|
233
|
-
|
|
234
|
-
console.log(this.#parent, this.#parent.config, packageName, namespace, fileName);
|
|
235
|
-
|
|
236
|
-
o.source = {
|
|
237
|
-
basePackage: packageName,
|
|
238
|
-
controller: `/src/main/java/${packageName.replaceAll(".", "/")}/controller/${fileName}Controller.java`,
|
|
239
|
-
service: `/src/main/java/${packageName.replaceAll(".", "/")}/service/${fileName}Service.java`,
|
|
240
|
-
mybatis: `/src/main/resource/mapper/${path.split("/").slice(0, -1).join("/").toLowerCase()}/${fileName}Mapper.xml`,
|
|
241
|
-
javascript: `${path.split("/").slice(0, -1).join("/").toLowerCase()}/${path.split("/").at(-1)}.jsx`,
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
console.log(o.source);
|
|
245
|
-
|
|
246
226
|
return o;
|
|
247
227
|
};
|
|
248
228
|
|
|
@@ -284,6 +264,11 @@ export class IdeAi
|
|
|
284
264
|
|
|
285
265
|
const src = await this.#invoke(promptFile, params);
|
|
286
266
|
|
|
267
|
+
await api.post(`/api/source/generateTmplFile`, {
|
|
268
|
+
fileNm: generateFileName,
|
|
269
|
+
contents: src,
|
|
270
|
+
});
|
|
271
|
+
/**
|
|
287
272
|
await fetch(`/api/source/generateTmplFile`, {
|
|
288
273
|
method: "POST",
|
|
289
274
|
headers: { "Content-Type": "application/json" },
|
|
@@ -292,6 +277,7 @@ export class IdeAi
|
|
|
292
277
|
contents: src,
|
|
293
278
|
})
|
|
294
279
|
});
|
|
280
|
+
*/
|
|
295
281
|
|
|
296
282
|
return src;
|
|
297
283
|
};
|
|
@@ -305,24 +291,32 @@ export class IdeAi
|
|
|
305
291
|
this.#parent.addMessage("명령을 이해했습니다.");
|
|
306
292
|
|
|
307
293
|
const where = await this.#where(userPrompt, this.#getMenuInfo(), await this.#getTableList());
|
|
308
|
-
this.#parent.addMessage("대상 메뉴와 테이블을 찾았습니다.")
|
|
294
|
+
this.#parent.addMessage("대상 메뉴와 테이블을 찾았습니다.")
|
|
295
|
+
|
|
296
|
+
|
|
309
297
|
console.log(where);
|
|
310
298
|
|
|
311
|
-
|
|
299
|
+
const srcPath = IdeUtils.getSourcePath(where.menu.url);
|
|
300
|
+
|
|
301
|
+
console.log(srcPath);
|
|
302
|
+
|
|
303
|
+
|
|
312
304
|
|
|
313
305
|
const columnInfo = await this.#getColumnInfo(where.table);
|
|
314
306
|
|
|
315
|
-
const namespace = where.package;
|
|
307
|
+
//const namespace = where.package;
|
|
316
308
|
const classPackage = "ide.assi.be." + where.package.split(".").slice(0, -1).join(".");
|
|
317
309
|
|
|
318
310
|
//const mybatisXmlSource = await this.#generateMyBatis(userPrompt, where.package, columnInfo);
|
|
319
311
|
const mybatisXmlSource = await this.#generateTmplFile("/prompts/meta/BuildMyBatisMapper.txt", "mybatis.xml", {
|
|
320
312
|
"userPrompt": userPrompt,
|
|
321
|
-
"namespace": namespace,
|
|
313
|
+
"namespace": srcPath.namespace,
|
|
322
314
|
"tableDefinitions": columnInfo
|
|
323
315
|
});
|
|
324
316
|
this.#parent.addMessage("MyBatis 소스파일을 생성했습니다.");
|
|
325
317
|
|
|
318
|
+
return "OKKKK";
|
|
319
|
+
|
|
326
320
|
const serviceSrc = await this.#generateTmplFile("/prompts/meta/BuildService.txt", "service.java", {
|
|
327
321
|
userPrompt: userPrompt,
|
|
328
322
|
menuUrl: where.menu.url,
|
|
@@ -16,7 +16,7 @@ export class IdeUtils
|
|
|
16
16
|
result : "1"
|
|
17
17
|
table : (3) ['t_doc', 't_doc_file', 't_doc_file_page'
|
|
18
18
|
*/
|
|
19
|
-
|
|
19
|
+
/**
|
|
20
20
|
static toCamelCase = str =>
|
|
21
21
|
str
|
|
22
22
|
.toLowerCase()
|
|
@@ -30,7 +30,35 @@ export class IdeUtils
|
|
|
30
30
|
//.slice(0, -1)
|
|
31
31
|
.map(IdeUtils.toCamelCase)
|
|
32
32
|
.join('.');
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
static getSourcePath = (menuUrl) => {
|
|
36
|
+
const path = menuUrl.replace(/^\/+/, '');
|
|
37
|
+
|
|
38
|
+
const packageName = `${this.#parent.config.basePackage}.${path.split("/").slice(0, -1).join(".").toLowerCase()}`;
|
|
39
|
+
const namespace = path.split("/").slice(0, -1).join(".").toLowerCase();
|
|
40
|
+
const fileName = path.split("/").at(-1).toLowerCase().split('-').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join('');
|
|
33
41
|
|
|
42
|
+
//console.log(this.#parent, this.#parent.config, packageName, namespace, fileName);
|
|
43
|
+
|
|
44
|
+
return {
|
|
45
|
+
basePackage: packageName,
|
|
46
|
+
namespace: namespace,
|
|
47
|
+
controller: `${packageName.replaceAll(".", "/")}/controller/${fileName}Controller.java`,
|
|
48
|
+
service: `${packageName.replaceAll(".", "/")}/service/${fileName}Service.java`,
|
|
49
|
+
mybatis: `${path.split("/").slice(0, -1).join("/").toLowerCase()}/${fileName}Mapper.xml`,
|
|
50
|
+
javascript: `${path.split("/").slice(0, -1).join("/").toLowerCase()}/${path.split("/").at(-1)}.jsx`,
|
|
51
|
+
};
|
|
52
|
+
/***
|
|
53
|
+
return {
|
|
54
|
+
basePackage: packageName,
|
|
55
|
+
namespace: namespace,
|
|
56
|
+
controller: `/src/main/java/${packageName.replaceAll(".", "/")}/controller/${fileName}Controller.java`,
|
|
57
|
+
service: `/src/main/java/${packageName.replaceAll(".", "/")}/service/${fileName}Service.java`,
|
|
58
|
+
mybatis: `/src/main/resource/mapper/${path.split("/").slice(0, -1).join("/").toLowerCase()}/${fileName}Mapper.xml`,
|
|
59
|
+
javascript: `/${jsroot}/${path.split("/").slice(0, -1).join("/").toLowerCase()}/${path.split("/").at(-1)}.jsx`,
|
|
60
|
+
};*/
|
|
61
|
+
};
|
|
34
62
|
|
|
35
63
|
static generatePrompt = async (path, params) => {
|
|
36
64
|
|
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
|
{
|
|
@@ -201,9 +202,6 @@ export class IdeAi
|
|
|
201
202
|
throw new Error(o);
|
|
202
203
|
}
|
|
203
204
|
|
|
204
|
-
const a = IdeUtils.transformPath("aaa-bbb/ccc-ddd");
|
|
205
|
-
console.log(a);
|
|
206
|
-
|
|
207
205
|
return o.result;
|
|
208
206
|
};
|
|
209
207
|
|
|
@@ -225,24 +223,6 @@ export class IdeAi
|
|
|
225
223
|
}
|
|
226
224
|
|
|
227
225
|
|
|
228
|
-
//aaaBbb.cccDdd
|
|
229
|
-
const path = o.menu.url.replace(/^\/+/, '');//IdeUtils.transformPath(o.menu.url);
|
|
230
|
-
const packageName = `${this.#parent.config.basePackage}.${path.split("/").slice(0, -1).join(".").toLowerCase()}`;
|
|
231
|
-
const namespace = path.split("/").slice(0, -1).join(".").toLowerCase();
|
|
232
|
-
const fileName = path.split("/").at(-1).toLowerCase().split('-').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join('');
|
|
233
|
-
|
|
234
|
-
console.log(this.#parent, this.#parent.config, packageName, namespace, fileName);
|
|
235
|
-
|
|
236
|
-
o.source = {
|
|
237
|
-
basePackage: packageName,
|
|
238
|
-
controller: `/src/main/java/${packageName.replaceAll(".", "/")}/controller/${fileName}Controller.java`,
|
|
239
|
-
service: `/src/main/java/${packageName.replaceAll(".", "/")}/service/${fileName}Service.java`,
|
|
240
|
-
mybatis: `/src/main/resource/mapper/${path.split("/").slice(0, -1).join("/").toLowerCase()}/${fileName}Mapper.xml`,
|
|
241
|
-
javascript: `${path.split("/").slice(0, -1).join("/").toLowerCase()}/${path.split("/").at(-1)}.jsx`,
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
console.log(o.source);
|
|
245
|
-
|
|
246
226
|
return o;
|
|
247
227
|
};
|
|
248
228
|
|
|
@@ -284,6 +264,11 @@ export class IdeAi
|
|
|
284
264
|
|
|
285
265
|
const src = await this.#invoke(promptFile, params);
|
|
286
266
|
|
|
267
|
+
await api.post(`/api/source/generateTmplFile`, {
|
|
268
|
+
fileNm: generateFileName,
|
|
269
|
+
contents: src,
|
|
270
|
+
});
|
|
271
|
+
/**
|
|
287
272
|
await fetch(`/api/source/generateTmplFile`, {
|
|
288
273
|
method: "POST",
|
|
289
274
|
headers: { "Content-Type": "application/json" },
|
|
@@ -292,6 +277,7 @@ export class IdeAi
|
|
|
292
277
|
contents: src,
|
|
293
278
|
})
|
|
294
279
|
});
|
|
280
|
+
*/
|
|
295
281
|
|
|
296
282
|
return src;
|
|
297
283
|
};
|
|
@@ -305,24 +291,32 @@ export class IdeAi
|
|
|
305
291
|
this.#parent.addMessage("명령을 이해했습니다.");
|
|
306
292
|
|
|
307
293
|
const where = await this.#where(userPrompt, this.#getMenuInfo(), await this.#getTableList());
|
|
308
|
-
this.#parent.addMessage("대상 메뉴와 테이블을 찾았습니다.")
|
|
294
|
+
this.#parent.addMessage("대상 메뉴와 테이블을 찾았습니다.")
|
|
295
|
+
|
|
296
|
+
|
|
309
297
|
console.log(where);
|
|
310
298
|
|
|
311
|
-
|
|
299
|
+
const srcPath = IdeUtils.getSourcePath(where.menu.url);
|
|
300
|
+
|
|
301
|
+
console.log(srcPath);
|
|
302
|
+
|
|
303
|
+
|
|
312
304
|
|
|
313
305
|
const columnInfo = await this.#getColumnInfo(where.table);
|
|
314
306
|
|
|
315
|
-
const namespace = where.package;
|
|
307
|
+
//const namespace = where.package;
|
|
316
308
|
const classPackage = "ide.assi.be." + where.package.split(".").slice(0, -1).join(".");
|
|
317
309
|
|
|
318
310
|
//const mybatisXmlSource = await this.#generateMyBatis(userPrompt, where.package, columnInfo);
|
|
319
311
|
const mybatisXmlSource = await this.#generateTmplFile("/prompts/meta/BuildMyBatisMapper.txt", "mybatis.xml", {
|
|
320
312
|
"userPrompt": userPrompt,
|
|
321
|
-
"namespace": namespace,
|
|
313
|
+
"namespace": srcPath.namespace,
|
|
322
314
|
"tableDefinitions": columnInfo
|
|
323
315
|
});
|
|
324
316
|
this.#parent.addMessage("MyBatis 소스파일을 생성했습니다.");
|
|
325
317
|
|
|
318
|
+
return "OKKKK";
|
|
319
|
+
|
|
326
320
|
const serviceSrc = await this.#generateTmplFile("/prompts/meta/BuildService.txt", "service.java", {
|
|
327
321
|
userPrompt: userPrompt,
|
|
328
322
|
menuUrl: where.menu.url,
|
|
@@ -16,7 +16,7 @@ export class IdeUtils
|
|
|
16
16
|
result : "1"
|
|
17
17
|
table : (3) ['t_doc', 't_doc_file', 't_doc_file_page'
|
|
18
18
|
*/
|
|
19
|
-
|
|
19
|
+
/**
|
|
20
20
|
static toCamelCase = str =>
|
|
21
21
|
str
|
|
22
22
|
.toLowerCase()
|
|
@@ -30,7 +30,35 @@ export class IdeUtils
|
|
|
30
30
|
//.slice(0, -1)
|
|
31
31
|
.map(IdeUtils.toCamelCase)
|
|
32
32
|
.join('.');
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
static getSourcePath = (menuUrl) => {
|
|
36
|
+
const path = menuUrl.replace(/^\/+/, '');
|
|
37
|
+
|
|
38
|
+
const packageName = `${this.#parent.config.basePackage}.${path.split("/").slice(0, -1).join(".").toLowerCase()}`;
|
|
39
|
+
const namespace = path.split("/").slice(0, -1).join(".").toLowerCase();
|
|
40
|
+
const fileName = path.split("/").at(-1).toLowerCase().split('-').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join('');
|
|
33
41
|
|
|
42
|
+
//console.log(this.#parent, this.#parent.config, packageName, namespace, fileName);
|
|
43
|
+
|
|
44
|
+
return {
|
|
45
|
+
basePackage: packageName,
|
|
46
|
+
namespace: namespace,
|
|
47
|
+
controller: `${packageName.replaceAll(".", "/")}/controller/${fileName}Controller.java`,
|
|
48
|
+
service: `${packageName.replaceAll(".", "/")}/service/${fileName}Service.java`,
|
|
49
|
+
mybatis: `${path.split("/").slice(0, -1).join("/").toLowerCase()}/${fileName}Mapper.xml`,
|
|
50
|
+
javascript: `${path.split("/").slice(0, -1).join("/").toLowerCase()}/${path.split("/").at(-1)}.jsx`,
|
|
51
|
+
};
|
|
52
|
+
/***
|
|
53
|
+
return {
|
|
54
|
+
basePackage: packageName,
|
|
55
|
+
namespace: namespace,
|
|
56
|
+
controller: `/src/main/java/${packageName.replaceAll(".", "/")}/controller/${fileName}Controller.java`,
|
|
57
|
+
service: `/src/main/java/${packageName.replaceAll(".", "/")}/service/${fileName}Service.java`,
|
|
58
|
+
mybatis: `/src/main/resource/mapper/${path.split("/").slice(0, -1).join("/").toLowerCase()}/${fileName}Mapper.xml`,
|
|
59
|
+
javascript: `/${jsroot}/${path.split("/").slice(0, -1).join("/").toLowerCase()}/${path.split("/").at(-1)}.jsx`,
|
|
60
|
+
};*/
|
|
61
|
+
};
|
|
34
62
|
|
|
35
63
|
static generatePrompt = async (path, params) => {
|
|
36
64
|
|