Skip to content

Commit

Permalink
Improve README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaopengjun committed Nov 30, 2023
1 parent c793e6a commit 6158cf6
Show file tree
Hide file tree
Showing 36 changed files with 266 additions and 18 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Welcome to DevPilot intellij plugin repository. We are glad you are here!

Everyone is welcome to contribute to this repository.
Everyone is welcome to contribute to this repository.

### Requirements

Expand All @@ -24,4 +24,4 @@ Java 11 or higher version is required to build and test this repository.

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

`./gradlew check`
`./gradlew check`
145 changes: 129 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Welcome to DevPilot: Your pair programming partner makes you a greater navigator

[English](README.md) | [中文](README_ZH.md)

## Take a Glimpse

Unleash the power of AI in your coding with DevPilot, your new coding buddy, designed exclusively for IntelliJ IDEA.
Expand All @@ -8,30 +10,139 @@ This innovative AI-based plugin is set to supercharge your development process.

## Stellar Features

1. **Intelligent Code Suggestions:** Say goodbye to coding roadblocks! DevPilot dishes out real-time code suggestions as you type, understanding your context and serving up precise recommendations.
2. **Proactive Bug Detection:** Keep bugs at bay! DevPilot spots potential bugs and errors before they become a problem, offering smart solutions and alternatives for efficient, error-free code.
3. **Code Refactoring:** Level up your code! DevPilot helps optimize your code, providing insights on how to refactor and boost your code's structure and performance.
4. **Unit Test Generation:** Testing made easy! DevPilot can generate unit testing code for you, making sure your code not only works as expected but is also ready for any future changes.
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.
6. **Auto-Comments:** Keep your code clear! DevPilot can automatically add comments to your code, ensuring it's easy to understand and maintain.
1. **Intelligent Code Suggestions:** Say goodbye to coding roadblocks! DevPilot dishes out real-time code suggestions as you type, understanding your context and serving up precise recommendations.
2. **Proactive Bug Detection:** Keep bugs at bay! DevPilot spots potential bugs and errors before they become a problem, offering smart solutions and alternatives for efficient, error-free code.
3. **Code Refactoring:** Level up your code! DevPilot helps optimize your code, providing insights on how to refactor and boost your code's structure and performance.
4. **Unit Test Generation:** Testing made easy! DevPilot can generate unit testing code for you, making sure your code not only works as expected but is also ready for any future changes.
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.
6. **Auto-Comments:** Keep your code clear! DevPilot can automatically add comments to your code, ensuring it's easy to understand and maintain.

## Prerequisites

1. You will need an OpenAI API key / Codellama API endpoint before you use this plugin.
2. For use of Codellama, see [deploy Codellama into you local environment](https://github.com/openpilot-hub/codellama-deploy).

## Installation

There are three ways for installing plugins:

- idea official marketplace - currently in the beta testing phase and not yet available on the market. It will be available on the market after the release of the official version.

- 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]().
![img.png](doc/images/screenshot/cn/install_from_disk.png)
- Build from scratch
1. Clone this repository to your local machine.
`git clone https://github.com/openpilot-hub/devpilot-intellij.git`
2. Run the following command to build the project.

`./gradlew runIde`

If you are using windows, run the following command to build the project.

`gradlew.bat runIde`

## Configuration

After the successful installation of the plugin, you can find the configuration page of DevPilot in the Tools section of the IDEA settings page.
open the settings with <kbd>command</kbd>+<kbd>,</kbd>,

then navigate to Tools ❯ DevPilot ❯ Service Configuration.

![configuration](doc/images/screenshot/en/config.png)

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.
![settings](doc/images/screenshot/en/settings.png)

## How to use

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.

Select a block of code, then right click on the &quot;DevPilot&quot; option on the context menu.You can choose from one of:
Select a block of code, then right-click on the "DevPilot" option on the context menu.You can choose from one of:

* New DevPilot Chat
* Generate Tests
* Review Code
* Generate Comments
* Fix This
* Performance Check
* Explain This
- New DevPilot Chat
- Generate Tests
- Review Code
- Generate Comments
- Fix This
- Performance Check
- Explain This

**For example**, select the code, right-click `->` DevPilot `->` Fix This.
![img.png](doc/images/screenshot/en/chat_menu.png)

**For example**, select the code, right-click ❯ DevPilot ❯ Fix This.

Then, the window will automatically open and provide relevant suggestions for fixes. You can modify the code based on the suggestions.

## Plugin Functionality

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.

### Chat with DevPilot

The plugin supports chat, the conversation page can be opened through the right-click menu or the entry on the right sidebar.

![menu chat](doc/images/screenshot/en/menu_chat.png)

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.

