Skip to content

Commit

Permalink
feat: add custom action to prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Aug 8, 2023
1 parent b94ccc0 commit d3ce0ed
Showing 1 changed file with 29 additions and 23 deletions.
52 changes: 29 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ features:
best code.
- Related code. Based on recently file changes, AutoDev will call calculate similar chunk to generate best code.
- AI assistant. AutoDev will help you find bug, explain code, trace exception, generate commits, and more.
- Custom prompt. You can customize your prompt in `Settings` -> `Tools` -> `AutoDev`
- Custom prompt.
- Custom spec
- Custom intention action.
- Custom LLM Server. You can customize your LLM Server in `Settings` -> `Tools` -> `AutoDev`
- Auto Testing. create unit test intention, auto run unit test and try to fix test.

Expand All @@ -55,40 +57,44 @@ You can:

![Code completion](https://unitmesh.cc/auto-dev/completion-mode.png)

### Custom prompt
### Custom Action

![Code completion](https://unitmesh.cc/auto-dev/custom-action.png)

You can customize your prompt in `Settings` -> `Tools` -> `AutoDev`

```json
{
"auto_complete": {
"instruction": "",
"input": ""
},
"auto_comment": {
"instruction": "",
"input": ""
},
"code_review": {
"instruction": "",
"input": ""
},
"refactor": {
"instruction": "",
"input": ""
},
"write_test": {
"instruction": "",
"input": ""
},
"spec": {
"controller": "- 在 Controller 中使用 BeanUtils.copyProperties 进行 DTO 转换 Entity\n- 禁止使用 Autowired\n-使用 Swagger Annotation 表明 API 含义\n-Controller 方法应该捕获并处理业务异常,不应该抛出系统异常。",
"service": "- Service 层应该使用构造函数注入或者 setter 注入,不要使用 @Autowired 注解注入。",
"entity": "- Entity 类应该使用 JPA 注解进行数据库映射\n- 实体类名应该与对应的数据库表名相同。实体类应该使用注解标记主键和表名,例如:@Id、@GeneratedValue、@Table 等。",
"repository": "- Repository 接口应该继承 JpaRepository 接口,以获得基本的 CRUD 操作",
"ddl": "- 字段应该使用 NOT NULL 约束,确保数据的完整性"
}
},
"prompts": [
{
"title": "Code complete",
"autoInvoke": true,
"matchRegex": ".*",
"template": "Code complete:\n${SPEC_controller}\n\n${SELECTION}"
},
{
"title": "Translate to Kotlin",
"autoInvoke": false,
"matchRegex": ".*",
"template": "Translate follow code to Kotlin \n${SELECTION}"
}
]
}
```

- title: the action name
- autoInvoke: auto invoke this action when you perform action
- matchRegex: TODO()
- template: the template of the action, you can use `${SPEC_controller}` to insert spec, `${SELECTION}` to insert
selected code.

### AutoCRUD mode

1. add `// devti://story/github/1` comments in your code.
Expand Down

0 comments on commit d3ce0ed

Please sign in to comment.