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

Commit

Permalink
language support (#430)
Browse files Browse the repository at this point in the history
<!-- 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 -->
  • Loading branch information
harjotgill authored Aug 11, 2023
1 parent 71f7e6e commit 8ca204d
Show file tree
Hide file tree
Showing 8 changed files with 125 additions and 125 deletions.
31 changes: 12 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,17 @@

## Overview

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.

# 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
reviews.

CodeRabbit `ai-pr-reviewer` is an AI-based code reviewer and summarizer for
GitHub pull requests using OpenAI's `gpt-3.5-turbo` and `gpt-4` models. It is
designed to be used as a GitHub Action and can be configured to run on every
pull request and review comments

## Reviewer Features:

- **PR Summarization**: It generates a summary and release notes of the changes
in the pull request.
- **Line-by-line code change suggestions**: Reviews the changes line by line and
provides code change suggestions that can be directly committed from the
GitHub UI.
provides code change suggestions.
- **Continuous, incremental reviews**: Reviews are performed on each commit
within a pull request, rather than a one-time review on the entire pull
request.
Expand All @@ -56,7 +47,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,7 +56,13 @@ FAQs, you can refer to the sections below.
- [Contribute](#contribute)
- [FAQs](#faqs)

## Professional Version of CodeRabbit

The professional version of `openai-pr-reviewer` project is now available 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
reviews.

## Install instructions

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'
89 changes: 38 additions & 51 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
Loading

0 comments on commit 8ca204d

Please sign in to comment.