![welcome](doc/images/screenshot/en/welcome.png)

### Generate test cases

Users can generate test cases through our plugin. Users can right-click on a selected method and click "Generate Tests".

![menu testcase](doc/images/screenshot/en/menu_testcase.png)

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.

![testcase result](doc/images/screenshot/en/testcase_result.png)

### Generate comments

Plugin supports the function of generating code comments. Users can right-click and select "Generate comments" after selecting a code block.

![menu gen comments](doc/images/screenshot/en/menu_gen_comments.png)

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.

### Fix bugs

The plugin supports the ability to fix code. Users can right-click on "Fix This" after selecting a code block.

![menu fix bug](doc/images/screenshot/en/menu_fix_bug.png)

Afterward, the window will automatically open and provide relevant repair suggestions. Users can modify their code based on the suggestions.

![fix bugs result](doc/images/screenshot/en/fix_bug_result.png)

### Review code

The plugin supports the ability to review code. Users can right-click on the selected code block and click "Review Code".

![menu code review.png](doc/images/screenshot/en/menu_code_review.png)

Afterward, the window will automatically open and return the relevant review results. Users can edit their code logic based on the results.


![review code result](doc/images/screenshot/en/code_review_result.png)

### Performance Check

The plugin supports performance checking of code. Users can right-click on the selected code block and choose "Performance Check".

![menu performance check](doc/images/screenshot/en/menu_performance_check.png)

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.

![performance check result](doc/images/screenshot/en/performance_check_result.
png)

### Clear context

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.

![menu clear context](doc/images/screenshot/en/clear_context.png)

## Roadmap

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.
Expand All @@ -50,14 +161,16 @@ With Codellama integration, users can expect:
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.

By integrating MaaS into DevPilot, we aim to:

- Access the latest OpenAI models without the hassle of setting up a OpenAI API key.
- Provide a plug-and-play solution for accessing state-of-the-art AI models
- Allow developers to leverage the latest AI advancements without the need for local resources.
- Offer a scalable solution that can grow with your project's needs.

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md) for more information.

## Ping Us

Got questions or suggestions, please contact us via email at [[email protected]](mailto:za).
Got questions or suggestions, please contact us via email at [[email protected]](mailto:[email protected]).
135 changes: 135 additions & 0 deletions README_ZH.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# 欢迎使用DevPilot: 您的程序伙伴助您成为更出色的开发者

[English](README.md) | [中文](README_ZH.md)

## 立即体验

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

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

## 卓越特性

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

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

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

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

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

6. **自动添加注释:** 保持代码清晰易读!DevPilot可以自动为您的代码添加注释,确保它易于理解和维护。

## 安装插件

目前插件对于idea的版本有要求,最低版本要求为2021.2,建议版本为2022.1以上

安装插件有两个渠道:

idea官方市场 - 目前内测阶段暂时未上架,后续release正式版本后会上架到市场
压缩包安装 - 在plugin页面选择设置中的从磁盘安装,之后将zip包导入即可,压缩包下载地址:下载
![img.png](doc/images/screenshot/cn/install_from_disk.png)

## 配置插件
插件安装成功后,在idea设置页面的Tools中就能找到DevPilot的配置页面
![img_1.png](doc/images/screenshot/en/config.png)

在配置页面可以切换插件的中英文,以及选择不同模型和模型的地址,用户名则是在对话时在页面展示时使用。
![img_19.png](doc/images/screenshot/cn/settings.png)

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

### 生成式AI对话
插件支持对话能力,通过右键或者是右边侧边栏的入口可以打开对话的页面

![img_20.png](doc/images/screenshot/cn/welcome.png)

![img_5.png](doc/images/screenshot/cn/menu_chat.png)

在对话框中可以编写问题,通过回车或者是发送按钮进行聊天问题的发送,后续OpenAI会返回回答并在当前页面输出

![img_6.png](doc/images/screenshot/cn/chat.png)

### 生成测试用例
用户可以通过我们插件来生成测试用例。用户选中某个方法右键点击Generate Tests

![img_7.png](doc/images/screenshot/cn/menu_testcase.png)

之后窗口会自动打开然后窗口会返回相关的测试用例,用户可以直接复制测试,或者直接选择在光标处插入或者替换相关的代码,甚至还可以新建测试类文件

![img_8.png](doc/images/screenshot/cn/testcase_result.png)

### 生成注释
插件支持代码注释的生成功能。用户选中代码块后右键点击Generate comments

![img_9.png](doc/images/screenshot/cn/menu_gen_comments.png)

之后窗口自动打开会返回相关的注释结果,并且在编辑器中会自动将生成注释后的结果和原先的代码进行diff,用户可以自行进行比对接受对应的注释。

