ide-assi 0.709.0 → 0.710.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 -509
- package/dist/bundle.esm.js +61 -509
- package/dist/components/ideAi.js +61 -511
- package/dist/components/ideAi.js.bak +1384 -0
- package/package.json +1 -1
- package/src/components/ideAi.js +61 -511
- package/src/components/ideAi.js.bak +1384 -0
package/dist/bundle.cjs.js
CHANGED
|
@@ -202614,104 +202614,6 @@ class IdeAi
|
|
|
202614
202614
|
return await response.json();
|
|
202615
202615
|
};
|
|
202616
202616
|
|
|
202617
|
-
#toJavaPackage = (path) => {
|
|
202618
|
-
// 확장자 및 파일 제거: 마지막 / 이후는 제거
|
|
202619
|
-
const withoutFile = path.substring(0, path.lastIndexOf('/'));
|
|
202620
|
-
|
|
202621
|
-
// 슬래시(/) → 점(.) 변환
|
|
202622
|
-
return withoutFile.replace(/\//g, '.');
|
|
202623
|
-
}
|
|
202624
|
-
|
|
202625
|
-
/**
|
|
202626
|
-
* 1. 소스 명칭 package 예) tmpl.population
|
|
202627
|
-
* 2. 소스가 없으면 소스 생성
|
|
202628
|
-
* 3.
|
|
202629
|
-
*
|
|
202630
|
-
* 1. 메뉴정보, 테이블정보로 해당 패키지, URL, 소스명칭을 유추
|
|
202631
|
-
*/
|
|
202632
|
-
generateSource = async (userPrompt) => {
|
|
202633
|
-
|
|
202634
|
-
const menus = this.#getMenuInfo();
|
|
202635
|
-
const tables = await this.#getTableList();
|
|
202636
|
-
|
|
202637
|
-
console.log(menus);
|
|
202638
|
-
console.log(tables);
|
|
202639
|
-
|
|
202640
|
-
const response = await fetch(`${this.#API_URL}/ai/inferSourceMeta`, {
|
|
202641
|
-
method: "POST",
|
|
202642
|
-
headers: { "Content-Type": "application/json" },
|
|
202643
|
-
body: JSON.stringify({
|
|
202644
|
-
userPrompt: userPrompt,
|
|
202645
|
-
menus: menus,
|
|
202646
|
-
tables: tables.list,
|
|
202647
|
-
})
|
|
202648
|
-
});
|
|
202649
|
-
|
|
202650
|
-
const res = await response.json();
|
|
202651
|
-
//console.log(res);
|
|
202652
|
-
|
|
202653
|
-
if (res.result == "1") {
|
|
202654
|
-
|
|
202655
|
-
const columnInfo = await this.#getColumnInfo(res.table);
|
|
202656
|
-
console.log(columnInfo);
|
|
202657
|
-
|
|
202658
|
-
const response2 = await fetch(`${this.#API_URL}/ai/generateSource`, {
|
|
202659
|
-
method: "POST",
|
|
202660
|
-
headers: { "Content-Type": "application/json" },
|
|
202661
|
-
body: JSON.stringify({
|
|
202662
|
-
packageName: "ide.assi.be." + this.#toJavaPackage(res.service).replace(".service", ""),
|
|
202663
|
-
userPrompt: userPrompt,
|
|
202664
|
-
url: res.menu.url,
|
|
202665
|
-
tables: columnInfo.list,
|
|
202666
|
-
})
|
|
202667
|
-
});
|
|
202668
|
-
|
|
202669
|
-
const source = await response2.json();
|
|
202670
|
-
|
|
202671
|
-
await fetch(`/api/source/generateMybatisFile`, {
|
|
202672
|
-
method: "POST",
|
|
202673
|
-
headers: { "Content-Type": "application/json" },
|
|
202674
|
-
body: JSON.stringify({
|
|
202675
|
-
fileNm: res.xml,
|
|
202676
|
-
contents: source.mybatis,
|
|
202677
|
-
})
|
|
202678
|
-
});
|
|
202679
|
-
//console.log(response3);
|
|
202680
|
-
//console.log(await response3.json());
|
|
202681
|
-
|
|
202682
|
-
const response4 = await fetch(`/api/source/generateJavaFile`, {
|
|
202683
|
-
method: "POST",
|
|
202684
|
-
headers: { "Content-Type": "application/json" },
|
|
202685
|
-
body: JSON.stringify({
|
|
202686
|
-
fileNm: res.service,
|
|
202687
|
-
contents: source.service,
|
|
202688
|
-
})
|
|
202689
|
-
});
|
|
202690
|
-
|
|
202691
|
-
await fetch(`/api/source/generateJavaFile`, {
|
|
202692
|
-
method: "POST",
|
|
202693
|
-
headers: { "Content-Type": "application/json" },
|
|
202694
|
-
body: JSON.stringify({
|
|
202695
|
-
fileNm: res.controller,
|
|
202696
|
-
contents: source.controller,
|
|
202697
|
-
})
|
|
202698
|
-
});
|
|
202699
|
-
|
|
202700
|
-
await fetch(`/api/source/generateJsFile`, {
|
|
202701
|
-
method: "POST",
|
|
202702
|
-
headers: { "Content-Type": "application/json" },
|
|
202703
|
-
body: JSON.stringify({
|
|
202704
|
-
fileNm: res.js + "x",
|
|
202705
|
-
contents: source.js,
|
|
202706
|
-
})
|
|
202707
|
-
});
|
|
202708
|
-
|
|
202709
|
-
return await response4.json();
|
|
202710
|
-
}
|
|
202711
|
-
|
|
202712
|
-
return null;
|
|
202713
|
-
};
|
|
202714
|
-
|
|
202715
202617
|
#invoke = async (path, params) => {
|
|
202716
202618
|
|
|
202717
202619
|
const prompt = await IdeUtils.generatePrompt(path, params);
|
|
@@ -202773,31 +202675,6 @@ class IdeAi
|
|
|
202773
202675
|
return o;
|
|
202774
202676
|
};
|
|
202775
202677
|
|
|
202776
|
-
#generateRealFile = async (srcPath, apply) => {
|
|
202777
|
-
const fileMap = {
|
|
202778
|
-
mybatis: { name: "mybatis.xml", path: srcPath.mybatisPullPath },
|
|
202779
|
-
service: { name: "service.java", path: srcPath.servicePullPath },
|
|
202780
|
-
controller: { name: "controller.java", path: srcPath.controllerPullPath },
|
|
202781
|
-
javascript: { name: "react.jsx", path: srcPath.javascriptPullPath },
|
|
202782
|
-
};
|
|
202783
|
-
|
|
202784
|
-
const selectedFiles = Object.entries(fileMap)
|
|
202785
|
-
.filter(([key]) => apply[key])
|
|
202786
|
-
.map(([_, { name, path }]) => ({ name, path }));
|
|
202787
|
-
|
|
202788
|
-
const params = await Promise.all(
|
|
202789
|
-
selectedFiles.map(async ({ name, path }) => ({
|
|
202790
|
-
path,
|
|
202791
|
-
contents: await fetch(`/api/templates/${name}`).then(res => res.text()),
|
|
202792
|
-
}))
|
|
202793
|
-
);
|
|
202794
|
-
|
|
202795
|
-
console.log(params);
|
|
202796
|
-
|
|
202797
|
-
api.post(`/api/source/generateRealFile`, { list: params });
|
|
202798
|
-
};
|
|
202799
|
-
|
|
202800
|
-
|
|
202801
202678
|
#generateTmplFile = async (promptFile, generateFileName, params) => {
|
|
202802
202679
|
|
|
202803
202680
|
let src = await this.#invoke(promptFile, params);
|
|
@@ -202899,191 +202776,8 @@ class IdeAi
|
|
|
202899
202776
|
};
|
|
202900
202777
|
|
|
202901
202778
|
|
|
202902
|
-
#modifySource = async (userPrompt, apply, progressMessageInstance) => {
|
|
202903
|
-
|
|
202904
|
-
const el = ninegrid.querySelector("nx-side-menu-item.active");
|
|
202905
|
-
if (!el) throw new Error("관련 메뉴를 찾을 수 없습니다.");
|
|
202906
|
-
|
|
202907
|
-
const href = el.getAttribute("href");
|
|
202908
|
-
const title = el.getAttribute("title");
|
|
202909
|
-
|
|
202910
|
-
console.log(el, href, title);
|
|
202911
|
-
|
|
202912
|
-
const srcPath = this.#getSourcePath(href);
|
|
202913
|
-
console.log(srcPath);
|
|
202914
|
-
|
|
202915
|
-
|
|
202916
|
-
/**
|
|
202917
|
-
* {
|
|
202918
|
-
* "package": "ide.assi.be.tmpla",
|
|
202919
|
-
* "namespace": "ide.assi.be.tmpla.docmanager",
|
|
202920
|
-
* "baseClass": "DocManager",
|
|
202921
|
-
* "resultType": "ide.assi.core.utils.CamelCaseMap",
|
|
202922
|
-
* "mybatis": "tmpla/DocManagerMapper.xml",
|
|
202923
|
-
* "mybatisPullPath": "ide-assi-be/src/main/resources/mapper/tmpla/DocManagerMapper.xml",
|
|
202924
|
-
* "controllerPullPath": "ide-assi-be/src/main/java/ide/assi/be/tmpla/controller/DocManagerController.java",
|
|
202925
|
-
* "servicePullPath": "ide-assi-be/src/main/java/ide/assi/be/tmpla/service/DocManagerService.java",
|
|
202926
|
-
* "javascriptPullPath": "ide-assi-fe-vite-react-js/src/views/tmpla/doc-manager.jsx"
|
|
202927
|
-
* }
|
|
202928
|
-
*/
|
|
202929
|
-
const src = await api.post("/api/source/read", srcPath);
|
|
202930
|
-
//console.log(src);
|
|
202931
|
-
|
|
202932
|
-
/**
|
|
202933
|
-
const response = await fetch(srcPath.javascript);
|
|
202934
|
-
src.javascript = await response.text();*/
|
|
202935
|
-
|
|
202936
|
-
//console.log(src);
|
|
202937
|
-
//const template = await fetch(path).then(res => res.text());
|
|
202938
|
-
/*
|
|
202939
|
-
arr.push({
|
|
202940
|
-
//menuId: elem.getAttribute("menu-id"),
|
|
202941
|
-
url: elem.getAttribute("href"),
|
|
202942
|
-
title: elem.getAttribute("title"),
|
|
202943
|
-
})*/
|
|
202944
|
-
|
|
202945
|
-
|
|
202946
|
-
|
|
202947
|
-
|
|
202948
|
-
|
|
202949
|
-
const where = await this.#where(`${title}에서 ${userPrompt}`, [{url: href, title: title}], await this.#getTableList());
|
|
202950
|
-
//this.#parent.addMessage("대상 메뉴와 테이블을 찾았습니다.");
|
|
202951
|
-
progressMessageInstance.updateProgress('prepare2', 'completed');
|
|
202952
|
-
|
|
202953
|
-
console.log(where);
|
|
202954
|
-
|
|
202955
|
-
//const srcPath = this.#getSourcePath(where.menu.url);
|
|
202956
|
-
|
|
202957
|
-
console.log(srcPath);
|
|
202958
|
-
|
|
202959
|
-
const columnInfo = await this.#getColumnInfo(where.table);
|
|
202960
|
-
|
|
202961
|
-
let mybatisXmlSource;
|
|
202962
|
-
if (apply.mybatis) {
|
|
202963
|
-
mybatisXmlSource = await this.#generateTmplFile("/prompts/meta/U.BuildMyBatisMapper.txt", "mybatis.xml", {
|
|
202964
|
-
userPrompt: userPrompt,
|
|
202965
|
-
originSrc: src.mybatis,
|
|
202966
|
-
resultType: srcPath.resultType,
|
|
202967
|
-
namespace: srcPath.namespace,
|
|
202968
|
-
tableDefinitions: JSON.stringify(columnInfo),
|
|
202969
|
-
});
|
|
202970
|
-
//this.#parent.addMessage("MyBatis 소스파일을 생성했습니다.");
|
|
202971
|
-
progressMessageInstance.updateProgress('mybatis', 'completed');
|
|
202972
|
-
}
|
|
202973
|
-
else {
|
|
202974
|
-
mybatisXmlSource = src.mybatis;
|
|
202975
|
-
}
|
|
202976
|
-
|
|
202977
|
-
let serviceSrc;
|
|
202978
|
-
if (apply.service) {
|
|
202979
|
-
serviceSrc = await this.#generateTmplFile("/prompts/meta/U.BuildService.txt", "service.java", {
|
|
202980
|
-
userPrompt: userPrompt,
|
|
202981
|
-
originSrc: src.service,
|
|
202982
|
-
baseClass: srcPath.baseClass,
|
|
202983
|
-
myBatisPath: srcPath.mybatis,
|
|
202984
|
-
namespace: srcPath.namespace,
|
|
202985
|
-
package: srcPath.package + ".service",
|
|
202986
|
-
mybatisXmlSource: mybatisXmlSource,
|
|
202987
|
-
});
|
|
202988
|
-
//this.#parent.addMessage("Java(Service) 소스파일을 생성했습니다.");
|
|
202989
|
-
progressMessageInstance.updateProgress('service', 'completed');
|
|
202990
|
-
}
|
|
202991
|
-
else {
|
|
202992
|
-
serviceSrc = src.service;
|
|
202993
|
-
}
|
|
202994
|
-
|
|
202995
|
-
let controllerSrc;
|
|
202996
|
-
if (apply.controller) {
|
|
202997
|
-
controllerSrc = await this.#generateTmplFile("/prompts/meta/U.BuildController.txt", "controller.java", {
|
|
202998
|
-
userPrompt: userPrompt,
|
|
202999
|
-
originSrc: src.controller,
|
|
203000
|
-
baseClass: srcPath.baseClass,
|
|
203001
|
-
menuUrl: where.menu.url,
|
|
203002
|
-
package: srcPath.package + ".controller",
|
|
203003
|
-
serviceSource: serviceSrc,
|
|
203004
|
-
});
|
|
203005
|
-
//this.#parent.addMessage("Java(Controller) 소스파일을 생성했습니다.");
|
|
203006
|
-
progressMessageInstance.updateProgress('controller', 'completed');
|
|
203007
|
-
}
|
|
203008
|
-
else {
|
|
203009
|
-
controllerSrc = src.controller;
|
|
203010
|
-
}
|
|
203011
|
-
|
|
203012
|
-
let jsSrc;
|
|
203013
|
-
if (apply.javascript) {
|
|
203014
|
-
jsSrc = await this.#generateTmplFile("/prompts/meta/U.BuildReactJsx.txt", "react.jsx", {
|
|
203015
|
-
userPrompt: userPrompt,
|
|
203016
|
-
mybatis: srcPath.mybatis,
|
|
203017
|
-
originSrc: src.javascript,
|
|
203018
|
-
menuUrl: where.menu.url,
|
|
203019
|
-
menuName: where.menu.name,
|
|
203020
|
-
baseClass: srcPath.baseClass,
|
|
203021
|
-
mybatisXmlSource: mybatisXmlSource,
|
|
203022
|
-
controllerSource: controllerSrc,
|
|
203023
|
-
tableDefinitions: JSON.stringify(columnInfo),
|
|
203024
|
-
});
|
|
203025
|
-
//this.#parent.addMessage("Jsx(React) 소스파일을 생성했습니다.");
|
|
203026
|
-
progressMessageInstance.updateProgress('javascript', 'completed');
|
|
203027
|
-
}
|
|
203028
|
-
else {
|
|
203029
|
-
jsSrc = src.javascript;
|
|
203030
|
-
}
|
|
203031
|
-
|
|
203032
|
-
//await this.#generateRealFile(srcPath, apply);
|
|
203033
|
-
|
|
203034
|
-
const returnSrc = [];
|
|
203035
|
-
|
|
203036
|
-
const mapping = {
|
|
203037
|
-
mybatis: {
|
|
203038
|
-
path: srcPath.mybatisPullPath,
|
|
203039
|
-
src: mybatisXmlSource,
|
|
203040
|
-
},
|
|
203041
|
-
service: {
|
|
203042
|
-
path: srcPath.servicePullPath,
|
|
203043
|
-
src: serviceSrc,
|
|
203044
|
-
},
|
|
203045
|
-
controller: {
|
|
203046
|
-
path: srcPath.controllerPullPath,
|
|
203047
|
-
src: controllerSrc,
|
|
203048
|
-
},
|
|
203049
|
-
javascript: {
|
|
203050
|
-
path: srcPath.javascriptPullPath,
|
|
203051
|
-
src: jsSrc,
|
|
203052
|
-
}
|
|
203053
|
-
};
|
|
203054
|
-
|
|
203055
|
-
for (const key in apply) {
|
|
203056
|
-
if (apply[key]) {
|
|
203057
|
-
returnSrc.push({
|
|
203058
|
-
[key]: {
|
|
203059
|
-
asis: src[key],
|
|
203060
|
-
tobe: mapping[key].src,
|
|
203061
|
-
tobePath: mapping[key].path,
|
|
203062
|
-
}
|
|
203063
|
-
});
|
|
203064
|
-
}
|
|
203065
|
-
}
|
|
203066
|
-
|
|
203067
|
-
console.log(returnSrc);
|
|
203068
|
-
|
|
203069
|
-
return returnSrc;
|
|
203070
|
-
};
|
|
203071
|
-
|
|
203072
202779
|
#generateSource = async (what, userPrompt, apply, progressMessageInstance) => {
|
|
203073
202780
|
|
|
203074
|
-
/**
|
|
203075
|
-
const el = ninegrid.querySelector("nx-side-menu-item.active");
|
|
203076
|
-
if (!el) throw new Error("관련 메뉴를 찾을 수 없습니다.");
|
|
203077
|
-
|
|
203078
|
-
const href = el.getAttribute("href");
|
|
203079
|
-
const title = el.getAttribute("title");
|
|
203080
|
-
|
|
203081
|
-
console.log(el, href, title);
|
|
203082
|
-
|
|
203083
|
-
const srcPath = this.#getSourcePath(href);
|
|
203084
|
-
console.log(srcPath);
|
|
203085
|
-
*/
|
|
203086
|
-
|
|
203087
202781
|
let where;
|
|
203088
202782
|
let href;
|
|
203089
202783
|
|
|
@@ -203091,7 +202785,7 @@ console.log(el, href, title);
|
|
|
203091
202785
|
where = await this.#where(userPrompt, this.#getMenuInfo(), await this.#getTableList());
|
|
203092
202786
|
href = where.menu.url;
|
|
203093
202787
|
}
|
|
203094
|
-
else if (
|
|
202788
|
+
else if (["U1","U2","C2"].includes(what)) {
|
|
203095
202789
|
const el = ninegrid.querySelector("nx-side-menu-item.active");
|
|
203096
202790
|
if (!el) throw new Error("관련 메뉴를 찾을 수 없습니다.");
|
|
203097
202791
|
|
|
@@ -203163,18 +202857,60 @@ console.log(el, href, title);
|
|
|
203163
202857
|
}
|
|
203164
202858
|
|
|
203165
202859
|
if (apply.javascript) {
|
|
203166
|
-
|
|
203167
|
-
|
|
203168
|
-
|
|
203169
|
-
|
|
203170
|
-
|
|
203171
|
-
|
|
203172
|
-
|
|
203173
|
-
|
|
203174
|
-
|
|
203175
|
-
|
|
203176
|
-
|
|
203177
|
-
|
|
202860
|
+
|
|
202861
|
+
const mainfiles = this.prompt.react.filter(item => item.includes(".main.") || item.includes(".all."));
|
|
202862
|
+
const subfiles = this.prompt.react.filter(item => item.includes(".sub.") || item.includes(".all."));
|
|
202863
|
+
|
|
202864
|
+
if (["C1","U1"].includes(what)) {
|
|
202865
|
+
generatedSource.javascriptFrom = await this.#generateTmplFile(mainfiles, "reactFrom.jsx", {
|
|
202866
|
+
userPrompt: userPrompt,
|
|
202867
|
+
mybatis: srcPath.mybatis,
|
|
202868
|
+
originSrc: src.javascriptFrom,
|
|
202869
|
+
menuUrl: where.menu.url,
|
|
202870
|
+
menuName: where.menu.name,
|
|
202871
|
+
baseClass: srcPath.baseClass,
|
|
202872
|
+
mybatisXmlSource: generatedSource.mybatis,
|
|
202873
|
+
controllerSource: generatedSource.controller,
|
|
202874
|
+
tableDefinitions: JSON.stringify(columnInfo),
|
|
202875
|
+
});
|
|
202876
|
+
}
|
|
202877
|
+
else { // "C2", "U2"
|
|
202878
|
+
const pathArray = srcPath.javascriptTo.split("/");
|
|
202879
|
+
const javascriptFileTo = pathArray.pop();
|
|
202880
|
+
|
|
202881
|
+
generatedSource.javascriptFrom = await this.#generateTmplFile(mainfiles, "reactFrom.jsx", {
|
|
202882
|
+
userPrompt: userPrompt,
|
|
202883
|
+
mybatis: srcPath.mybatis,
|
|
202884
|
+
originSrc: src.javascriptFrom,
|
|
202885
|
+
menuUrl: where.menu.url,
|
|
202886
|
+
menuName: where.menu.name,
|
|
202887
|
+
baseClass: srcPath.baseClass,
|
|
202888
|
+
classFrom: srcPath.classFrom, // 화면연결시 필요
|
|
202889
|
+
classTo: srcPath.classTo, // 화면연결시 필요
|
|
202890
|
+
emptyIndex: srcPath.emptyIndex, // 화면연결시 필요
|
|
202891
|
+
activeIndex: srcPath.activeIndex, // 화면연결시 필요
|
|
202892
|
+
javascriptFileTo: javascriptFileTo, // 화면연결시 필요
|
|
202893
|
+
mybatisXmlSource: generatedSource.mybatis,
|
|
202894
|
+
controllerSource: generatedSource.controller,
|
|
202895
|
+
tableDefinitions: JSON.stringify(columnInfo),
|
|
202896
|
+
});
|
|
202897
|
+
|
|
202898
|
+
generatedSource.javascriptTo = await this.#generateTmplFile(subfiles, "reactTo.jsx", {
|
|
202899
|
+
userPrompt: userPrompt,
|
|
202900
|
+
mybatis: srcPath.mybatis,
|
|
202901
|
+
originSrc: src.javascriptTo,
|
|
202902
|
+
menuUrl: where.menu.url,
|
|
202903
|
+
menuName: where.menu.name,
|
|
202904
|
+
baseClass: srcPath.baseClass,
|
|
202905
|
+
className: srcPath.classTo,
|
|
202906
|
+
emptyIndex: srcPath.emptyIndex,
|
|
202907
|
+
activeIndex: srcPath.activeIndex,
|
|
202908
|
+
mybatisXmlSource: generatedSource.mybatis,
|
|
202909
|
+
controllerSource: generatedSource.controller,
|
|
202910
|
+
tableDefinitions: JSON.stringify(columnInfo),
|
|
202911
|
+
});
|
|
202912
|
+
}
|
|
202913
|
+
|
|
203178
202914
|
progressMessageInstance.updateProgress('javascript', 'completed');
|
|
203179
202915
|
}
|
|
203180
202916
|
|
|
@@ -203228,187 +202964,6 @@ console.log(el, href, title);
|
|
|
203228
202964
|
return returnSrc;
|
|
203229
202965
|
};
|
|
203230
202966
|
|
|
203231
|
-
#generateListSource = async (userPrompt, apply, progressMessageInstance) => {
|
|
203232
|
-
|
|
203233
|
-
/**
|
|
203234
|
-
const el = ninegrid.querySelector("nx-side-menu-item.active");
|
|
203235
|
-
if (!el) throw new Error("관련 메뉴를 찾을 수 없습니다.");
|
|
203236
|
-
|
|
203237
|
-
const href = el.getAttribute("href");
|
|
203238
|
-
const title = el.getAttribute("title");
|
|
203239
|
-
|
|
203240
|
-
console.log(el, href, title);
|
|
203241
|
-
|
|
203242
|
-
const srcPath = this.#getSourcePath(href);
|
|
203243
|
-
console.log(srcPath);
|
|
203244
|
-
*/
|
|
203245
|
-
|
|
203246
|
-
|
|
203247
|
-
const where = await this.#where(userPrompt, this.#getMenuInfo(), await this.#getTableList());
|
|
203248
|
-
//this.#parent.addMessage("대상 메뉴와 테이블을 찾았습니다.")
|
|
203249
|
-
|
|
203250
|
-
console.log(where);
|
|
203251
|
-
|
|
203252
|
-
const srcPath = this.#getSourcePath(where.menu.url);
|
|
203253
|
-
console.log(srcPath);
|
|
203254
|
-
|
|
203255
|
-
|
|
203256
|
-
/**
|
|
203257
|
-
* {
|
|
203258
|
-
* "package": "ide.assi.be.tmpla",
|
|
203259
|
-
* "namespace": "ide.assi.be.tmpla.docmanager",
|
|
203260
|
-
* "baseClass": "DocManager",
|
|
203261
|
-
* "resultType": "ide.assi.core.utils.CamelCaseMap",
|
|
203262
|
-
* "mybatis": "tmpla/DocManagerMapper.xml",
|
|
203263
|
-
* "mybatisPullPath": "ide-assi-be/src/main/resources/mapper/tmpla/DocManagerMapper.xml",
|
|
203264
|
-
* "controllerPullPath": "ide-assi-be/src/main/java/ide/assi/be/tmpla/controller/DocManagerController.java",
|
|
203265
|
-
* "servicePullPath": "ide-assi-be/src/main/java/ide/assi/be/tmpla/service/DocManagerService.java",
|
|
203266
|
-
* "javascriptPullPath": "ide-assi-fe-vite-react-js/src/views/tmpla/doc-manager.jsx"
|
|
203267
|
-
* }
|
|
203268
|
-
*/
|
|
203269
|
-
const src = await api.post("/api/source/read", srcPath);
|
|
203270
|
-
//console.log(src);
|
|
203271
|
-
|
|
203272
|
-
/**
|
|
203273
|
-
const response = await fetch(srcPath.javascript);
|
|
203274
|
-
src.javascript = await response.text();*/
|
|
203275
|
-
|
|
203276
|
-
//console.log(src);
|
|
203277
|
-
//const template = await fetch(path).then(res => res.text());
|
|
203278
|
-
/*
|
|
203279
|
-
arr.push({
|
|
203280
|
-
//menuId: elem.getAttribute("menu-id"),
|
|
203281
|
-
url: elem.getAttribute("href"),
|
|
203282
|
-
title: elem.getAttribute("title"),
|
|
203283
|
-
})*/
|
|
203284
|
-
|
|
203285
|
-
|
|
203286
|
-
|
|
203287
|
-
|
|
203288
|
-
|
|
203289
|
-
//const where = await this.#where(`${title}에서 ${userPrompt}`, [{url: href, title: title}], await this.#getTableList());
|
|
203290
|
-
//this.#parent.addMessage("대상 메뉴와 테이블을 찾았습니다.");
|
|
203291
|
-
progressMessageInstance.updateProgress('prepare2', 'completed');
|
|
203292
|
-
|
|
203293
|
-
//console.log(where);
|
|
203294
|
-
|
|
203295
|
-
//const srcPath = this.#getSourcePath(where.menu.url);
|
|
203296
|
-
|
|
203297
|
-
|
|
203298
|
-
|
|
203299
|
-
const columnInfo = await this.#getColumnInfo(where.table);
|
|
203300
|
-
|
|
203301
|
-
let mybatisXmlSource;
|
|
203302
|
-
if (apply.mybatis) {
|
|
203303
|
-
mybatisXmlSource = await this.#generateTmplFile("/prompts/meta/U.BuildMyBatisMapper.txt", "mybatis.xml", {
|
|
203304
|
-
userPrompt: userPrompt,
|
|
203305
|
-
originSrc: src.mybatis,
|
|
203306
|
-
resultType: srcPath.resultType,
|
|
203307
|
-
namespace: srcPath.namespace,
|
|
203308
|
-
tableDefinitions: JSON.stringify(columnInfo),
|
|
203309
|
-
});
|
|
203310
|
-
//this.#parent.addMessage("MyBatis 소스파일을 생성했습니다.");
|
|
203311
|
-
progressMessageInstance.updateProgress('mybatis', 'completed');
|
|
203312
|
-
}
|
|
203313
|
-
else {
|
|
203314
|
-
mybatisXmlSource = src.mybatis;
|
|
203315
|
-
}
|
|
203316
|
-
|
|
203317
|
-
let serviceSrc;
|
|
203318
|
-
if (apply.service) {
|
|
203319
|
-
serviceSrc = await this.#generateTmplFile("/prompts/meta/U.BuildService.txt", "service.java", {
|
|
203320
|
-
userPrompt: userPrompt,
|
|
203321
|
-
originSrc: src.service,
|
|
203322
|
-
baseClass: srcPath.baseClass,
|
|
203323
|
-
myBatisPath: srcPath.mybatis,
|
|
203324
|
-
namespace: srcPath.namespace,
|
|
203325
|
-
package: srcPath.package + ".service",
|
|
203326
|
-
mybatisXmlSource: mybatisXmlSource,
|
|
203327
|
-
});
|
|
203328
|
-
//this.#parent.addMessage("Java(Service) 소스파일을 생성했습니다.");
|
|
203329
|
-
progressMessageInstance.updateProgress('service', 'completed');
|
|
203330
|
-
}
|
|
203331
|
-
else {
|
|
203332
|
-
serviceSrc = src.service;
|
|
203333
|
-
}
|
|
203334
|
-
|
|
203335
|
-
let controllerSrc;
|
|
203336
|
-
if (apply.controller) {
|
|
203337
|
-
controllerSrc = await this.#generateTmplFile("/prompts/meta/U.BuildController.txt", "controller.java", {
|
|
203338
|
-
userPrompt: userPrompt,
|
|
203339
|
-
originSrc: src.controller,
|
|
203340
|
-
baseClass: srcPath.baseClass,
|
|
203341
|
-
menuUrl: where.menu.url,
|
|
203342
|
-
package: srcPath.package + ".controller",
|
|
203343
|
-
serviceSource: serviceSrc,
|
|
203344
|
-
});
|
|
203345
|
-
//this.#parent.addMessage("Java(Controller) 소스파일을 생성했습니다.");
|
|
203346
|
-
progressMessageInstance.updateProgress('controller', 'completed');
|
|
203347
|
-
}
|
|
203348
|
-
else {
|
|
203349
|
-
controllerSrc = src.controller;
|
|
203350
|
-
}
|
|
203351
|
-
|
|
203352
|
-
let jsSrc;
|
|
203353
|
-
if (apply.javascript) {
|
|
203354
|
-
jsSrc = await this.#generateTmplFile(this.prompt.react.filter(item => item.includes(".main.") || item.includes(".all.")), "react.jsx", {
|
|
203355
|
-
userPrompt: userPrompt,
|
|
203356
|
-
mybatis: srcPath.mybatis,
|
|
203357
|
-
originSrc: src.javascript,
|
|
203358
|
-
menuUrl: where.menu.url,
|
|
203359
|
-
menuName: where.menu.name,
|
|
203360
|
-
baseClass: srcPath.baseClass,
|
|
203361
|
-
mybatisXmlSource: mybatisXmlSource,
|
|
203362
|
-
controllerSource: controllerSrc,
|
|
203363
|
-
tableDefinitions: JSON.stringify(columnInfo),
|
|
203364
|
-
});
|
|
203365
|
-
//this.#parent.addMessage("Jsx(React) 소스파일을 생성했습니다.");
|
|
203366
|
-
progressMessageInstance.updateProgress('javascript', 'completed');
|
|
203367
|
-
}
|
|
203368
|
-
else {
|
|
203369
|
-
jsSrc = src.javascript;
|
|
203370
|
-
}
|
|
203371
|
-
|
|
203372
|
-
//await this.#generateRealFile(srcPath, apply);
|
|
203373
|
-
|
|
203374
|
-
const returnSrc = [];
|
|
203375
|
-
|
|
203376
|
-
const mapping = {
|
|
203377
|
-
mybatis: {
|
|
203378
|
-
path: srcPath.mybatisPullPath,
|
|
203379
|
-
src: mybatisXmlSource,
|
|
203380
|
-
},
|
|
203381
|
-
service: {
|
|
203382
|
-
path: srcPath.servicePullPath,
|
|
203383
|
-
src: serviceSrc,
|
|
203384
|
-
},
|
|
203385
|
-
controller: {
|
|
203386
|
-
path: srcPath.controllerPullPath,
|
|
203387
|
-
src: controllerSrc,
|
|
203388
|
-
},
|
|
203389
|
-
javascript: {
|
|
203390
|
-
path: srcPath.javascriptPullPath,
|
|
203391
|
-
src: jsSrc,
|
|
203392
|
-
}
|
|
203393
|
-
};
|
|
203394
|
-
|
|
203395
|
-
for (const key in apply) {
|
|
203396
|
-
if (apply[key]) {
|
|
203397
|
-
returnSrc.push({
|
|
203398
|
-
[key]: {
|
|
203399
|
-
asis: src[key],
|
|
203400
|
-
tobe: mapping[key].src,
|
|
203401
|
-
tobePath: mapping[key].path,
|
|
203402
|
-
}
|
|
203403
|
-
});
|
|
203404
|
-
}
|
|
203405
|
-
}
|
|
203406
|
-
|
|
203407
|
-
console.log(returnSrc);
|
|
203408
|
-
|
|
203409
|
-
return returnSrc;
|
|
203410
|
-
};
|
|
203411
|
-
|
|
203412
202967
|
#generateDetailSource = async (userPrompt, apply, progressMessageInstance) => {
|
|
203413
202968
|
|
|
203414
202969
|
const el = ninegrid.querySelector("nx-side-menu-item.active");
|
|
@@ -203805,30 +203360,27 @@ console.log(el, href, title);
|
|
|
203805
203360
|
const progressMessageInstance = elAiChat.addProgress(initialProgressData);
|
|
203806
203361
|
|
|
203807
203362
|
const what = await this.#what(userPrompt);
|
|
203808
|
-
//this.#parent.addMessage("명령을 이해했습니다.");
|
|
203809
203363
|
progressMessageInstance.updateProgress('prepare1', 'completed');
|
|
203810
203364
|
|
|
203811
|
-
if (
|
|
203365
|
+
if (["C1","C2"].includes(what)) {
|
|
203812
203366
|
if (!apply.mybatis || !apply.service || !apply.controller || !apply.javascript) ;
|
|
203813
|
-
|
|
203814
|
-
|
|
203367
|
+
}
|
|
203368
|
+
|
|
203369
|
+
if (what === "C1") {
|
|
203815
203370
|
return await this.#generateSource(what, userPrompt, apply, progressMessageInstance);
|
|
203816
203371
|
}
|
|
203817
203372
|
else if (what === "C2") {
|
|
203818
|
-
|
|
203819
|
-
//await this.#createSource(userPrompt, apply);
|
|
203820
|
-
return await this.#generateDetailSource(userPrompt, apply, progressMessageInstance);
|
|
203373
|
+
return await this.#generateSource(what, userPrompt, apply, progressMessageInstance);
|
|
203821
203374
|
}
|
|
203822
203375
|
else if (what === "U1") {
|
|
203823
203376
|
// .list-wrapper 또는 .detail-wrapper-* 중에서 .active 클래스를 가진 첫 번째 요소를 찾습니다.
|
|
203824
203377
|
const el = document.querySelector(".list-wrapper.active");
|
|
203825
203378
|
|
|
203826
203379
|
if (el) {
|
|
203827
|
-
//return await this.#modifySource(userPrompt, apply, progressMessageInstance);
|
|
203828
203380
|
return await this.#generateSource(what, userPrompt, apply, progressMessageInstance);
|
|
203829
203381
|
}
|
|
203830
203382
|
else {
|
|
203831
|
-
return await this.#
|
|
203383
|
+
return await this.#generateSource("U2", userPrompt, apply, progressMessageInstance);
|
|
203832
203384
|
}
|
|
203833
203385
|
}
|
|
203834
203386
|
}
|