Skip to content

Commit f6a0a6a

Browse files
Improve and update README.zh-TW.md (#125)
1 parent aef721e commit f6a0a6a

File tree

1 file changed

+43
-31
lines changed

1 file changed

+43
-31
lines changed

README.zh-TW.md

Lines changed: 43 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,42 @@
1-
# 代碼審查機器人
1+
# 程式碼審查機器人
22

3-
> 由 ChatGPT 提供支持的代碼審查機器人
3+
> 由 ChatGPT 提供支援的程式碼審查機器人
44
5-
翻譯版本:[英語](./README.md)\|[中文簡體](./README.zh-CN.md)\|[中文繁體](./README.zh-TW.md) \| [한국어](./README.ko.md) \| [日本語](./README.ja.md)
5+
翻譯版本:[English](./README.md) | [簡體中文](./README.zh-CN.md) | [繁體中文](./README.zh-TW.md) | [한국어](./README.ko.md) | [日本語](./README.ja.md)
66

7-
## 用法
7+
## 機器人使用方式
8+
9+
❗️⚠️ `由於成本考量,BOT 目前僅用於測試目的,並部署在有限制的 AWS Lambda 上。因此,不穩定的情況是完全正常的。建議自行部署 app。`
810

911
### 安裝
1012

1113
安裝:[apps/cr-gpt](https://github.com/apps/cr-gpt);
1214

13-
### 配置
15+
### 設定
1416

15-
1. 轉到你要集成此機器人的倉庫首頁
16-
2. 點擊`settings`
17-
3. 點擊`actions`在下面`secrets and variables`
18-
4. 切換到`Variables`選項,創建一個新變量`OPENAI_API_KEY`,值為你的 open api 的 key<img width="1465" alt="image" src="https://user-images.githubusercontent.com/13167934/218533628-3974b70f-c423-44b0-b096-d1ec2ace85ea.png">
17+
1. 轉到你要整合此機器人的倉庫首頁
18+
2. 點選 `settings`
19+
3. 點選 `actions` 在下面的 `secrets and variables`
20+
4. 切換到 `Variables` 選項,建立一個新變數 `OPENAI_API_KEY`,值為你的 open api key (如果是 Github Action 整合,則設定在 secrets 中)
21+
<img width="1465" alt="image" src="https://user-images.githubusercontent.com/13167934/218533628-3974b70f-c423-44b0-b096-d1ec2ace85ea.png">
1922

2023
### 開始使用
2124

22-
1. 當你創建一個新的 Pull request 時,機器人會自動進行代碼審查,審查信息將顯示在 pr timeline / file changes 部分。
23-
2. `git push`更新 PR 之後,cr bot 將重新審查更改的文件
25+
1. 當你建立一個新的 Pull request 時,機器人會自動進行程式碼審查,審查訊息將顯示在 pr timeline / file changes 部分。
26+
2. `git push` 更新 Pull request 之後,cr bot 將重新審查更改的文件
2427

25-
例子
28+
範例
2629

2730
[ChatGPT-CodeReview/pull/21](https://github.com/anc95/ChatGPT-CodeReview/pull/21)
2831

2932
<img width="1052" alt="image" src="https://user-images.githubusercontent.com/13167934/218999459-812206e1-d8d2-4900-8ce8-19b5b6e1f5cb.png">
3033

31-
### 使用 Github Action
32-
33-
> 這是推薦的方式,因為 github bot 在一個不起眼的 vps 上服務,我不能確保它總是穩定的
34+
## 使用 Github Actions
3435

3536
[actions/chatgpt-codereviewer](https://github.com/marketplace/actions/chatgpt-codereviewer)
3637

37-
1. 添加`OPENAI_API_KEY`到你的 github action 密鑰
38-
2. 創建`.github/workflows/cr.yml`添加以下內容
38+
1. 新增 `OPENAI_API_KEY` 到你的 github actions secrets
39+
2. 建立 `.github/workflows/cr.yml` 新增以下內容
3940

4041
```yml
4142
name: Code Review
@@ -46,45 +47,56 @@ permissions:
4647

4748
on:
4849
pull_request:
49-
types: [opened, reopened]
50+
types: [opened, reopened, synchronize]
5051

5152
jobs:
5253
test:
54+
# if: ${{ contains(github.event.*.labels.*.name, 'gpt review') }} # Optional; to run only when a label is attached
5355
runs-on: ubuntu-latest
5456
steps:
5557
- uses: anc95/ChatGPT-CodeReview@main
5658
env:
5759
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5860
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
59-
# optional
60-
PROMPT:
61+
# Optional
62+
LANGUAGE: Chinese
63+
OPENAI_API_ENDPOINT: https://api.openai.com/v1
64+
MODEL: gpt-3.5-turbo # https://platform.openai.com/docs/models
65+
PROMPT: # example: Please check if there are any confusions or irregularities in the following code diff:
66+
top_p: 1 # https://platform.openai.com/docs/api-reference/chat/create#chat/create-top_p
67+
temperature: 1 # https://platform.openai.com/docs/api-reference/chat/create#chat/create-temperature
68+
max_tokens: 10000
69+
MAX_PATCH_LENGTH: 10000 # if the patch/diff length is large than MAX_PATCH_LENGTH, will be ignored and won't review. By default, with no MAX_PATCH_LENGTH set, there is also no limit for the patch/diff length.
6170
```
6271
63-
## 自托管
72+
## 自我託管
6473
65-
1. 克隆代碼
66-
2. 復製`.env.example``.env`, 並填寫環境變量
67-
3. 安裝 deps 並運行
74+
1. 複製程式碼
75+
2. 複製 `.env.example``.env`, 並填寫環境變數
76+
3. 安裝相依性並執行
6877

6978
```sh
7079
npm i
71-
npm -i g pm2
80+
npm i -g pm2
7281
npm run build
7382
pm2 start pm2.config.cjs
7483
```
7584

76-
[機器人](https://probot.github.io/docs/development/)了解更多詳情
85+
[probot](https://probot.github.io/docs/development/) 了解更多詳情
7786

7887
## 開發
7988

80-
### 設置
89+
### 設定
8190

8291
```sh
8392
# Install dependencies
8493
npm install
8594
95+
# Build code
96+
npm run build
97+
8698
# Run the bot
87-
npm start
99+
npm run start
88100
```
89101

90102
### Docker
@@ -99,13 +111,13 @@ docker run -e APP_ID=<app-id> -e PRIVATE_KEY=<pem-value> cr-bot
99111

100112
## 貢獻
101113

102-
如果您對如何改進 cr-bot 有建議,或者想報告錯誤,請打開一個問題!我們會喜歡所有的貢獻
114+
如果您對如何改進 cr-bot 有建議,或者想報告錯誤,請開啟一個問題!我們喜歡所有的貢獻
103115

104-
有關更多信息,請查看[投稿指南](CONTRIBUTING.md).
116+
有關更多信息,請查看[貢獻指南](CONTRIBUTING.md).
105117

106118
## 靈感
107119

108-
這個項目的靈感來自[代碼審查.gpt](https://github.com/sturdy-dev/codereview.gpt)
120+
這個項目的靈感來自[codereview.gpt](https://github.com/sturdy-dev/codereview.gpt)
109121

110122
## License
111123

0 commit comments

Comments
 (0)