Skip to content
This repository was archived by the owner on Mar 6, 2024. It is now read-only.

Commit 8ca204d

Browse files
authored
language support (#430)
<!-- This is an auto-generated comment: release notes by OSS CodeRabbit --> ### Summary by CodeRabbit ``` **New Features:** - Added a new input parameter `language` to the `run()` function, allowing users to specify the language ISO code. **Bug Fixes:** - Fixed syntax error in the `add` function. - Improved logic in `complex_function`. **Documentation:** - Updated project documentation and instructions in README.md. - Enhanced review comment guidelines for better clarity. **Refactor:** - Refactored rendering and summarizing of file diffs in `review.ts`. - Updated `Options` class to include a new property `language`. **Chore:** - Updated Node.js version requirement to 17+. - Added exclusion patterns for additional file extensions in GitHub PR workflow. ``` <!-- end of auto-generated comment: release notes by OSS CodeRabbit -->
1 parent 71f7e6e commit 8ca204d

File tree

8 files changed

+125
-125
lines changed

8 files changed

+125
-125
lines changed

README.md

+12-19
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,17 @@
1010

1111
## Overview
1212

13-
CodeRabbit `ai-pr-reviewer` is an open-source project built on AI, designed to
14-
enhance developer productivity and efficiency by performing automated reviews of
15-
pull requests.
16-
17-
# Professional Version of CodeRabbit
18-
19-
The professional version of our openai-pr-reviewer project is now live at
20-
[coderabbit.ai](http://Coderabbit.ai). Building upon our open-source foundation,
21-
CodeRabbit offers premium features including enhanced context and superior
22-
noise reduction, dedicated support, and our ongoing commitment to improve code
23-
reviews.
24-
13+
CodeRabbit `ai-pr-reviewer` is an AI-based code reviewer and summarizer for
14+
GitHub pull requests using OpenAI's `gpt-3.5-turbo` and `gpt-4` models. It is
15+
designed to be used as a GitHub Action and can be configured to run on every
16+
pull request and review comments
2517

2618
## Reviewer Features:
2719

2820
- **PR Summarization**: It generates a summary and release notes of the changes
2921
in the pull request.
3022
- **Line-by-line code change suggestions**: Reviews the changes line by line and
31-
provides code change suggestions that can be directly committed from the
32-
GitHub UI.
23+
provides code change suggestions.
3324
- **Continuous, incremental reviews**: Reviews are performed on each commit
3425
within a pull request, rather than a one-time review on the entire pull
3526
request.
@@ -56,7 +47,6 @@ configure the required environment variables, such as `GITHUB_TOKEN` and
5647
`OPENAI_API_KEY`. For more information on usage, examples, contributing, and
5748
FAQs, you can refer to the sections below.
5849

59-
6050
- [Overview](#overview)
6151
- [Professional Version of CodeRabbit](#professional-version-of-coderabbit)
6252
- [Reviewer Features](#reviewer-features)
@@ -66,7 +56,13 @@ FAQs, you can refer to the sections below.
6656
- [Contribute](#contribute)
6757
- [FAQs](#faqs)
6858

59+
## Professional Version of CodeRabbit
6960

61+
The professional version of `openai-pr-reviewer` project is now available at
62+
[coderabbit.ai](http://Coderabbit.ai). Building upon our open-source foundation,
63+
CodeRabbit offers premium features including enhanced context and superior noise
64+
reduction, dedicated support, and our ongoing commitment to improve code
65+
reviews.
7066

7167
## Install instructions
7268

@@ -195,13 +191,10 @@ Some of the reviews done by ai-pr-reviewer
195191

196192
![PR Summary](./docs/images/PRSummary.png)
197193

198-
199194
![PR Release Notes](./docs/images/ReleaseNotes.png)
200195

201-
202196
![PR Review](./docs/images/section-1.png)
203197

204-
205198
![PR Conversation](./docs/images/section-3.png)
206199

207200
Any suggestions or pull requests for improving the prompts are highly
@@ -212,7 +205,7 @@ appreciated.
212205
### Developing
213206

214207
> First, you'll need to have a reasonably modern version of `node` handy, tested
215-
> with node 16.
208+
> with node 17+.
216209

217210
Install the dependencies
218211

action.yml

+38-4
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ inputs:
4848
!**/*.gz
4949
!**/*.xz
5050
!**/*.zip
51+
!**/*.7z
52+
!**/*.rar
5153
!**/*.zst
5254
!**/*.ico
5355
!**/*.jar
@@ -56,18 +58,41 @@ inputs:
5658
!**/*.lo
5759
!**/*.log
5860
!**/*.mp3
61+
!**/*.wav
62+
!**/*.wma
5963
!**/*.mp4
64+
!**/*.avi
65+
!**/*.mkv
66+
!**/*.wmv
67+
!**/*.m4a
68+
!**/*.m4v
69+
!**/*.3gp
70+
!**/*.3g2
71+
!**/*.rm
72+
!**/*.mov
73+
!**/*.flv
74+
!**/*.iso
75+
!**/*.swf
76+
!**/*.flac
6077
!**/*.nar
6178
!**/*.o
6279
!**/*.ogg
6380
!**/*.otf
6481
!**/*.p
6582
!**/*.pdf
83+
!**/*.doc
84+
!**/*.docx
85+
!**/*.xls
86+
!**/*.xlsx
87+
!**/*.ppt
88+
!**/*.pptx
6689
!**/*.pkl
6790
!**/*.pickle
6891
!**/*.pyc
6992
!**/*.pyd
7093
!**/*.pyo
94+
!**/*.pub
95+
!**/*.pem
7196
!**/*.rkt
7297
!**/*.so
7398
!**/*.ss
@@ -91,17 +116,26 @@ inputs:
91116
!**/*.jpg
92117
!**/*.png
93118
!**/*.gif
119+
!**/*.bmp
120+
!**/*.tiff
94121
!**/*.webm
95122
!**/*.woff
96123
!**/*.woff2
97124
!**/*.dot
98125
!**/*.md5sum
99126
!**/*.wasm
100127
!**/*.snap
128+
!**/*.parquet
101129
!**/gen/**
102130
!**/_gen/**
103131
!**/generated/**
132+
!**/@generated/**
104133
!**/vendor/**
134+
!**/*.min.js
135+
!**/*.min.js.map
136+
!**/*.min.js.css
137+
!**/*.tfstate
138+
!**/*.tfstate.backup
105139
disable_review:
106140
required: false
107141
description: 'Only provide the summary and skip the code review.'
@@ -195,10 +229,10 @@ inputs:
195229
"New Feature: An integrations page was added to the UI". Keep your
196230
response within 50-100 words. Avoid additional commentary as this response
197231
will be used as is in our release notes.
198-
199-
Below the release notes, generate a short, celebratory poem about the
200-
changes in this PR and add this poem as a quote (> symbol). You can
201-
use emojis in the poem, where they are relevant.
232+
language:
233+
required: false
234+
description: ISO code for the response language
235+
default: en-US
202236
runs:
203237
using: 'node16'
204238
main: 'dist/index.js'

dist/index.js

+38-51
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/bot.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ export class Bot {
2828
const currentDate = new Date().toISOString().split('T')[0]
2929
const systemMessage = `${options.systemMessage}
3030
Knowledge cutoff: ${openaiOptions.tokenLimits.knowledgeCutOff}
31-
Current date: ${currentDate}`
31+
Current date: ${currentDate}
32+
33+
IMPORTANT: Entire response must be in the language with ISO code: ${options.language}
34+
`
3235

3336
this.api = new ChatGPTAPI({
3437
apiBaseUrl: options.apiBaseUrl,

src/main.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ async function run(): Promise<void> {
2828
getInput('openai_timeout_ms'),
2929
getInput('openai_concurrency_limit'),
3030
getInput('github_concurrency_limit'),
31-
getInput('openai_base_url')
31+
getInput('openai_base_url'),
32+
getInput('language')
3233
)
3334

3435
// print options

0 commit comments

Comments
 (0)