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

language support #430

Merged
merged 6 commits into from
Aug 11, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 5 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,16 @@

CodeRabbit `ai-pr-reviewer` is an open-source project built on AI, designed to
enhance developer productivity and efficiency by performing automated reviews of
pull requests.
pull requests.

# Professional Version of CodeRabbit
# Professional Version of CodeRabbit

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


## Reviewer Features:

- **PR Summarization**: It generates a summary and release notes of the changes
Expand Down Expand Up @@ -56,7 +55,6 @@ configure the required environment variables, such as `GITHUB_TOKEN` and
`OPENAI_API_KEY`. For more information on usage, examples, contributing, and
FAQs, you can refer to the sections below.


- [Overview](#overview)
- [Professional Version of CodeRabbit](#professional-version-of-coderabbit)
- [Reviewer Features](#reviewer-features)
Expand All @@ -66,8 +64,6 @@ FAQs, you can refer to the sections below.
- [Contribute](#contribute)
- [FAQs](#faqs)



## Install instructions

`ai-pr-reviewer` runs as a GitHub Action. Add the below file to your repository
Expand Down Expand Up @@ -195,13 +191,10 @@ Some of the reviews done by ai-pr-reviewer

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


![PR Release Notes](./docs/images/ReleaseNotes.png)


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


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

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

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

Install the dependencies

Expand Down
42 changes: 38 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ inputs:
!**/*.gz
!**/*.xz
!**/*.zip
!**/*.7z
!**/*.rar
!**/*.zst
!**/*.ico
!**/*.jar
Expand All @@ -56,18 +58,41 @@ inputs:
!**/*.lo
!**/*.log
!**/*.mp3
!**/*.wav
!**/*.wma
!**/*.mp4
!**/*.avi
!**/*.mkv
!**/*.wmv
!**/*.m4a
!**/*.m4v
!**/*.3gp
!**/*.3g2
!**/*.rm
!**/*.mov
!**/*.flv
!**/*.iso
!**/*.swf
!**/*.flac
!**/*.nar
!**/*.o
!**/*.ogg
!**/*.otf
!**/*.p
!**/*.pdf
!**/*.doc
!**/*.docx
!**/*.xls
!**/*.xlsx
!**/*.ppt
!**/*.pptx
!**/*.pkl
!**/*.pickle
!**/*.pyc
!**/*.pyd
!**/*.pyo
!**/*.pub
!**/*.pem
!**/*.rkt
!**/*.so
!**/*.ss
Expand All @@ -91,17 +116,26 @@ inputs:
!**/*.jpg
!**/*.png
!**/*.gif
!**/*.bmp
!**/*.tiff
!**/*.webm
!**/*.woff
!**/*.woff2
!**/*.dot
!**/*.md5sum
!**/*.wasm
!**/*.snap
!**/*.parquet
!**/gen/**
!**/_gen/**
!**/generated/**
!**/@generated/**
!**/vendor/**
!**/*.min.js
!**/*.min.js.map
!**/*.min.js.css
!**/*.tfstate
!**/*.tfstate.backup
disable_review:
required: false
description: 'Only provide the summary and skip the code review.'
Expand Down Expand Up @@ -195,10 +229,10 @@ inputs:
"New Feature: An integrations page was added to the UI". Keep your
response within 50-100 words. Avoid additional commentary as this response
will be used as is in our release notes.

Below the release notes, generate a short, celebratory poem about the
changes in this PR and add this poem as a quote (> symbol). You can
use emojis in the poem, where they are relevant.
language:
required: false
description: ISO code for the response language
default: en-US
runs:
using: 'node16'
main: 'dist/index.js'
27 changes: 18 additions & 9 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ export class Bot {
const currentDate = new Date().toISOString().split('T')[0]
const systemMessage = `${options.systemMessage}
Knowledge cutoff: ${openaiOptions.tokenLimits.knowledgeCutOff}
Current date: ${currentDate}`
Current date: ${currentDate}

IMPORTANT: Entire response must be in the language with ISO code: ${options.language}
`

this.api = new ChatGPTAPI({
apiBaseUrl: options.apiBaseUrl,
Expand Down
3 changes: 2 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ async function run(): Promise<void> {
getInput('openai_timeout_ms'),
getInput('openai_concurrency_limit'),
getInput('github_concurrency_limit'),
getInput('openai_base_url')
getInput('openai_base_url'),
getInput('language')
)

// print options
Expand Down
6 changes: 5 additions & 1 deletion src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export class Options {
lightTokenLimits: TokenLimits
heavyTokenLimits: TokenLimits
apiBaseUrl: string
language: string

constructor(
debug: boolean,
Expand All @@ -38,7 +39,8 @@ export class Options {
openaiTimeoutMS = '120000',
openaiConcurrencyLimit = '6',
githubConcurrencyLimit = '6',
apiBaseUrl = 'https://api.openai.com/v1'
apiBaseUrl = 'https://api.openai.com/v1',
language = 'en-US'
) {
this.debug = debug
this.disableReview = disableReview
Expand All @@ -58,6 +60,7 @@ export class Options {
this.lightTokenLimits = new TokenLimits(openaiLightModel)
this.heavyTokenLimits = new TokenLimits(openaiHeavyModel)
this.apiBaseUrl = apiBaseUrl
this.language = language
}

// print all options using core.info
Expand All @@ -80,6 +83,7 @@ export class Options {
info(`summary_token_limits: ${this.lightTokenLimits.string()}`)
info(`review_token_limits: ${this.heavyTokenLimits.string()}`)
info(`api_base_url: ${this.apiBaseUrl}`)
info(`language: ${this.language}`)
}

checkPath(path: string): boolean {
Expand Down