Skip to content

Commit 1b7e578

Browse files
authored
docs(readme): add support for customizable prompt templates and configuration (#229)
- Add support for customizing prompt templates and variables - Introduce `prompt.folder` configuration with a default location - Add detailed instructions on how to customize the default prompt folder - Update OpenAI model configuration value from `gpt-35-turbo` to `gpt-4o` Signed-off-by: appleboy <[email protected]>
1 parent e5e0f69 commit 1b7e578

File tree

2 files changed

+51
-1
lines changed

2 files changed

+51
-1
lines changed

README.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ A CLI written in [Go](https://go.dev) that writes git commit messages or provide
2929
- Supports socks proxy or custom network HTTP proxy.
3030
- Supports [model lists](https://github.com/appleboy/CodeGPT/blob/bf28f000463cfc6dfa2572df61e1b160c5c680f7/openai/openai.go#L18-L38) like `gpt-4`, `gpt-4o`, etc.
3131
- Supports generating a brief code review.
32+
- Supports customizing prompt template and variables.
3233

3334
![code review](./images/code_review.png)
3435

@@ -100,6 +101,30 @@ This will create a `.codegpt.yaml` file in your home directory ($HOME/.config/co
100101
| **openai.top_p** | Default top_p is `1.0`. See reference [top_p](https://platform.openai.com/docs/api-reference/completions/create#completions/create-top_p). |
101102
| **openai.frequency_penalty** | Default frequency_penalty is `0.0`. See reference [frequency_penalty](https://platform.openai.com/docs/api-reference/completions/create#completions/create-frequency_penalty). |
102103
| **openai.presence_penalty** | Default presence_penalty is `0.0`. See reference [presence_penalty](https://platform.openai.com/docs/api-reference/completions/create#completions/create-presence_penalty). |
104+
| **prompt.folder** | Default prompt folder is `$HOME/.config/codegpt/prompt`. |
105+
106+
### How to Customize the Default Prompt Folder
107+
108+
The default prompt folder is located at `$HOME/.config/codegpt/prompt`. You can change this to another directory by executing:
109+
110+
```sh
111+
codegpt config set prompt.folder /path/to/your/prompt
112+
```
113+
114+
To load the prompt files from the custom folder, run:
115+
116+
```sh
117+
codegpt prompt --load
118+
```
119+
120+
Upon execution, you will see messages similar to the following:
121+
122+
```sh
123+
save code_review_file_diff.tmpl to /Users/xxxxx/.config/codegpt/prompt/code_review_file_diff.tmpl
124+
save summarize_file_diff.tmpl to /Users/xxxxx/.config/codegpt/prompt/summarize_file_diff.tmpl
125+
save summarize_title.tmpl to /Users/xxxxx/.config/codegpt/prompt/summarize_title.tmpl
126+
save conventional_commit.tmpl to /Users/xxxxx/.config/codegpt/prompt/conventional_commit.tmpl
127+
```
103128

104129
### How to change to Azure OpenAI Service
105130

@@ -115,7 +140,7 @@ Update your config file.
115140
codegpt config set openai.provider azure
116141
codegpt config set openai.base_url https://xxxxxxxxx.openai.azure.com/
117142
codegpt config set openai.api_key xxxxxxxxxxxxxxxx
118-
codegpt config set openai.model xxxxx-gpt-35-turbo
143+
codegpt config set openai.model xxxxx-gpt-4o
119144
```
120145

121146
### Support [Gemini][60] API Service

README.zh-tw.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
- 支援 socks 代理或自訂網路 HTTP 代理。
3030
- 支援 [模型列表](https://github.com/appleboy/CodeGPT/blob/bf28f000463cfc6dfa2572df61e1b160c5c680f7/openai/openai.go#L18-L38),如 `gpt-4``gpt-4o` 等。
3131
- 支援生成簡要的程式碼審查。
32+
- Supports customizing prompt template and variables.
3233

3334
![code review](./images/code_review.png)
3435

@@ -100,6 +101,30 @@ codegpt config set openai.api_key sk-xxxxxxx
100101
| **openai.top_p** | 默認 top_p 為 `1.0`。參見參考 [top_p](https://platform.openai.com/docs/api-reference/completions/create#completions/create-top_p)|
101102
| **openai.frequency_penalty** | 默認 frequency_penalty 為 `0.0`。參見參考 [frequency_penalty](https://platform.openai.com/docs/api-reference/completions/create#completions/create-frequency_penalty)|
102103
| **openai.presence_penalty** | 默認 presence_penalty 為 `0.0`。參見參考 [presence_penalty](https://platform.openai.com/docs/api-reference/completions/create#completions/create-presence_penalty)|
104+
| **prompt.folder** | 預設提示文件夾位於 `$HOME/.config/codegpt/prompt`|
105+
106+
### 如何自訂預設提示文件夾
107+
108+
預設提示文件夾位於 `$HOME/.config/codegpt/prompt`。您可以通過執行以下命令將其更改為其他目錄:
109+
110+
```sh
111+
codegpt config set prompt.folder /path/to/your/prompt
112+
```
113+
114+
要從自訂文件夾加載提示文件,請運行:
115+
116+
```sh
117+
codegpt prompt --load
118+
```
119+
120+
執行後,您將看到類似以下的消息:
121+
122+
```sh
123+
save code_review_file_diff.tmpl to /Users/xxxxx/.config/codegpt/prompt/code_review_file_diff.tmpl
124+
save summarize_file_diff.tmpl to /Users/xxxxx/.config/codegpt/prompt/summarize_file_diff.tmpl
125+
save summarize_title.tmpl to /Users/xxxxx/.config/codegpt/prompt/summarize_title.tmpl
126+
save conventional_commit.tmpl to /Users/xxxxx/.config/codegpt/prompt/conventional_commit.tmpl
127+
```
103128

104129
### 如何切換到 Azure OpenAI 服務
105130

0 commit comments

Comments
 (0)