ide-assi 0.639.0 → 0.640.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 +49 -50
- package/dist/bundle.esm.js +49 -50
- package/dist/components/ideAi.js +185 -50
- package/package.json +1 -1
- package/src/components/ideAi.js +185 -50
package/dist/bundle.cjs.js
CHANGED
|
@@ -202520,6 +202520,53 @@ console.log(el, href, title);
|
|
|
202520
202520
|
return returnSrc;
|
|
202521
202521
|
};
|
|
202522
202522
|
|
|
202523
|
+
#generateListSource = async (userPrompt, apply, progressMessageInstance) => {
|
|
202524
|
+
|
|
202525
|
+
/**
|
|
202526
|
+
const el = ninegrid.querySelector("nx-side-menu-item.active");
|
|
202527
|
+
if (!el) throw new Error("관련 메뉴를 찾을 수 없습니다.");
|
|
202528
|
+
|
|
202529
|
+
const href = el.getAttribute("href");
|
|
202530
|
+
const title = el.getAttribute("title");
|
|
202531
|
+
|
|
202532
|
+
console.log(el, href, title);
|
|
202533
|
+
|
|
202534
|
+
const srcPath = this.#getSourcePath(href);
|
|
202535
|
+
console.log(srcPath);
|
|
202536
|
+
*/
|
|
202537
|
+
|
|
202538
|
+
|
|
202539
|
+
const where1 = await this.#where(userPrompt, this.#getMenuInfo(), await this.#getTableList());
|
|
202540
|
+
//this.#parent.addMessage("대상 메뉴와 테이블을 찾았습니다.")
|
|
202541
|
+
|
|
202542
|
+
console.log(where1);
|
|
202543
|
+
|
|
202544
|
+
const srcPath1 = this.#getSourcePath(where.menu.url);
|
|
202545
|
+
console.log(srcPath1);
|
|
202546
|
+
|
|
202547
|
+
return;
|
|
202548
|
+
//console.log(src);
|
|
202549
|
+
|
|
202550
|
+
/**
|
|
202551
|
+
const response = await fetch(srcPath.javascript);
|
|
202552
|
+
src.javascript = await response.text();*/
|
|
202553
|
+
|
|
202554
|
+
//console.log(src);
|
|
202555
|
+
//const template = await fetch(path).then(res => res.text());
|
|
202556
|
+
/*
|
|
202557
|
+
arr.push({
|
|
202558
|
+
//menuId: elem.getAttribute("menu-id"),
|
|
202559
|
+
url: elem.getAttribute("href"),
|
|
202560
|
+
title: elem.getAttribute("title"),
|
|
202561
|
+
})*/
|
|
202562
|
+
|
|
202563
|
+
|
|
202564
|
+
|
|
202565
|
+
|
|
202566
|
+
|
|
202567
|
+
const where = await this.#where(`${title}에서 ${userPrompt}`, [{url: href, title: title}], await this.#getTableList());
|
|
202568
|
+
};
|
|
202569
|
+
|
|
202523
202570
|
#generateDetailSource = async (userPrompt, apply, progressMessageInstance) => {
|
|
202524
202571
|
|
|
202525
202572
|
const el = ninegrid.querySelector("nx-side-menu-item.active");
|
|
@@ -202917,63 +202964,15 @@ console.log(el, href, title);
|
|
|
202917
202964
|
const elAiChat = this.#parent.shadowRoot.querySelector("nx-ai-chat");
|
|
202918
202965
|
const progressMessageInstance = elAiChat.addProgress(initialProgressData);
|
|
202919
202966
|
|
|
202920
|
-
/**
|
|
202921
|
-
// 2. 시간이 지난 후, 특정 단계의 완료를 알림
|
|
202922
|
-
// 예를 들어, 3초 후에 분석 완료
|
|
202923
|
-
setTimeout(() => {
|
|
202924
|
-
if (progressMessageInstance) {
|
|
202925
|
-
progressMessageInstance.updateProgress('1', 'completed');
|
|
202926
|
-
console.log("분석 완료 메시지 업데이트");
|
|
202927
|
-
}
|
|
202928
|
-
}, 3000);
|
|
202929
|
-
|
|
202930
|
-
// 예를 들어, 6초 후에 설계 완료
|
|
202931
|
-
setTimeout(() => {
|
|
202932
|
-
if (progressMessageInstance) {
|
|
202933
|
-
progressMessageInstance.updateProgress('2', 'completed');
|
|
202934
|
-
console.log("설계 완료 메시지 업데이트");
|
|
202935
|
-
}
|
|
202936
|
-
}, 6000);
|
|
202937
|
-
|
|
202938
|
-
// 모든 단계가 완료된 후, 일반 AI 메시지 추가 (선택 사항)
|
|
202939
|
-
setTimeout(() => {
|
|
202940
|
-
elAiChat.add("ai", "모든 작업이 성공적으로 완료되었습니다!", [], []);
|
|
202941
|
-
}, 9000);
|
|
202942
|
-
*/
|
|
202943
|
-
|
|
202944
202967
|
const what = await this.#what(userPrompt);
|
|
202945
202968
|
//this.#parent.addMessage("명령을 이해했습니다.");
|
|
202946
202969
|
progressMessageInstance.updateProgress('prepare1', 'completed');
|
|
202947
202970
|
|
|
202948
|
-
|
|
202949
|
-
|
|
202950
|
-
|
|
202951
|
-
|
|
202952
|
-
/**
|
|
202953
|
-
//active가 상세면
|
|
202954
|
-
if (!apply.javascript) {
|
|
202955
|
-
//return "소스 생성하실려면 변경대상 소스를 모두 선택하세요.";
|
|
202956
|
-
}
|
|
202957
|
-
if (what === "1") {
|
|
202958
|
-
if (!apply.mybatis || !apply.service || !apply.controller || !apply.javascript) {
|
|
202959
|
-
//return "소스 생성하실려면 변경대상 소스를 모두 선택하세요.";
|
|
202960
|
-
}
|
|
202961
|
-
console.log("111111111")
|
|
202962
|
-
//await this.#createSource(userPrompt, apply);
|
|
202963
|
-
return await this.#generateDetailSource(userPrompt, apply, progressMessageInstance);
|
|
202964
|
-
}
|
|
202965
|
-
else if (what === "2") {
|
|
202966
|
-
return await this.#generateDetailSource(userPrompt, apply, progressMessageInstance);
|
|
202967
|
-
}
|
|
202968
|
-
|
|
202969
|
-
return;
|
|
202970
|
-
*/
|
|
202971
|
-
|
|
202972
|
-
|
|
202973
202971
|
if (what === "C1") {
|
|
202974
202972
|
if (!apply.mybatis || !apply.service || !apply.controller || !apply.javascript) ;
|
|
202975
202973
|
//await this.#createSource(userPrompt, apply);
|
|
202976
|
-
return await this.#modifySource(userPrompt, apply, progressMessageInstance);
|
|
202974
|
+
//return await this.#modifySource(userPrompt, apply, progressMessageInstance);
|
|
202975
|
+
return await this.#generateListSource(userPrompt, apply, progressMessageInstance);
|
|
202977
202976
|
}
|
|
202978
202977
|
else if (what === "C2") {
|
|
202979
202978
|
if (!apply.mybatis || !apply.service || !apply.controller || !apply.javascript) ;
|
package/dist/bundle.esm.js
CHANGED
|
@@ -202516,6 +202516,53 @@ console.log(el, href, title);
|
|
|
202516
202516
|
return returnSrc;
|
|
202517
202517
|
};
|
|
202518
202518
|
|
|
202519
|
+
#generateListSource = async (userPrompt, apply, progressMessageInstance) => {
|
|
202520
|
+
|
|
202521
|
+
/**
|
|
202522
|
+
const el = ninegrid.querySelector("nx-side-menu-item.active");
|
|
202523
|
+
if (!el) throw new Error("관련 메뉴를 찾을 수 없습니다.");
|
|
202524
|
+
|
|
202525
|
+
const href = el.getAttribute("href");
|
|
202526
|
+
const title = el.getAttribute("title");
|
|
202527
|
+
|
|
202528
|
+
console.log(el, href, title);
|
|
202529
|
+
|
|
202530
|
+
const srcPath = this.#getSourcePath(href);
|
|
202531
|
+
console.log(srcPath);
|
|
202532
|
+
*/
|
|
202533
|
+
|
|
202534
|
+
|
|
202535
|
+
const where1 = await this.#where(userPrompt, this.#getMenuInfo(), await this.#getTableList());
|
|
202536
|
+
//this.#parent.addMessage("대상 메뉴와 테이블을 찾았습니다.")
|
|
202537
|
+
|
|
202538
|
+
console.log(where1);
|
|
202539
|
+
|
|
202540
|
+
const srcPath1 = this.#getSourcePath(where.menu.url);
|
|
202541
|
+
console.log(srcPath1);
|
|
202542
|
+
|
|
202543
|
+
return;
|
|
202544
|
+
//console.log(src);
|
|
202545
|
+
|
|
202546
|
+
/**
|
|
202547
|
+
const response = await fetch(srcPath.javascript);
|
|
202548
|
+
src.javascript = await response.text();*/
|
|
202549
|
+
|
|
202550
|
+
//console.log(src);
|
|
202551
|
+
//const template = await fetch(path).then(res => res.text());
|
|
202552
|
+
/*
|
|
202553
|
+
arr.push({
|
|
202554
|
+
//menuId: elem.getAttribute("menu-id"),
|
|
202555
|
+
url: elem.getAttribute("href"),
|
|
202556
|
+
title: elem.getAttribute("title"),
|
|
202557
|
+
})*/
|
|
202558
|
+
|
|
202559
|
+
|
|
202560
|
+
|
|
202561
|
+
|
|
202562
|
+
|
|
202563
|
+
const where = await this.#where(`${title}에서 ${userPrompt}`, [{url: href, title: title}], await this.#getTableList());
|
|
202564
|
+
};
|
|
202565
|
+
|
|
202519
202566
|
#generateDetailSource = async (userPrompt, apply, progressMessageInstance) => {
|
|
202520
202567
|
|
|
202521
202568
|
const el = ninegrid.querySelector("nx-side-menu-item.active");
|
|
@@ -202913,63 +202960,15 @@ console.log(el, href, title);
|
|
|
202913
202960
|
const elAiChat = this.#parent.shadowRoot.querySelector("nx-ai-chat");
|
|
202914
202961
|
const progressMessageInstance = elAiChat.addProgress(initialProgressData);
|
|
202915
202962
|
|
|
202916
|
-
/**
|
|
202917
|
-
// 2. 시간이 지난 후, 특정 단계의 완료를 알림
|
|
202918
|
-
// 예를 들어, 3초 후에 분석 완료
|
|
202919
|
-
setTimeout(() => {
|
|
202920
|
-
if (progressMessageInstance) {
|
|
202921
|
-
progressMessageInstance.updateProgress('1', 'completed');
|
|
202922
|
-
console.log("분석 완료 메시지 업데이트");
|
|
202923
|
-
}
|
|
202924
|
-
}, 3000);
|
|
202925
|
-
|
|
202926
|
-
// 예를 들어, 6초 후에 설계 완료
|
|
202927
|
-
setTimeout(() => {
|
|
202928
|
-
if (progressMessageInstance) {
|
|
202929
|
-
progressMessageInstance.updateProgress('2', 'completed');
|
|
202930
|
-
console.log("설계 완료 메시지 업데이트");
|
|
202931
|
-
}
|
|
202932
|
-
}, 6000);
|
|
202933
|
-
|
|
202934
|
-
// 모든 단계가 완료된 후, 일반 AI 메시지 추가 (선택 사항)
|
|
202935
|
-
setTimeout(() => {
|
|
202936
|
-
elAiChat.add("ai", "모든 작업이 성공적으로 완료되었습니다!", [], []);
|
|
202937
|
-
}, 9000);
|
|
202938
|
-
*/
|
|
202939
|
-
|
|
202940
202963
|
const what = await this.#what(userPrompt);
|
|
202941
202964
|
//this.#parent.addMessage("명령을 이해했습니다.");
|
|
202942
202965
|
progressMessageInstance.updateProgress('prepare1', 'completed');
|
|
202943
202966
|
|
|
202944
|
-
|
|
202945
|
-
|
|
202946
|
-
|
|
202947
|
-
|
|
202948
|
-
/**
|
|
202949
|
-
//active가 상세면
|
|
202950
|
-
if (!apply.javascript) {
|
|
202951
|
-
//return "소스 생성하실려면 변경대상 소스를 모두 선택하세요.";
|
|
202952
|
-
}
|
|
202953
|
-
if (what === "1") {
|
|
202954
|
-
if (!apply.mybatis || !apply.service || !apply.controller || !apply.javascript) {
|
|
202955
|
-
//return "소스 생성하실려면 변경대상 소스를 모두 선택하세요.";
|
|
202956
|
-
}
|
|
202957
|
-
console.log("111111111")
|
|
202958
|
-
//await this.#createSource(userPrompt, apply);
|
|
202959
|
-
return await this.#generateDetailSource(userPrompt, apply, progressMessageInstance);
|
|
202960
|
-
}
|
|
202961
|
-
else if (what === "2") {
|
|
202962
|
-
return await this.#generateDetailSource(userPrompt, apply, progressMessageInstance);
|
|
202963
|
-
}
|
|
202964
|
-
|
|
202965
|
-
return;
|
|
202966
|
-
*/
|
|
202967
|
-
|
|
202968
|
-
|
|
202969
202967
|
if (what === "C1") {
|
|
202970
202968
|
if (!apply.mybatis || !apply.service || !apply.controller || !apply.javascript) ;
|
|
202971
202969
|
//await this.#createSource(userPrompt, apply);
|
|
202972
|
-
return await this.#modifySource(userPrompt, apply, progressMessageInstance);
|
|
202970
|
+
//return await this.#modifySource(userPrompt, apply, progressMessageInstance);
|
|
202971
|
+
return await this.#generateListSource(userPrompt, apply, progressMessageInstance);
|
|
202973
202972
|
}
|
|
202974
202973
|
else if (what === "C2") {
|
|
202975
202974
|
if (!apply.mybatis || !apply.service || !apply.controller || !apply.javascript) ;
|
package/dist/components/ideAi.js
CHANGED
|
@@ -650,6 +650,189 @@ console.log(el, href, title);
|
|
|
650
650
|
return returnSrc;
|
|
651
651
|
};
|
|
652
652
|
|
|
653
|
+
#generateListSource = async (userPrompt, apply, progressMessageInstance) => {
|
|
654
|
+
|
|
655
|
+
/**
|
|
656
|
+
const el = ninegrid.querySelector("nx-side-menu-item.active");
|
|
657
|
+
if (!el) throw new Error("관련 메뉴를 찾을 수 없습니다.");
|
|
658
|
+
|
|
659
|
+
const href = el.getAttribute("href");
|
|
660
|
+
const title = el.getAttribute("title");
|
|
661
|
+
|
|
662
|
+
console.log(el, href, title);
|
|
663
|
+
|
|
664
|
+
const srcPath = this.#getSourcePath(href);
|
|
665
|
+
console.log(srcPath);
|
|
666
|
+
*/
|
|
667
|
+
|
|
668
|
+
|
|
669
|
+
const where1 = await this.#where(userPrompt, this.#getMenuInfo(), await this.#getTableList());
|
|
670
|
+
//this.#parent.addMessage("대상 메뉴와 테이블을 찾았습니다.")
|
|
671
|
+
|
|
672
|
+
console.log(where1);
|
|
673
|
+
|
|
674
|
+
const srcPath1 = this.#getSourcePath(where.menu.url);
|
|
675
|
+
console.log(srcPath1);
|
|
676
|
+
|
|
677
|
+
return;
|
|
678
|
+
|
|
679
|
+
|
|
680
|
+
/**
|
|
681
|
+
* {
|
|
682
|
+
* "package": "ide.assi.be.tmpla",
|
|
683
|
+
* "namespace": "ide.assi.be.tmpla.docmanager",
|
|
684
|
+
* "baseClass": "DocManager",
|
|
685
|
+
* "resultType": "ide.assi.core.utils.CamelCaseMap",
|
|
686
|
+
* "mybatis": "tmpla/DocManagerMapper.xml",
|
|
687
|
+
* "mybatisPullPath": "ide-assi-be/src/main/resources/mapper/tmpla/DocManagerMapper.xml",
|
|
688
|
+
* "controllerPullPath": "ide-assi-be/src/main/java/ide/assi/be/tmpla/controller/DocManagerController.java",
|
|
689
|
+
* "servicePullPath": "ide-assi-be/src/main/java/ide/assi/be/tmpla/service/DocManagerService.java",
|
|
690
|
+
* "javascriptPullPath": "ide-assi-fe-vite-react-js/src/views/tmpla/doc-manager.jsx"
|
|
691
|
+
* }
|
|
692
|
+
*/
|
|
693
|
+
const src = await api.post("/api/source/read", srcPath);
|
|
694
|
+
//console.log(src);
|
|
695
|
+
|
|
696
|
+
/**
|
|
697
|
+
const response = await fetch(srcPath.javascript);
|
|
698
|
+
src.javascript = await response.text();*/
|
|
699
|
+
|
|
700
|
+
//console.log(src);
|
|
701
|
+
//const template = await fetch(path).then(res => res.text());
|
|
702
|
+
/*
|
|
703
|
+
arr.push({
|
|
704
|
+
//menuId: elem.getAttribute("menu-id"),
|
|
705
|
+
url: elem.getAttribute("href"),
|
|
706
|
+
title: elem.getAttribute("title"),
|
|
707
|
+
})*/
|
|
708
|
+
|
|
709
|
+
|
|
710
|
+
|
|
711
|
+
|
|
712
|
+
|
|
713
|
+
const where = await this.#where(`${title}에서 ${userPrompt}`, [{url: href, title: title}], await this.#getTableList());
|
|
714
|
+
//this.#parent.addMessage("대상 메뉴와 테이블을 찾았습니다.");
|
|
715
|
+
progressMessageInstance.updateProgress('prepare2', 'completed');
|
|
716
|
+
|
|
717
|
+
console.log(where);
|
|
718
|
+
|
|
719
|
+
//const srcPath = this.#getSourcePath(where.menu.url);
|
|
720
|
+
|
|
721
|
+
|
|
722
|
+
|
|
723
|
+
const columnInfo = await this.#getColumnInfo(where.table);
|
|
724
|
+
|
|
725
|
+
let mybatisXmlSource;
|
|
726
|
+
if (apply.mybatis) {
|
|
727
|
+
mybatisXmlSource = await this.#generateTmplFile("/prompts/meta/U.BuildMyBatisMapper.txt", "mybatis.xml", {
|
|
728
|
+
userPrompt: userPrompt,
|
|
729
|
+
originSrc: src.mybatis,
|
|
730
|
+
resultType: srcPath.resultType,
|
|
731
|
+
namespace: srcPath.namespace,
|
|
732
|
+
tableDefinitions: JSON.stringify(columnInfo),
|
|
733
|
+
});
|
|
734
|
+
//this.#parent.addMessage("MyBatis 소스파일을 생성했습니다.");
|
|
735
|
+
progressMessageInstance.updateProgress('mybatis', 'completed');
|
|
736
|
+
}
|
|
737
|
+
else {
|
|
738
|
+
mybatisXmlSource = src.mybatis;
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
let serviceSrc;
|
|
742
|
+
if (apply.service) {
|
|
743
|
+
serviceSrc = await this.#generateTmplFile("/prompts/meta/U.BuildService.txt", "service.java", {
|
|
744
|
+
userPrompt: userPrompt,
|
|
745
|
+
originSrc: src.service,
|
|
746
|
+
baseClass: srcPath.baseClass,
|
|
747
|
+
myBatisPath: srcPath.mybatis,
|
|
748
|
+
namespace: srcPath.namespace,
|
|
749
|
+
package: srcPath.package + ".service",
|
|
750
|
+
mybatisXmlSource: mybatisXmlSource,
|
|
751
|
+
});
|
|
752
|
+
//this.#parent.addMessage("Java(Service) 소스파일을 생성했습니다.");
|
|
753
|
+
progressMessageInstance.updateProgress('service', 'completed');
|
|
754
|
+
}
|
|
755
|
+
else {
|
|
756
|
+
serviceSrc = src.service;
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
let controllerSrc;
|
|
760
|
+
if (apply.controller) {
|
|
761
|
+
controllerSrc = await this.#generateTmplFile("/prompts/meta/U.BuildController.txt", "controller.java", {
|
|
762
|
+
userPrompt: userPrompt,
|
|
763
|
+
originSrc: src.controller,
|
|
764
|
+
baseClass: srcPath.baseClass,
|
|
765
|
+
menuUrl: where.menu.url,
|
|
766
|
+
package: srcPath.package + ".controller",
|
|
767
|
+
serviceSource: serviceSrc,
|
|
768
|
+
});
|
|
769
|
+
//this.#parent.addMessage("Java(Controller) 소스파일을 생성했습니다.");
|
|
770
|
+
progressMessageInstance.updateProgress('controller', 'completed');
|
|
771
|
+
}
|
|
772
|
+
else {
|
|
773
|
+
controllerSrc = src.controller;
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
let jsSrc;
|
|
777
|
+
if (apply.javascript) {
|
|
778
|
+
jsSrc = await this.#generateTmplFile("/prompts/meta/U.BuildReactJsx.txt", "react.jsx", {
|
|
779
|
+
userPrompt: userPrompt,
|
|
780
|
+
mybatis: srcPath.mybatis,
|
|
781
|
+
originSrc: src.javascript,
|
|
782
|
+
menuUrl: where.menu.url,
|
|
783
|
+
menuName: where.menu.name,
|
|
784
|
+
baseClass: srcPath.baseClass,
|
|
785
|
+
mybatisXmlSource: mybatisXmlSource,
|
|
786
|
+
controllerSource: controllerSrc,
|
|
787
|
+
tableDefinitions: JSON.stringify(columnInfo),
|
|
788
|
+
});
|
|
789
|
+
//this.#parent.addMessage("Jsx(React) 소스파일을 생성했습니다.");
|
|
790
|
+
progressMessageInstance.updateProgress('javascript', 'completed');
|
|
791
|
+
}
|
|
792
|
+
else {
|
|
793
|
+
jsSrc = src.javascript;
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
//await this.#generateRealFile(srcPath, apply);
|
|
797
|
+
|
|
798
|
+
const returnSrc = [];
|
|
799
|
+
|
|
800
|
+
const mapping = {
|
|
801
|
+
mybatis: {
|
|
802
|
+
path: srcPath.mybatisPullPath,
|
|
803
|
+
src: mybatisXmlSource,
|
|
804
|
+
},
|
|
805
|
+
service: {
|
|
806
|
+
path: srcPath.servicePullPath,
|
|
807
|
+
src: serviceSrc,
|
|
808
|
+
},
|
|
809
|
+
controller: {
|
|
810
|
+
path: srcPath.controllerPullPath,
|
|
811
|
+
src: controllerSrc,
|
|
812
|
+
},
|
|
813
|
+
javascript: {
|
|
814
|
+
path: srcPath.javascriptPullPath,
|
|
815
|
+
src: jsSrc,
|
|
816
|
+
}
|
|
817
|
+
};
|
|
818
|
+
|
|
819
|
+
for (const key in apply) {
|
|
820
|
+
if (apply[key]) {
|
|
821
|
+
returnSrc.push({
|
|
822
|
+
[key]: {
|
|
823
|
+
asis: src[key],
|
|
824
|
+
tobe: mapping[key].src,
|
|
825
|
+
tobePath: mapping[key].path,
|
|
826
|
+
}
|
|
827
|
+
});
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
console.log(returnSrc);
|
|
832
|
+
|
|
833
|
+
return returnSrc;
|
|
834
|
+
};
|
|
835
|
+
|
|
653
836
|
#generateDetailSource = async (userPrompt, apply, progressMessageInstance) => {
|
|
654
837
|
|
|
655
838
|
const el = ninegrid.querySelector("nx-side-menu-item.active");
|
|
@@ -1047,65 +1230,17 @@ console.log(el, href, title);
|
|
|
1047
1230
|
const elAiChat = this.#parent.shadowRoot.querySelector("nx-ai-chat");
|
|
1048
1231
|
const progressMessageInstance = elAiChat.addProgress(initialProgressData);
|
|
1049
1232
|
|
|
1050
|
-
/**
|
|
1051
|
-
// 2. 시간이 지난 후, 특정 단계의 완료를 알림
|
|
1052
|
-
// 예를 들어, 3초 후에 분석 완료
|
|
1053
|
-
setTimeout(() => {
|
|
1054
|
-
if (progressMessageInstance) {
|
|
1055
|
-
progressMessageInstance.updateProgress('1', 'completed');
|
|
1056
|
-
console.log("분석 완료 메시지 업데이트");
|
|
1057
|
-
}
|
|
1058
|
-
}, 3000);
|
|
1059
|
-
|
|
1060
|
-
// 예를 들어, 6초 후에 설계 완료
|
|
1061
|
-
setTimeout(() => {
|
|
1062
|
-
if (progressMessageInstance) {
|
|
1063
|
-
progressMessageInstance.updateProgress('2', 'completed');
|
|
1064
|
-
console.log("설계 완료 메시지 업데이트");
|
|
1065
|
-
}
|
|
1066
|
-
}, 6000);
|
|
1067
|
-
|
|
1068
|
-
// 모든 단계가 완료된 후, 일반 AI 메시지 추가 (선택 사항)
|
|
1069
|
-
setTimeout(() => {
|
|
1070
|
-
elAiChat.add("ai", "모든 작업이 성공적으로 완료되었습니다!", [], []);
|
|
1071
|
-
}, 9000);
|
|
1072
|
-
*/
|
|
1073
|
-
|
|
1074
1233
|
const what = await this.#what(userPrompt);
|
|
1075
1234
|
//this.#parent.addMessage("명령을 이해했습니다.");
|
|
1076
1235
|
progressMessageInstance.updateProgress('prepare1', 'completed');
|
|
1077
1236
|
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
/**
|
|
1083
|
-
//active가 상세면
|
|
1084
|
-
if (!apply.javascript) {
|
|
1085
|
-
//return "소스 생성하실려면 변경대상 소스를 모두 선택하세요.";
|
|
1086
|
-
}
|
|
1087
|
-
if (what === "1") {
|
|
1088
|
-
if (!apply.mybatis || !apply.service || !apply.controller || !apply.javascript) {
|
|
1089
|
-
//return "소스 생성하실려면 변경대상 소스를 모두 선택하세요.";
|
|
1090
|
-
}
|
|
1091
|
-
console.log("111111111")
|
|
1092
|
-
//await this.#createSource(userPrompt, apply);
|
|
1093
|
-
return await this.#generateDetailSource(userPrompt, apply, progressMessageInstance);
|
|
1094
|
-
}
|
|
1095
|
-
else if (what === "2") {
|
|
1096
|
-
return await this.#generateDetailSource(userPrompt, apply, progressMessageInstance);
|
|
1097
|
-
}
|
|
1098
|
-
|
|
1099
|
-
return;
|
|
1100
|
-
*/
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
1237
|
if (what === "C1") {
|
|
1104
1238
|
if (!apply.mybatis || !apply.service || !apply.controller || !apply.javascript) {
|
|
1105
1239
|
//return "소스 생성하실려면 변경대상 소스를 모두 선택하세요.";
|
|
1106
1240
|
}
|
|
1107
1241
|
//await this.#createSource(userPrompt, apply);
|
|
1108
|
-
return await this.#modifySource(userPrompt, apply, progressMessageInstance);
|
|
1242
|
+
//return await this.#modifySource(userPrompt, apply, progressMessageInstance);
|
|
1243
|
+
return await this.#generateListSource(userPrompt, apply, progressMessageInstance);
|
|
1109
1244
|
}
|
|
1110
1245
|
else if (what === "C2") {
|
|
1111
1246
|
if (!apply.mybatis || !apply.service || !apply.controller || !apply.javascript) {
|
package/package.json
CHANGED
package/src/components/ideAi.js
CHANGED
|
@@ -650,6 +650,189 @@ console.log(el, href, title);
|
|
|
650
650
|
return returnSrc;
|
|
651
651
|
};
|
|
652
652
|
|
|
653
|
+
#generateListSource = async (userPrompt, apply, progressMessageInstance) => {
|
|
654
|
+
|
|
655
|
+
/**
|
|
656
|
+
const el = ninegrid.querySelector("nx-side-menu-item.active");
|
|
657
|
+
if (!el) throw new Error("관련 메뉴를 찾을 수 없습니다.");
|
|
658
|
+
|
|
659
|
+
const href = el.getAttribute("href");
|
|
660
|
+
const title = el.getAttribute("title");
|
|
661
|
+
|
|
662
|
+
console.log(el, href, title);
|
|
663
|
+
|
|
664
|
+
const srcPath = this.#getSourcePath(href);
|
|
665
|
+
console.log(srcPath);
|
|
666
|
+
*/
|
|
667
|
+
|
|
668
|
+
|
|
669
|
+
const where1 = await this.#where(userPrompt, this.#getMenuInfo(), await this.#getTableList());
|
|
670
|
+
//this.#parent.addMessage("대상 메뉴와 테이블을 찾았습니다.")
|
|
671
|
+
|
|
672
|
+
console.log(where1);
|
|
673
|
+
|
|
674
|
+
const srcPath1 = this.#getSourcePath(where.menu.url);
|
|
675
|
+
console.log(srcPath1);
|
|
676
|
+
|
|
677
|
+
return;
|
|
678
|
+
|
|
679
|
+
|
|
680
|
+
/**
|
|
681
|
+
* {
|
|
682
|
+
* "package": "ide.assi.be.tmpla",
|
|
683
|
+
* "namespace": "ide.assi.be.tmpla.docmanager",
|
|
684
|
+
* "baseClass": "DocManager",
|
|
685
|
+
* "resultType": "ide.assi.core.utils.CamelCaseMap",
|
|
686
|
+
* "mybatis": "tmpla/DocManagerMapper.xml",
|
|
687
|
+
* "mybatisPullPath": "ide-assi-be/src/main/resources/mapper/tmpla/DocManagerMapper.xml",
|
|
688
|
+
* "controllerPullPath": "ide-assi-be/src/main/java/ide/assi/be/tmpla/controller/DocManagerController.java",
|
|
689
|
+
* "servicePullPath": "ide-assi-be/src/main/java/ide/assi/be/tmpla/service/DocManagerService.java",
|
|
690
|
+
* "javascriptPullPath": "ide-assi-fe-vite-react-js/src/views/tmpla/doc-manager.jsx"
|
|
691
|
+
* }
|
|
692
|
+
*/
|
|
693
|
+
const src = await api.post("/api/source/read", srcPath);
|
|
694
|
+
//console.log(src);
|
|
695
|
+
|
|
696
|
+
/**
|
|
697
|
+
const response = await fetch(srcPath.javascript);
|
|
698
|
+
src.javascript = await response.text();*/
|
|
699
|
+
|
|
700
|
+
//console.log(src);
|
|
701
|
+
//const template = await fetch(path).then(res => res.text());
|
|
702
|
+
/*
|
|
703
|
+
arr.push({
|
|
704
|
+
//menuId: elem.getAttribute("menu-id"),
|
|
705
|
+
url: elem.getAttribute("href"),
|
|
706
|
+
title: elem.getAttribute("title"),
|
|
707
|
+
})*/
|
|
708
|
+
|
|
709
|
+
|
|
710
|
+
|
|
711
|
+
|
|
712
|
+
|
|
713
|
+
const where = await this.#where(`${title}에서 ${userPrompt}`, [{url: href, title: title}], await this.#getTableList());
|
|
714
|
+
//this.#parent.addMessage("대상 메뉴와 테이블을 찾았습니다.");
|
|
715
|
+
progressMessageInstance.updateProgress('prepare2', 'completed');
|
|
716
|
+
|
|
717
|
+
console.log(where);
|
|
718
|
+
|
|
719
|
+
//const srcPath = this.#getSourcePath(where.menu.url);
|
|
720
|
+
|
|
721
|
+
|
|
722
|
+
|
|
723
|
+
const columnInfo = await this.#getColumnInfo(where.table);
|
|
724
|
+
|
|
725
|
+
let mybatisXmlSource;
|
|
726
|
+
if (apply.mybatis) {
|
|
727
|
+
mybatisXmlSource = await this.#generateTmplFile("/prompts/meta/U.BuildMyBatisMapper.txt", "mybatis.xml", {
|
|
728
|
+
userPrompt: userPrompt,
|
|
729
|
+
originSrc: src.mybatis,
|
|
730
|
+
resultType: srcPath.resultType,
|
|
731
|
+
namespace: srcPath.namespace,
|
|
732
|
+
tableDefinitions: JSON.stringify(columnInfo),
|
|
733
|
+
});
|
|
734
|
+
//this.#parent.addMessage("MyBatis 소스파일을 생성했습니다.");
|
|
735
|
+
progressMessageInstance.updateProgress('mybatis', 'completed');
|
|
736
|
+
}
|
|
737
|
+
else {
|
|
738
|
+
mybatisXmlSource = src.mybatis;
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
let serviceSrc;
|
|
742
|
+
if (apply.service) {
|
|
743
|
+
serviceSrc = await this.#generateTmplFile("/prompts/meta/U.BuildService.txt", "service.java", {
|
|
744
|
+
userPrompt: userPrompt,
|
|
745
|
+
originSrc: src.service,
|
|
746
|
+
baseClass: srcPath.baseClass,
|
|
747
|
+
myBatisPath: srcPath.mybatis,
|
|
748
|
+
namespace: srcPath.namespace,
|
|
749
|
+
package: srcPath.package + ".service",
|
|
750
|
+
mybatisXmlSource: mybatisXmlSource,
|
|
751
|
+
});
|
|
752
|
+
//this.#parent.addMessage("Java(Service) 소스파일을 생성했습니다.");
|
|
753
|
+
progressMessageInstance.updateProgress('service', 'completed');
|
|
754
|
+
}
|
|
755
|
+
else {
|
|
756
|
+
serviceSrc = src.service;
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
let controllerSrc;
|
|
760
|
+
if (apply.controller) {
|
|
761
|
+
controllerSrc = await this.#generateTmplFile("/prompts/meta/U.BuildController.txt", "controller.java", {
|
|
762
|
+
userPrompt: userPrompt,
|
|
763
|
+
originSrc: src.controller,
|
|
764
|
+
baseClass: srcPath.baseClass,
|
|
765
|
+
menuUrl: where.menu.url,
|
|
766
|
+
package: srcPath.package + ".controller",
|
|
767
|
+
serviceSource: serviceSrc,
|
|
768
|
+
});
|
|
769
|
+
//this.#parent.addMessage("Java(Controller) 소스파일을 생성했습니다.");
|
|
770
|
+
progressMessageInstance.updateProgress('controller', 'completed');
|
|
771
|
+
}
|
|
772
|
+
else {
|
|
773
|
+
controllerSrc = src.controller;
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
let jsSrc;
|
|
777
|
+
if (apply.javascript) {
|
|
778
|
+
jsSrc = await this.#generateTmplFile("/prompts/meta/U.BuildReactJsx.txt", "react.jsx", {
|
|
779
|
+
userPrompt: userPrompt,
|
|
780
|
+
mybatis: srcPath.mybatis,
|
|
781
|
+
originSrc: src.javascript,
|
|
782
|
+
menuUrl: where.menu.url,
|
|
783
|
+
menuName: where.menu.name,
|
|
784
|
+
baseClass: srcPath.baseClass,
|
|
785
|
+
mybatisXmlSource: mybatisXmlSource,
|
|
786
|
+
controllerSource: controllerSrc,
|
|
787
|
+
tableDefinitions: JSON.stringify(columnInfo),
|
|
788
|
+
});
|
|
789
|
+
//this.#parent.addMessage("Jsx(React) 소스파일을 생성했습니다.");
|
|
790
|
+
progressMessageInstance.updateProgress('javascript', 'completed');
|
|
791
|
+
}
|
|
792
|
+
else {
|
|
793
|
+
jsSrc = src.javascript;
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
//await this.#generateRealFile(srcPath, apply);
|
|
797
|
+
|
|
798
|
+
const returnSrc = [];
|
|
799
|
+
|
|
800
|
+
const mapping = {
|
|
801
|
+
mybatis: {
|
|
802
|
+
path: srcPath.mybatisPullPath,
|
|
803
|
+
src: mybatisXmlSource,
|
|
804
|
+
},
|
|
805
|
+
service: {
|
|
806
|
+
path: srcPath.servicePullPath,
|
|
807
|
+
src: serviceSrc,
|
|
808
|
+
},
|
|
809
|
+
controller: {
|
|
810
|
+
path: srcPath.controllerPullPath,
|
|
811
|
+
src: controllerSrc,
|
|
812
|
+
},
|
|
813
|
+
javascript: {
|
|
814
|
+
path: srcPath.javascriptPullPath,
|
|
815
|
+
src: jsSrc,
|
|
816
|
+
}
|
|
817
|
+
};
|
|
818
|
+
|
|
819
|
+
for (const key in apply) {
|
|
820
|
+
if (apply[key]) {
|
|
821
|
+
returnSrc.push({
|
|
822
|
+
[key]: {
|
|
823
|
+
asis: src[key],
|
|
824
|
+
tobe: mapping[key].src,
|
|
825
|
+
tobePath: mapping[key].path,
|
|
826
|
+
}
|
|
827
|
+
});
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
console.log(returnSrc);
|
|
832
|
+
|
|
833
|
+
return returnSrc;
|
|
834
|
+
};
|
|
835
|
+
|
|
653
836
|
#generateDetailSource = async (userPrompt, apply, progressMessageInstance) => {
|
|
654
837
|
|
|
655
838
|
const el = ninegrid.querySelector("nx-side-menu-item.active");
|
|
@@ -1047,65 +1230,17 @@ console.log(el, href, title);
|
|
|
1047
1230
|
const elAiChat = this.#parent.shadowRoot.querySelector("nx-ai-chat");
|
|
1048
1231
|
const progressMessageInstance = elAiChat.addProgress(initialProgressData);
|
|
1049
1232
|
|
|
1050
|
-
/**
|
|
1051
|
-
// 2. 시간이 지난 후, 특정 단계의 완료를 알림
|
|
1052
|
-
// 예를 들어, 3초 후에 분석 완료
|
|
1053
|
-
setTimeout(() => {
|
|
1054
|
-
if (progressMessageInstance) {
|
|
1055
|
-
progressMessageInstance.updateProgress('1', 'completed');
|
|
1056
|
-
console.log("분석 완료 메시지 업데이트");
|
|
1057
|
-
}
|
|
1058
|
-
}, 3000);
|
|
1059
|
-
|
|
1060
|
-
// 예를 들어, 6초 후에 설계 완료
|
|
1061
|
-
setTimeout(() => {
|
|
1062
|
-
if (progressMessageInstance) {
|
|
1063
|
-
progressMessageInstance.updateProgress('2', 'completed');
|
|
1064
|
-
console.log("설계 완료 메시지 업데이트");
|
|
1065
|
-
}
|
|
1066
|
-
}, 6000);
|
|
1067
|
-
|
|
1068
|
-
// 모든 단계가 완료된 후, 일반 AI 메시지 추가 (선택 사항)
|
|
1069
|
-
setTimeout(() => {
|
|
1070
|
-
elAiChat.add("ai", "모든 작업이 성공적으로 완료되었습니다!", [], []);
|
|
1071
|
-
}, 9000);
|
|
1072
|
-
*/
|
|
1073
|
-
|
|
1074
1233
|
const what = await this.#what(userPrompt);
|
|
1075
1234
|
//this.#parent.addMessage("명령을 이해했습니다.");
|
|
1076
1235
|
progressMessageInstance.updateProgress('prepare1', 'completed');
|
|
1077
1236
|
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
/**
|
|
1083
|
-
//active가 상세면
|
|
1084
|
-
if (!apply.javascript) {
|
|
1085
|
-
//return "소스 생성하실려면 변경대상 소스를 모두 선택하세요.";
|
|
1086
|
-
}
|
|
1087
|
-
if (what === "1") {
|
|
1088
|
-
if (!apply.mybatis || !apply.service || !apply.controller || !apply.javascript) {
|
|
1089
|
-
//return "소스 생성하실려면 변경대상 소스를 모두 선택하세요.";
|
|
1090
|
-
}
|
|
1091
|
-
console.log("111111111")
|
|
1092
|
-
//await this.#createSource(userPrompt, apply);
|
|
1093
|
-
return await this.#generateDetailSource(userPrompt, apply, progressMessageInstance);
|
|
1094
|
-
}
|
|
1095
|
-
else if (what === "2") {
|
|
1096
|
-
return await this.#generateDetailSource(userPrompt, apply, progressMessageInstance);
|
|
1097
|
-
}
|
|
1098
|
-
|
|
1099
|
-
return;
|
|
1100
|
-
*/
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
1237
|
if (what === "C1") {
|
|
1104
1238
|
if (!apply.mybatis || !apply.service || !apply.controller || !apply.javascript) {
|
|
1105
1239
|
//return "소스 생성하실려면 변경대상 소스를 모두 선택하세요.";
|
|
1106
1240
|
}
|
|
1107
1241
|
//await this.#createSource(userPrompt, apply);
|
|
1108
|
-
return await this.#modifySource(userPrompt, apply, progressMessageInstance);
|
|
1242
|
+
//return await this.#modifySource(userPrompt, apply, progressMessageInstance);
|
|
1243
|
+
return await this.#generateListSource(userPrompt, apply, progressMessageInstance);
|
|
1109
1244
|
}
|
|
1110
1245
|
else if (what === "C2") {
|
|
1111
1246
|
if (!apply.mybatis || !apply.service || !apply.controller || !apply.javascript) {
|