### 修复代码
插件支持修复代码的能力。用户选中代码块后右键点击Fix This

![img_10.png](doc/images/screenshot/cn/menu_fix_bug.png)

之后窗口自动打开会返回相关的修复建议,用户可以根据建议修改代码

![img_11.png](doc/images/screenshot/cn/fix_bug_result.png)

### review代码
插件支持review代码的能力。用户选中代码块后右键点击Review Code

![img_12.png](doc/images/screenshot/cn/menu_code_review.png)

之后窗口自动打开会返回相关的review结果,用户可以根据结果来编辑自己的代码逻辑

![img_13.png](doc/images/screenshot/cn/code_review_result.png)

### 性能检测
插件支持对代码进行性能检测。用户选中代码块后右键点击Performance Check

![img_14.png](doc/images/screenshot/cn/menu_performance_check.png)

之后窗口自动打开会返回相关的性能检测结果,并且在编辑器中会自动将代码优化后的结果和原先的代码进行diff,用户可以根据结果来优化代码

![img_15.png](doc/images/screenshot/cn/performance_check_result.png)

### 清理缓存
插件整体的相关能力都是附带上下文的,但是上下文可能会存在污染这种情况,并且OpenAI或者是其他的大模型都可能会存在token的限制,超出限制会进行报错。因此我们提供清理的能力,在窗口右上角点击清除按钮就可以将当前会话全部清空。

![img_16.png](doc/images/screenshot/cn/clear_context.png)


## 路线图

在DevPilot,我们一直在不断扩展我们AI驱动的插件的功能,以满足用户不断变化的需求。我们的路线图反映了我们对不断改进和创新的承诺。

### 近期目标:与本地LLM集成

我们很快将支持将Codellama(这是Meta开发的一个开源LLM)集成到DevPilot中。这将使您能够在本地开发环境中利用LLM的力量,而无需将任何敏感数据发送给OpenAI。

通过Codellama集成,用户可以期待:
- 更准确、与上下文相关的代码建议,Codellama具有10万个上下文长度,因此它提供的建议将基于对代码上下文的更深入理解。这将显著减少开发人员在弄清楚适当代码要使用的时间。
- 通过在大规模代码库上进行微调,在某些情况下,Codellama可以胜过ChatGPT。

Codellama的使用,请参阅[将Codellama部署到您的本地环境](https://github.com/openpilot-hub/codellama-deploy)

### 长期目标:模型即服务(MaaS)支持

展望未来,我们计划通过支持模型即服务(MaaS)进一步扩展我们的功能。MaaS提供了以服务为基础的方式利用AI模型的功能,而无需本地部署或维护。此功能将使最新的AI模型可无缝访问,而无需承担计算成本或在本地管理这些模型的复杂性。

通过将MaaS集成到DevPilot中,我们旨在:
- 无需设置OpenAI API密钥即可访问最新的OpenAI模型。
- 提供即插即用的解决方案来访问最先进的AI模型。
- 让开发人员在无需本地资源的情况下利用最新的AI进步。
- 提供可随着项目需求增长而扩展的解决方案。

## 贡献

更多信息请查看 [CONTRIBUTING.md](CONTRIBUTING.md)

## 联系我们

如果有任何问题或建议,请通过电子邮件联系我们 [[email protected]](mailto:[email protected])
Binary file added doc/images/screenshot/cn/chat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/screenshot/cn/chat2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/screenshot/cn/clear_context.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/screenshot/cn/code_review_result.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/screenshot/cn/fix_bug_result.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/screenshot/cn/install_from_disk.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/screenshot/cn/menu_chat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/screenshot/cn/menu_code_review.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/screenshot/cn/menu_fix_bug.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/screenshot/cn/menu_gen_comments.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/screenshot/cn/menu_testcase.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/screenshot/cn/settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/screenshot/cn/testcase_result.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/screenshot/cn/welcome.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/screenshot/en/chat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/screenshot/en/chat2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/screenshot/en/chat_menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/screenshot/en/clear_context.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/screenshot/en/code_review_result.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/screenshot/en/config.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/screenshot/en/fix_bug_result.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/screenshot/en/menu_chat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/screenshot/en/menu_code_review.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/screenshot/en/menu_fix_bug.png
Binary file added doc/images/screenshot/en/menu_gen_comments.png
Binary file added doc/images/screenshot/en/menu_testcase.png
Binary file added doc/images/screenshot/en/settings.png
Binary file added doc/images/screenshot/en/testcase_result.png
Binary file added doc/images/screenshot/en/welcome.png

0 comments on commit 6158cf6

Please sign in to comment.