Skip to content

Commit d55ef90

Browse files
authored
Merge pull request #40 from xiangtianyu/2.4.x
Update 2.4.x source code to github
2 parents 9584810 + d3e2d42 commit d55ef90

File tree

186 files changed

+9542
-1830
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

186 files changed

+9542
-1830
lines changed

.editorconfig

Lines changed: 1211 additions & 0 deletions
Large diffs are not rendered by default.

.github/workflows/sync-to-gitee.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ jobs:
2424
remote_repo="https://${{ secrets.GITEE_USERNAME }}:${{ secrets.GITEE_PAT }}@gitee.com/${{ env.GITEE_REPOSITORY }}.git"
2525
git remote add gitee "${remote_repo}"
2626
branch=$(git branch --show-current)
27-
git push gitee $branch -f
27+
git push gitee $branch -f

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,5 @@ bin/
4242
.DS_Store
4343

4444
.idea
45+
46+
src/main/resources/config/local.properties

BUILD_PLUGIN.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Prerequisite
2+
3+
If you want to build your own complete plugin like DevPilot, there are some required condition:
4+
1. AI gateway: support multi LLM model and provide api for plugin [Gateway repo](https://github.com/openpilot-hub/devpilot-gateway)
5+
2. Auth System: support authorization check for login user (You can close it by setting `DefaultConst.AUTH_ON` to false)
6+
3. Telemetry System: upload user behavior data for analysis (You can close it by setting `DefaultConst.TELEMETRY_ON` to false)

BUILD_PLUGIN_ZH.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# 前提条件
2+
3+
如果想构建一个完整的属于你自己的DevPilot应用,需要有如下几个条件:
4+
1. AI网关:用于兼容不同的LLM模型,并提供API给插件使用 [网关仓库](https://github.com/openpilot-hub/devpilot-gateway)
5+
2. 权限系统:用于校验插件用户的登录和使用权限(可以通过设置`DefaultConst.AUTH_ON`为false来关闭)
6+
3. 指标系统:用于处理用户上报的使用数据用于分析(可以通过设置`DefaultConst.TELEMETRY_ON`为false来关闭)

CONTRIBUTING.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,19 @@ Java 11 or higher version is required to build and test this repository.
1111
### Building
1212

1313
1. Clone this repository to your local machine.
14-
1514
`git clone https://github.com/openpilot-hub/devpilot-intellij.git`
1615
2. Run the following command to build the project.
17-
1816
`./gradlew runIde`
1917
3. If you are using windows, run the following command to build the project.
20-
2118
`gradlew.bat runIde`
2219

20+
### Update Webview
21+
22+
1. Clone this repository
23+
`https://github.com/openpilot-hub/devpilot-h5`
24+
2. Run `pnpm install` and `pnpm run build`
25+
3. `cp dist/ext.html ../devpilot-intellij/src/main/resources/webview/index.html`
26+
2327
### Testing & Checks
2428

2529
Before you commit your changes, please run the following command to check if there are any errors.

CONTRIBUTING_ZH.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,19 @@
1111
### 项目构建
1212

1313
1. 将项目克隆到本地。
14-
1514
`git clone https://github.com/openpilot-hub/devpilot-intellij.git`
1615
2. 运行如下指令构建项目。
17-
1816
`./gradlew runIde`
1917
3. 如果你使用的是 windows,运行如下指令构建项目。
20-
2118
`gradlew.bat runIde`
2219

20+
### 更新 Webview 页面
21+
22+
1. 克隆前端webview项目
23+
`https://github.com/openpilot-hub/devpilot-h5`
24+
2. 执行 `pnpm install``pnpm run build`
25+
3. 执行`cp dist/ext.html ../devpilot-intellij/src/main/resources/webview/index.html`
26+
2327
### 测试和检查
2428

2529
在提交commit之前,请运行如下指令检查是否有错误。

README.md

Lines changed: 5 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -17,155 +17,17 @@ This innovative AI-based plugin is set to supercharge your development process.
1717
5. **Code Explanation:** Don't just write code, understand it! DevPilot can explain unfamiliar code snippets, helping you grasp what's happening and learn faster.
1818
6. **Auto-Comments:** Keep your code clear! DevPilot can automatically add comments to your code, ensuring it's easy to understand and maintain.
1919

20-
## Prerequisites
21-
22-
1. You will need an OpenAI API key / Codellama API endpoint before you use this plugin.
23-
2. For use of Codellama, see [deploy Codellama into you local environment](https://github.com/openpilot-hub/codellama-deploy).
24-
25-
## Installation
26-
27-
Currently, the plugin has version requirements for IntelliJ IDEA. The minimum required version is 2021.2, make sure you have the appropriate version installed before attempting to use the plugin.
28-
29-
There are three ways for installing plugins:
30-
31-
- IDEA official marketplace - You can get the plugin from [here](https://plugins.jetbrains.com/plugin/23322-devpilot).
32-
33-
- Installation via compressed package - select "install from disk" in the plugin page settings, and then import the zip package. The download link for the compressed package is available in [Release page](https://github.com/openpilot-hub/devpilot-intellij/releases).
34-
![img.png](doc/images/screenshot/cn/install_from_disk.png)
35-
- Build from scratch
36-
1. Clone this repository to your local machine.
37-
`git clone https://github.com/openpilot-hub/devpilot-intellij.git`
38-
2. Run the following command to build the project.
39-
40-
`./gradlew runIde`
41-
42-
If you are using windows, run the following command to build the project.
43-
44-
`gradlew.bat runIde`
45-
46-
## Configuration
47-
48-
After the successful installation of the plugin, you can find the configuration page of DevPilot in the Tools section of the IDEA settings page.
49-
open the settings with <kbd>command</kbd>+<kbd>,</kbd>,
50-
51-
then navigate to Tools ❯ DevPilot ❯ Service Configuration.
52-
53-
![configuration](doc/images/screenshot/en/config.png)
54-
55-
On the configuration page, you can switch the language of the plugin between multiple choices, as well as select different models and their addresses. The username will be displayed on the page during the conversation.
56-
![settings](doc/images/screenshot/en/settings.png)
57-
5820
## How to use
5921

60-
In the dialog box, you can ask any question and send it by pressing Enter or using the send button. DevPilot will then provide an answer and display it on the current page.
61-
62-
Select a block of code, then right-click on the "DevPilot" option on the context menu.You can choose from one of:
63-
64-
- New DevPilot Chat
65-
- Generate Tests
66-
- Review Code
67-
- Generate Comments
68-
- Fix This
69-
- Performance Check
70-
- Explain This
71-
72-
![menu](doc/images/screenshot/en/chat_menu.png)
73-
74-
**For example**, select the code, right-click ❯ DevPilot ❯ Fix This.
75-
76-
Then, the window will automatically open and provide relevant suggestions for fixes. You can modify the code based on the suggestions.
77-
78-
## Plugin Functionality
79-
80-
DevPilot provides developers with rich capabilities to help them eliminate the tedious work of writing test cases and comments, write more efficient code, and troubleshoot code issues, among other things.
81-
82-
### Chat with DevPilot
83-
84-
The plugin supports chat, the conversation page can be opened through the right-click menu or the entry on the right sidebar.
85-
86-
![menu chat](doc/images/screenshot/en/menu_chat.png)
87-
88-
You can write questions in the dialogue box, send them by pressing enter or the send button, and OpenAI will provide answers and display them on the current page.
89-
90-
![welcome](doc/images/screenshot/en/welcome.png)
91-
92-
### Generate test cases
93-
94-
Users can generate test cases through our plugin. Users can right-click on a selected method and click "Generate Tests".
95-
96-
![menu testcase](doc/images/screenshot/en/menu_testcase.png)
97-
98-
Afterward, a window will automatically open and the window will return the relevant test cases. Users can directly copy the test or choose to insert or replace the relevant code at the cursor position. They can even create a new test class file.
99-
100-
![testcase result](doc/images/screenshot/en/testcase_result.png)
101-
102-
### Generate comments
103-
104-
Plugin supports the function of generating code comments. Users can right-click and select "Generate comments" after selecting a code block.
105-
106-
![menu gen comments](doc/images/screenshot/en/menu_gen_comments.png)
107-
108-
Afterward, the window will automatically open and return the relevant annotation results. The edited code will also automatically show the generated annotations and the original code in a diff format, allowing users to compare and accept the corresponding annotations.
109-
110-
### Fix bugs
111-
112-
The plugin supports the ability to fix code. Users can right-click on "Fix This" after selecting a code block.
113-
114-
![menu fix bug](doc/images/screenshot/en/menu_fix_bug.png)
115-
116-
Afterward, the window will automatically open and provide relevant repair suggestions. Users can modify their code based on the suggestions.
117-
118-
![fix bugs result](doc/images/screenshot/en/fix_bug_result.png)
119-
120-
### Review code
121-
122-
The plugin supports the ability to review code. Users can right-click on the selected code block and click "Review Code".
123-
124-
![menu code review.png](doc/images/screenshot/en/menu_code_review.png)
125-
126-
Afterward, the window will automatically open and return the relevant review results. Users can edit their code logic based on the results.
127-
128-
![review code result](doc/images/screenshot/en/code_review_result.png)
129-
130-
### Performance Check
131-
132-
The plugin supports performance checking of code. Users can right-click on the selected code block and choose "Performance Check".
133-
134-
![menu performance check](doc/images/screenshot/en/menu_performance_check.png)
135-
136-
Afterward, the window will automatically open and return the relevant performance test results. Additionally, the optimized code and the original code will be automatically compared using diff in the editor, allowing users to optimize their code based on the results.
137-
138-
![performance check result](doc/images/screenshot/en/performance_check_result.png)
139-
140-
### Clear context
141-
142-
The overall capabilities of the plugin are context-dependent, but the context may be polluted, and OpenAI or other large models may have token limitations that result in errors when exceeded. Therefore, we provide the ability to clean up by clicking the clear button in the upper right corner of the window, which will clear the entire session.
143-
144-
![menu clear context](doc/images/screenshot/en/clear_context.png)
145-
146-
## Roadmap
147-
148-
At DevPilot, we are constantly working on expanding the capabilities of our AI-powered plugin to meet the evolving needs of our users. Our roadmap is a reflection of our commitment to continually improve and innovate.
149-
150-
### Near-Term Goals : integration with local LLM
151-
152-
We weill soon support Codellama, an opensource LLM developed by Meta, into DevPilot. This will provide you with the ability to leverage the power of LLM directly in your local development environment, without sending any sensitive data to OpenAI.
153-
154-
With Codellama integration, users can expect:
155-
156-
- More accurate and context-specific code suggestions, Codellama has a 100k context length, so the suggestions it provides will be based on a deeper understanding of the code's context. This will significantly reduce the time developers spend on figuring out the appropriate code to use.
157-
- With its fine-tuning on a large codebase, Codellama can outperform ChatGPT in certain cases.
22+
[DevPilot for JetBrains](https://github.com/openpilot-hub/documentation/blob/main/README_JetBrains_EN.md)
15823

159-
### Long-Term Goals: Model as a Service (MaaS) Support
24+
## RAG
16025

161-
Looking ahead, we plan to extend our capabilities further by supporting Model as a Service (MaaS). MaaS provides the ability for users to utilize AI models in a service-based manner, without the need for local deployment or maintenance. This feature will enable seamless access to the latest AI models without bearing the computational costs or complexities of managing these models locally.
26+
[DevPilot RAG](https://github.com/openpilot-hub/documentation/blob/main/README_RAG_EN.md)
16227

163-
By integrating MaaS into DevPilot, we aim to:
28+
## Build your own plugin
16429

165-
- Access the latest OpenAI models without the hassle of setting up a OpenAI API key.
166-
- Provide a plug-and-play solution for accessing state-of-the-art AI models
167-
- Allow developers to leverage the latest AI advancements without the need for local resources.
168-
- Offer a scalable solution that can grow with your project's needs.
30+
[Build DevPilot](BUILD_PLUGIN.md)
16931

17032
## Contributing
17133

README_ZH.md

Lines changed: 14 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -4,143 +4,44 @@
44

55
## 立即体验
66

7-
使用DevPilot,这个为IntelliJ IDEA专门设计的新型编程伙伴,释放AI在您编程中的强大力量。
7+
使用DevPilot这个为IntelliJ IDEA专门设计的新型编程伙伴释放AI在您编程中的强大力量。
88

99
这个创新的基于AI的插件将会提升您的开发流程。
1010

1111
## 卓越特性
1212

13-
1. **智能代码建议:** 结束编程难点! DevPilot 在你编辑时实时提供代码建议,理解您的上下文并给出精准的建议。
13+
1. **智能代码建议:** 结束编程难点! DevPilot 在你编辑时实时提供代码建议理解您的上下文并给出精准的建议。
1414

15-
2. **主动错误检测:** 避免错误! DevPilot 在错误出现前发现潜在的bug和错误,提供明智的解决方案和替代方法来编写高效、无错误的代码。
15+
2. **主动错误检测:** 避免错误! DevPilot 在错误出现前发现潜在的bug和错误提供明智的解决方案和替代方法来编写高效、无错误的代码。
1616

17-
3. **代码重构:** 提升您的代码! DevPilot 帮助优化代码,提供见解告诉您如何重构和提高代码的结构和性能。
17+
3. **代码重构:** 提升您的代码! DevPilot 帮助优化代码提供见解告诉您如何重构和提高代码的结构和性能。
1818

19-
4. **单元测试生成:** 测试变简单! DevPilot 可以为您生成单元测试代码,确保您的代码不仅可以按预期工作,而且也准备好应对任何未来的更改。
19+
4. **单元测试生成:** 测试变简单! DevPilot 可以为您生成单元测试代码确保您的代码不仅可以按预期工作而且也准备好应对任何未来的更改。
2020

21-
5. **代码解释:** 不仅编写代码,还要理解它! DevPilot 可以解释不熟悉的代码段,帮助您更快地掌握发生的事情并学习。
21+
5. **代码解释:** 不仅编写代码,还要理解它! DevPilot 可以解释不熟悉的代码段帮助您更快地掌握发生的事情并学习。
2222

23-
6. **自动添加注释:** 保持代码清晰易读! DevPilot 可以自动为您的代码添加注释,确保它易于理解和维护。
24-
25-
## 安装插件
26-
27-
目前插件对于idea的版本有要求,最低版本要求为2021.2,建议版本为2022.1以上。
28-
29-
安装插件有两个渠道:
30-
31-
Idea官方市场 - 你可以在Intellij IDEA官方[插件市场](https://plugins.jetbrains.com/plugin/23322-devpilot)下载。
32-
33-
压缩包安装 - 在plugin页面选择设置中的从磁盘安装,之后将zip包导入即可,压缩包下载地址:下载
34-
![install from disk](doc/images/screenshot/cn/install_from_disk.png)
35-
36-
## 配置插件
37-
38-
插件安装成功后,在idea设置页面的Tools中就能找到DevPilot的配置页面
39-
![configuration](doc/images/screenshot/en/config.png)
40-
41-
在配置页面可以切换插件的中英文,以及选择不同模型和模型的地址,用户名则是在对话时在页面展示时使用。
42-
![settings](doc/images/screenshot/cn/settings.png)
23+
6. **自动添加注释:** 保持代码清晰易读! DevPilot 可以自动为您的代码添加注释,确保它易于理解和维护。
4324

4425
## 插件功能
4526

4627
DevPilot为开发者提供了丰富的能力来协助开发者能够省去繁琐的测试用例和注释编写,也能够帮助开发者编写更加高效的代码,同时也能帮助排查代码的问题等等。
4728

48-
### 生成式AI对话
49-
50-
插件支持对话能力,通过右键或者是右边侧边栏的入口可以打开对话的页面
51-
52-
![welcome](doc/images/screenshot/cn/welcome.png)
53-
54-
![menu chat](doc/images/screenshot/cn/menu_chat.png)
55-
56-
在对话框中可以编写问题,通过回车或者是发送按钮进行聊天问题的发送,后续OpenAI会返回回答并在当前页面输出
57-
58-
![chat](doc/images/screenshot/cn/chat.png)
59-
60-
### 生成测试用例
61-
62-
用户可以通过我们插件来生成测试用例。用户选中某个方法右键点击Generate Tests
63-
64-
![menu testcase](doc/images/screenshot/cn/menu_testcase.png)
65-
66-
之后窗口会自动打开然后窗口会返回相关的测试用例,用户可以直接复制测试,或者直接选择在光标处插入或者替换相关的代码,甚至还可以新建测试类文件
67-
68-
![testcase result](doc/images/screenshot/cn/testcase_result.png)
69-
70-
### 生成注释
71-
72-
插件支持代码注释的生成功能。用户选中代码块后右键点击Generate comments
73-
74-
![menu gen comments](doc/images/screenshot/cn/menu_gen_comments.png)
75-
76-
之后窗口自动打开会返回相关的注释结果,并且在编辑器中会自动将生成注释后的结果和原先的代码进行diff,用户可以自行进行比对接受对应的注释。
77-
78-
### 修复代码
79-
80-
插件支持修复代码的能力。用户选中代码块后右键点击Fix This
81-
82-
![menu fix bug](doc/images/screenshot/cn/menu_fix_bug.png)
83-
84-
之后窗口自动打开会返回相关的修复建议,用户可以根据建议修改代码
85-
86-
![fix bug result](doc/images/screenshot/cn/fix_bug_result.png)
87-
88-
### Review 代码
89-
90-
插件支持review代码的能力。用户选中代码块后右键点击Review Code
91-
92-
![menu code review](doc/images/screenshot/cn/menu_code_review.png)
93-
94-
之后窗口自动打开会返回相关的review结果,用户可以根据结果来编辑自己的代码逻辑
95-
96-
![code review result](doc/images/screenshot/cn/code_review_result.png)
97-
98-
### 性能检测
99-
100-
插件支持对代码进行性能检测。用户选中代码块后右键点击Performance Check
101-
102-
![menu performance check](doc/images/screenshot/cn/menu_performance_check.png)
103-
104-
之后窗口自动打开会返回相关的性能检测结果,并且在编辑器中会自动将代码优化后的结果和原先的代码进行diff,用户可以根据结果来优化代码
105-
106-
![performance check result](doc/images/screenshot/cn/performance_check_result.png)
107-
108-
### 清理缓存
109-
110-
插件整体的相关能力都是附带上下文的,但是上下文可能会存在污染这种情况,并且OpenAI或者是其他的大模型都可能会存在token的限制,超出限制会进行报错。因此我们提供清理的能力,在窗口右上角点击清除按钮就可以将当前会话全部清空。
111-
112-
![clear context](doc/images/screenshot/cn/clear_context.png)
113-
114-
## 路线图
115-
116-
在DevPilot,我们一直在不断扩展我们AI驱动的插件的功能,以满足用户不断变化的需求。我们的路线图反映了我们对不断改进和创新的承诺。
117-
118-
### 近期目标:与本地LLM集成
119-
120-
我们很快将支持将Codellama(这是Meta开发的一个开源LLM)集成到DevPilot中。这将使您能够在本地开发环境中利用LLM的力量,而无需将任何敏感数据发送给OpenAI。
121-
122-
通过Codellama集成,用户可以期待:
123-
124-
- 更准确、与上下文相关的代码建议,Codellama具有10万个上下文长度,因此它提供的建议将基于对代码上下文的更深入理解。这将显著减少开发人员在弄清楚适当代码要使用的时间。
125-
- 通过在大规模代码库上进行微调,在某些情况下,Codellama可以胜过ChatGPT。
29+
## 使用文档
12630

127-
Codellama的使用,请参阅[将Codellama部署到您的本地环境](https://github.com/openpilot-hub/codellama-deploy)
31+
[DevPilot JetBrains插件使用文档](https://github.com/openpilot-hub/documentation/blob/main/README_JetBrains.md)
12832

129-
### 长期目标:模型即服务(MaaS)支持
33+
## RAG
13034

131-
展望未来,我们计划通过支持模型即服务(MaaS)进一步扩展我们的功能。MaaS提供了以服务为基础的方式利用AI模型的功能,而无需本地部署或维护。此功能将使最新的AI模型可无缝访问,而无需承担计算成本或在本地管理这些模型的复杂性。
35+
[DevPilot RAG使用说明](https://github.com/openpilot-hub/documentation/blob/main/README_RAG.md)
13236

133-
通过将MaaS集成到DevPilot中,我们旨在:
37+
## 构建自己的插件
13438

135-
- 无需设置OpenAI API密钥即可访问最新的OpenAI模型。
136-
- 提供即插即用的解决方案来访问最先进的AI模型。
137-
- 让开发人员在无需本地资源的情况下利用最新的AI进步。
138-
- 提供可随着项目需求增长而扩展的解决方案。
39+
[构建 DevPilot](BUILD_PLUGIN_ZH.md)
13940

14041
## 贡献
14142

14243
更多信息请查看 [CONTRIBUTING_ZH.md](CONTRIBUTING_ZH.md)
14344

14445
## 联系我们
14546

146-
如果有任何问题或建议,请通过电子邮件联系我们 [pilot_group@zhongan.com](mailto:pilot_group@zhongan.com)
47+
如果有任何问题或建议请通过电子邮件联系我们 [pilot_group@zhongan.com](mailto:pilot_group@zhongan.com)

0 commit comments

Comments
 (0)