Skip to content

Commit d3ce0ed

Browse files
committed
feat: add custom action to prompt
1 parent b94ccc0 commit d3ce0ed

File tree

1 file changed

+29
-23
lines changed

1 file changed

+29
-23
lines changed

README.md

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ features:
3737
best code.
3838
- Related code. Based on recently file changes, AutoDev will call calculate similar chunk to generate best code.
3939
- AI assistant. AutoDev will help you find bug, explain code, trace exception, generate commits, and more.
40-
- Custom prompt. You can customize your prompt in `Settings` -> `Tools` -> `AutoDev`
40+
- Custom prompt.
41+
- Custom spec
42+
- Custom intention action.
4143
- Custom LLM Server. You can customize your LLM Server in `Settings` -> `Tools` -> `AutoDev`
4244
- Auto Testing. create unit test intention, auto run unit test and try to fix test.
4345

@@ -55,40 +57,44 @@ You can:
5557

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

58-
### Custom prompt
60+
### Custom Action
61+
62+
![Code completion](https://unitmesh.cc/auto-dev/custom-action.png)
63+
64+
You can customize your prompt in `Settings` -> `Tools` -> `AutoDev`
5965

6066
```json
6167
{
62-
"auto_complete": {
63-
"instruction": "",
64-
"input": ""
65-
},
66-
"auto_comment": {
67-
"instruction": "",
68-
"input": ""
69-
},
70-
"code_review": {
71-
"instruction": "",
72-
"input": ""
73-
},
74-
"refactor": {
75-
"instruction": "",
76-
"input": ""
77-
},
78-
"write_test": {
79-
"instruction": "",
80-
"input": ""
81-
},
8268
"spec": {
8369
"controller": "- 在 Controller 中使用 BeanUtils.copyProperties 进行 DTO 转换 Entity\n- 禁止使用 Autowired\n-使用 Swagger Annotation 表明 API 含义\n-Controller 方法应该捕获并处理业务异常,不应该抛出系统异常。",
8470
"service": "- Service 层应该使用构造函数注入或者 setter 注入,不要使用 @Autowired 注解注入。",
8571
"entity": "- Entity 类应该使用 JPA 注解进行数据库映射\n- 实体类名应该与对应的数据库表名相同。实体类应该使用注解标记主键和表名,例如:@Id、@GeneratedValue、@Table 等。",
8672
"repository": "- Repository 接口应该继承 JpaRepository 接口,以获得基本的 CRUD 操作",
8773
"ddl": "- 字段应该使用 NOT NULL 约束,确保数据的完整性"
88-
}
74+
},
75+
"prompts": [
76+
{
77+
"title": "Code complete",
78+
"autoInvoke": true,
79+
"matchRegex": ".*",
80+
"template": "Code complete:\n${SPEC_controller}\n\n${SELECTION}"
81+
},
82+
{
83+
"title": "Translate to Kotlin",
84+
"autoInvoke": false,
85+
"matchRegex": ".*",
86+
"template": "Translate follow code to Kotlin \n${SELECTION}"
87+
}
88+
]
8989
}
9090
```
9191

92+
- title: the action name
93+
- autoInvoke: auto invoke this action when you perform action
94+
- matchRegex: TODO()
95+
- template: the template of the action, you can use `${SPEC_controller}` to insert spec, `${SELECTION}` to insert
96+
selected code.
97+
9298
### AutoCRUD mode
9399

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

0 commit comments

Comments
 (0)