repo_name
stringlengths
1
62
dataset
stringclasses
1 value
lang
stringclasses
11 values
pr_id
int64
1
20.1k
owner
stringlengths
2
34
reviewer
stringlengths
2
39
diff_hunk
stringlengths
15
262k
code_review_comment
stringlengths
1
99.6k
ai-pr-reviewer
github_2023
typescript
521
coderabbitai
github-actions[bot]
@@ -84,6 +93,9 @@ export class Options { info(`review_token_limits: ${this.heavyTokenLimits.string()}`) info(`api_base_url: ${this.apiBaseUrl}`) info(`language: ${this.language}`) + info(`azureApiInstance: ${this.azureApiInstance}`) + info(`azureApiDeployment: ${this.azureApiDeployment}`) + info(`azureApiVersion: ${this.azureApiVersion}`)
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit While it's good to log the values of `azureApiInstance`, `azureApiDeployment`, and `azureApiVersion` for debugging purposes, it's important to consider that these might contain sensitive information. If they do, you should avoid logging them directly. ```diff - info(`azureApiInstance: ${this.azureApiInstance}`) - info(`azureApiDeployment: ${this.azureApiDeployment}`) - info(`azureApiVersion: ${this.azureApiVersion}`) + info(`azureApiInstance: ${this.azureApiInstance ? 'provided' : 'not provided'}`) + info(`azureApiDeployment: ${this.azureApiDeployment ? 'provided' : 'not provided'}`) + info(`azureApiVersion: ${this.azureApiVersion ? 'provided' : 'not provided'}`) ``` This way, we can still know if these values are set or not without exposing their actual content. <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
521
coderabbitai
github-actions[bot]
@@ -144,6 +144,15 @@ inputs: required: false description: 'Disable release notes' default: 'false' + azure_api_instance_name: + required: false + description: 'Instance name of your Azure API. For example, if your Azure instance is hosted under https://{INSTANCE_NAME}.openai.azure.com/openai/deployments/{DEPLOYMENT_NAME}, use INSTANCE_NAME' + azure_api_deployment_name: + required: false + description: 'Deployment name of your Azure API. For example, if your Azure instance is hosted under https://{INSTANCE_NAME}.openai.azure.com/openai/deployments/{DEPLOYMENT_NAME}, use DEPLOYMENT_NAME' + azure_api_version: + required: false + description: 'Api version like "2023-07-01-preview"'
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The new inputs for Azure API instance name, deployment name, and API version are optional (`required: false`). However, if the user wants to use the Azure bot functionality, these fields would be necessary. It might be better to add a note in the description of these fields indicating that they are required for Azure bot functionality. ```diff azure_api_instance_name: required: false - description: 'Instance name of your Azure API. For example, if your Azure instance is hosted under https://{INSTANCE_NAME}.openai.azure.com/openai/deployments/{DEPLOYMENT_NAME}, use INSTANCE_NAME' + description: 'Instance name of your Azure API. Required if using Azure bot. For example, if your Azure instance is hosted under https://{INSTANCE_NAME}.openai.azure.com/openai/deployments/{DEPLOYMENT_NAME}, use INSTANCE_NAME' azure_api_deployment_name: required: false - description: 'Deployment name of your Azure API. For example, if your Azure instance is hosted under https://{INSTANCE_NAME}.openai.azure.com/openai/deployments/{DEPLOYMENT_NAME}, use DEPLOYMENT_NAME' + description: 'Deployment name of your Azure API. Required if using Azure bot. For example, if your Azure instance is hosted under https://{INSTANCE_NAME}.openai.azure.com/openai/deployments/{DEPLOYMENT_NAME}, use DEPLOYMENT_NAME' azure_api_version: required: false - description: 'Api version like "2023-07-01-preview"' + description: 'Api version like "2023-07-01-preview". Required if using Azure bot.' ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
typescript
521
coderabbitai
github-actions[bot]
@@ -29,7 +33,10 @@ async function run(): Promise<void> { getInput('openai_concurrency_limit'), getInput('github_concurrency_limit'), getInput('openai_base_url'), - getInput('language') + getInput('language'), + getInput('azure_api_instance_name'), + getInput('azure_api_deployment_name'), + getInput('azure_api_version')
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The new inputs for Azure API instance name, deployment name, and API version are not validated. It's a good practice to validate user inputs to ensure they meet certain criteria before using them in the application. This can help prevent potential issues down the line. ```diff + const azureApiInstanceName = getInput('azure_api_instance_name'); + const azureApiDeploymentName = getInput('azure_api_deployment_name'); + const azureApiVersion = getInput('azure_api_version'); + + if (!azureApiInstanceName || !azureApiDeploymentName || !azureApiVersion) { + setFailed("Azure API configuration is incomplete. Please provide all required inputs."); + return; + } ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
typescript
521
coderabbitai
github-actions[bot]
@@ -42,29 +49,33 @@ // Create two bots, one for summary and one for review - let lightBot: Bot | null = null - try { - lightBot = new Bot( - options, - new OpenAIOptions(options.openaiLightModel, options.lightTokenLimits) - ) - } catch (e: any) { - warning( - `Skipped: failed to create summary bot, please check your openai_api_key: ${e}, backtrace: ${e.stack}` - ) - return + function createBot( + model: string, + tokenLimits: TokenLimits + ): BotProtocol | null { + try { + if (options.azureApiDeployment.length > 0) { + return new AzureBot(options, new OpenAIOptions(model, tokenLimits)) + } else { + return new Bot(options, new OpenAIOptions(model, tokenLimits)) + } + } catch (e: any) { + warning( + `Skipped: failed to create bot, please check your openai_api_key: ${e}, backtrace: ${e.stack}` + ) + return null + } }
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The `createBot` function now handles both Azure bot and regular bot creation based on the provided options. However, it seems that the error message is still specific to OpenAI key issues. It would be better to have more generic error handling here or differentiate between errors related to OpenAI and Azure bots. ```diff - warning( - `Skipped: failed to create bot, please check your openai_api_key: ${e}, backtrace: ${e.stack}` - ) + if (options.azureApiDeployment.length > 0) { + warning( + `Skipped: failed to create Azure bot, please check your Azure API configuration: ${e}, backtrace: ${e.stack}` + ) + } else { + warning( + `Skipped: failed to create OpenAI bot, please check your openai_api_key: ${e}, backtrace: ${e.stack}` + ) + } ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
typescript
521
coderabbitai
github-actions[bot]
@@ -0,0 +1,112 @@ +import './fetch-polyfill' + +import {info, setFailed, warning} from '@actions/core' +import {ConversationChain} from 'langchain/chains' +import {ChatOpenAI} from 'langchain/chat_models/openai' +import {BufferMemory} from 'langchain/memory' +import {ChatPromptTemplate, MessagesPlaceholder} from 'langchain/prompts' +import {ChainValues} from 'langchain/schema' +import {OpenAIOptions, Options} from './options' +import {BotProtocol, Ids} from './bot-interface' + +export class AzureBot implements BotProtocol { + private readonly model: ChatOpenAI | null = null + private readonly api: ConversationChain | null = null + + private readonly options: Options + + constructor(options: Options, openaiOptions: OpenAIOptions) { + this.options = options + if ( + process.env.AZURE_OPENAI_API_KEY && + options.azureApiDeployment && + options.apiBaseUrl && + options.azureApiInstance + ) { + const currentDate = new Date().toISOString().split('T')[0] + const systemMessage = `${options.systemMessage} + Knowledge cutoff: ${openaiOptions.tokenLimits.knowledgeCutOff} + Current date: ${currentDate} + + IMPORTANT: Entire response must be in the language with ISO code: ${options.language} + ` + const chatPrompt = ChatPromptTemplate.fromMessages([ + ['system', systemMessage], + new MessagesPlaceholder('history'), + ['human', '{input}'] + ]) + + this.model = new ChatOpenAI({ + temperature: options.openaiModelTemperature, + maxTokens: openaiOptions.tokenLimits.responseTokens, + azureOpenAIApiKey: process.env.AZURE_OPENAI_API_KEY, + azureOpenAIApiVersion: options.azureApiVersion, + azureOpenAIApiInstanceName: options.azureApiInstance, + azureOpenAIApiDeploymentName: options.azureApiDeployment, + timeout: this.options.openaiTimeoutMS, + maxRetries: this.options.openaiRetries + }) + this.api = new ConversationChain({ + memory: new BufferMemory({returnMessages: true, memoryKey: 'history'}), + prompt: chatPrompt, + llm: this.model + }) + } else { + const err = + "Unable to initialize the OpenAI API, ensure 'AZURE_OPENAI_API_KEY', 'azureApiDeployment', 'apiBaseUrl', and 'azureApiInstance' are properly set" + throw new Error(err) + } + } + + chat = async (message: string, ids: Ids): Promise<[string, Ids]> => { + let res: [string, Ids] = ['', ids] + try { + res = await this.chat_(message) + return res + } catch (e: unknown) { + warning(`Failed to chat: ${e}`) + return res + } + } + + private readonly chat_ = async (message: string): Promise<[string, Ids]> => { + // record timing + const start = Date.now() + if (!message) { + return ['', {}] + } + + let response: ChainValues | undefined + + if (this.api != null) { + try { + response = await this.api.call({input: message}) + } catch (e: unknown) { + info(`response: ${response}, failed to send message to openai: ${e}`) + } + const end = Date.now() + info(`response: ${JSON.stringify(response)}`) + info( + `openai sendMessage (including retries) response time: ${ + end - start + } ms` + ) + } else { + setFailed('The OpenAI API is not initialized') + } + let responseText = '' + if (response != null) { + responseText = response.response + } else { + warning('openai response is null') + } + // remove the prefix "with " in the response + if (responseText.startsWith('with ')) { + responseText = responseText.substring(5) + } + if (this.options.debug) { + info(`openai responses: ${responseText}`) + } + return [responseText, {}] + } +}
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The `AzureBot` class seems to be well implemented, following the `BotProtocol` interface. However, there are a few areas that could be improved for better error handling and maintainability. <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
typescript
521
coderabbitai
github-actions[bot]
@@ -0,0 +1,112 @@ +import './fetch-polyfill' + +import {info, setFailed, warning} from '@actions/core' +import {ConversationChain} from 'langchain/chains' +import {ChatOpenAI} from 'langchain/chat_models/openai' +import {BufferMemory} from 'langchain/memory' +import {ChatPromptTemplate, MessagesPlaceholder} from 'langchain/prompts' +import {ChainValues} from 'langchain/schema' +import {OpenAIOptions, Options} from './options' +import {BotProtocol, Ids} from './bot-interface' + +export class AzureBot implements BotProtocol { + private readonly model: ChatOpenAI | null = null + private readonly api: ConversationChain | null = null + + private readonly options: Options + + constructor(options: Options, openaiOptions: OpenAIOptions) { + this.options = options + if ( + process.env.AZURE_OPENAI_API_KEY && + options.azureApiDeployment && + options.apiBaseUrl && + options.azureApiInstance + ) { + const currentDate = new Date().toISOString().split('T')[0] + const systemMessage = `${options.systemMessage} + Knowledge cutoff: ${openaiOptions.tokenLimits.knowledgeCutOff} + Current date: ${currentDate} + + IMPORTANT: Entire response must be in the language with ISO code: ${options.language} + ` + const chatPrompt = ChatPromptTemplate.fromMessages([ + ['system', systemMessage], + new MessagesPlaceholder('history'), + ['human', '{input}'] + ]) + + this.model = new ChatOpenAI({ + temperature: options.openaiModelTemperature, + maxTokens: openaiOptions.tokenLimits.responseTokens, + azureOpenAIApiKey: process.env.AZURE_OPENAI_API_KEY, + azureOpenAIApiVersion: options.azureApiVersion, + azureOpenAIApiInstanceName: options.azureApiInstance, + azureOpenAIApiDeploymentName: options.azureApiDeployment, + timeout: this.options.openaiTimeoutMS, + maxRetries: this.options.openaiRetries + }) + this.api = new ConversationChain({ + memory: new BufferMemory({returnMessages: true, memoryKey: 'history'}), + prompt: chatPrompt, + llm: this.model + }) + } else { + const err = + "Unable to initialize the OpenAI API, ensure 'AZURE_OPENAI_API_KEY', 'azureApiDeployment', 'apiBaseUrl', and 'azureApiInstance' are properly set" + throw new Error(err) + }
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The constructor of the `AzureBot` class is doing too much work. It's not only setting up the options but also initializing the OpenAI API and creating a new `ConversationChain`. This can make it difficult to test and maintain. Consider moving the initialization of the OpenAI API and `ConversationChain` to separate methods. ```diff - constructor(options: Options, openaiOptions: OpenAIOptions) { + constructor(options: Options, openaiOptions: OpenAIOptions) { + this.options = options + if ( + process.env.AZURE_OPENAI_API_KEY && + options.azureApiDeployment && + options.apiBaseUrl && + options.azureApiInstance + ) { + this.initializeOpenAI(options, openaiOptions) + } else { + const err = + "Unable to initialize the OpenAI API, ensure 'AZURE_OPENAI_API_KEY', 'azureApiDeployment', 'apiBaseUrl', and 'azureApiInstance' are properly set" + throw new Error(err) + } + } + + private initializeOpenAI(options: Options, openaiOptions: OpenAIOptions) { // rest of the code... } ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
typescript
521
coderabbitai
github-actions[bot]
@@ -0,0 +1,112 @@ +import './fetch-polyfill' + +import {info, setFailed, warning} from '@actions/core' +import {ConversationChain} from 'langchain/chains' +import {ChatOpenAI} from 'langchain/chat_models/openai' +import {BufferMemory} from 'langchain/memory' +import {ChatPromptTemplate, MessagesPlaceholder} from 'langchain/prompts' +import {ChainValues} from 'langchain/schema' +import {OpenAIOptions, Options} from './options' +import {BotProtocol, Ids} from './bot-interface' + +export class AzureBot implements BotProtocol { + private readonly model: ChatOpenAI | null = null + private readonly api: ConversationChain | null = null + + private readonly options: Options + + constructor(options: Options, openaiOptions: OpenAIOptions) { + this.options = options + if ( + process.env.AZURE_OPENAI_API_KEY && + options.azureApiDeployment && + options.apiBaseUrl && + options.azureApiInstance + ) { + const currentDate = new Date().toISOString().split('T')[0] + const systemMessage = `${options.systemMessage} + Knowledge cutoff: ${openaiOptions.tokenLimits.knowledgeCutOff} + Current date: ${currentDate} + + IMPORTANT: Entire response must be in the language with ISO code: ${options.language} + ` + const chatPrompt = ChatPromptTemplate.fromMessages([ + ['system', systemMessage], + new MessagesPlaceholder('history'), + ['human', '{input}'] + ]) + + this.model = new ChatOpenAI({ + temperature: options.openaiModelTemperature, + maxTokens: openaiOptions.tokenLimits.responseTokens, + azureOpenAIApiKey: process.env.AZURE_OPENAI_API_KEY, + azureOpenAIApiVersion: options.azureApiVersion, + azureOpenAIApiInstanceName: options.azureApiInstance, + azureOpenAIApiDeploymentName: options.azureApiDeployment, + timeout: this.options.openaiTimeoutMS, + maxRetries: this.options.openaiRetries + }) + this.api = new ConversationChain({ + memory: new BufferMemory({returnMessages: true, memoryKey: 'history'}), + prompt: chatPrompt, + llm: this.model + }) + } else { + const err = + "Unable to initialize the OpenAI API, ensure 'AZURE_OPENAI_API_KEY', 'azureApiDeployment', 'apiBaseUrl', and 'azureApiInstance' are properly set" + throw new Error(err) + } + } + + chat = async (message: string, ids: Ids): Promise<[string, Ids]> => { + let res: [string, Ids] = ['', ids] + try { + res = await this.chat_(message) + return res + } catch (e: unknown) { + warning(`Failed to chat: ${e}`) + return res + } + }
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The `chat` method catches errors but only logs a warning and returns the default response. This might hide potential issues with the chat functionality. Consider rethrowing the error after logging the warning, or handle it in a way that doesn't silence it. ```diff - warning(`Failed to chat: ${e}`) - return res + warning(`Failed to chat: ${e}`) + throw e ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
typescript
521
coderabbitai
github-actions[bot]
@@ -0,0 +1,112 @@ +import './fetch-polyfill' + +import {info, setFailed, warning} from '@actions/core' +import {ConversationChain} from 'langchain/chains' +import {ChatOpenAI} from 'langchain/chat_models/openai' +import {BufferMemory} from 'langchain/memory' +import {ChatPromptTemplate, MessagesPlaceholder} from 'langchain/prompts' +import {ChainValues} from 'langchain/schema' +import {OpenAIOptions, Options} from './options' +import {BotProtocol, Ids} from './bot-interface' + +export class AzureBot implements BotProtocol { + private readonly model: ChatOpenAI | null = null + private readonly api: ConversationChain | null = null + + private readonly options: Options + + constructor(options: Options, openaiOptions: OpenAIOptions) { + this.options = options + if ( + process.env.AZURE_OPENAI_API_KEY && + options.azureApiDeployment && + options.apiBaseUrl && + options.azureApiInstance + ) { + const currentDate = new Date().toISOString().split('T')[0] + const systemMessage = `${options.systemMessage} + Knowledge cutoff: ${openaiOptions.tokenLimits.knowledgeCutOff} + Current date: ${currentDate} + + IMPORTANT: Entire response must be in the language with ISO code: ${options.language} + ` + const chatPrompt = ChatPromptTemplate.fromMessages([ + ['system', systemMessage], + new MessagesPlaceholder('history'), + ['human', '{input}'] + ]) + + this.model = new ChatOpenAI({ + temperature: options.openaiModelTemperature, + maxTokens: openaiOptions.tokenLimits.responseTokens, + azureOpenAIApiKey: process.env.AZURE_OPENAI_API_KEY, + azureOpenAIApiVersion: options.azureApiVersion, + azureOpenAIApiInstanceName: options.azureApiInstance, + azureOpenAIApiDeploymentName: options.azureApiDeployment, + timeout: this.options.openaiTimeoutMS, + maxRetries: this.options.openaiRetries + }) + this.api = new ConversationChain({ + memory: new BufferMemory({returnMessages: true, memoryKey: 'history'}), + prompt: chatPrompt, + llm: this.model + }) + } else { + const err = + "Unable to initialize the OpenAI API, ensure 'AZURE_OPENAI_API_KEY', 'azureApiDeployment', 'apiBaseUrl', and 'azureApiInstance' are properly set" + throw new Error(err) + } + } + + chat = async (message: string, ids: Ids): Promise<[string, Ids]> => { + let res: [string, Ids] = ['', ids] + try { + res = await this.chat_(message) + return res + } catch (e: unknown) { + warning(`Failed to chat: ${e}`) + return res + } + } + + private readonly chat_ = async (message: string): Promise<[string, Ids]> => { + // record timing + const start = Date.now() + if (!message) { + return ['', {}] + } + + let response: ChainValues | undefined + + if (this.api != null) { + try { + response = await this.api.call({input: message}) + } catch (e: unknown) { + info(`response: ${response}, failed to send message to openai: ${e}`) + } + const end = Date.now() + info(`response: ${JSON.stringify(response)}`) + info( + `openai sendMessage (including retries) response time: ${ + end - start + } ms` + ) + } else { + setFailed('The OpenAI API is not initialized') + } + let responseText = '' + if (response != null) { + responseText = response.response + } else { + warning('openai response is null') + } + // remove the prefix "with " in the response + if (responseText.startsWith('with ')) { + responseText = responseText.substring(5) + } + if (this.options.debug) { + info(`openai responses: ${responseText}`) + } + return [responseText, {}] + }
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The `chat_` method is also doing too much work. It's responsible for sending the message, handling the response, and formatting the response text. Consider breaking this method into smaller methods each with a single responsibility. ```diff - private readonly chat_ = async (message: string): Promise<[string, Ids]> => { + private readonly chat_ = async (message: string): Promise<[string, Ids]> => { + // record timing + const start = Date.now() + if (!message) { + return ['', {}] + } + + let response: ChainValues | undefined + + if (this.api != null) { + response = await this.sendMessageToOpenAI(message) + } else { + setFailed('The OpenAI API is not initialized') + } + + let responseText = this.formatResponse(response) + + if (this.options.debug) { + info(`openai responses: ${responseText}`) + } + return [responseText, {}] + } + + private async sendMessageToOpenAI(message: string): Promise<ChainValues | undefined> { + // rest of the code... + } + + private formatResponse(response: ChainValues | undefined): string { + // rest of the code... + } ``` These changes will make the code more maintainable and easier to test by separating concerns into different methods. <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
521
coderabbitai
github-actions[bot]
@@ -198,18 +200,152 @@ "node": ">=6.0.0" } }, + "node_modules/@anthropic-ai/sdk": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/@anthropic-ai/sdk/-/sdk-0.9.1.tgz", + "integrity": "sha512-wa1meQ2WSfoY8Uor3EdrJq0jTiZJoKoSii2ZVWRY1oN4Tlr5s59pADg9T79FTbPe1/se5c3pBeZgJL63wmuoBA==", + "dependencies": { + "@types/node": "^18.11.18", + "@types/node-fetch": "^2.6.4", + "abort-controller": "^3.0.0", + "agentkeepalive": "^4.2.1", + "digest-fetch": "^1.3.0", + "form-data-encoder": "1.7.2", + "formdata-node": "^4.3.2", + "node-fetch": "^2.6.7", + "web-streams-polyfill": "^3.2.1" + } + }, + "node_modules/@anthropic-ai/sdk/node_modules/@types/node": { + "version": "18.19.15", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.15.tgz", + "integrity": "sha512-AMZ2UWx+woHNfM11PyAEQmfSxi05jm9OlkxczuHeEqmvwPkYj6MWv44gbzDPefYOLysTOFyI3ziiy2ONmUZfpA==", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/@anthropic-ai/sdk/node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/@anthropic-ai/sdk/node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, + "node_modules/@anthropic-ai/sdk/node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "node_modules/@anthropic-ai/sdk/node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "node_modules/@babel/code-frame": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz", - "integrity": "sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==", + "version": "7.23.5", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.23.5.tgz", + "integrity": "sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==", "dev": true, "dependencies": { - "@babel/highlight": "^7.18.6" + "@babel/highlight": "^7.23.4", + "chalk": "^2.4.2" }, "engines": { "node": ">=6.9.0" } }, + "node_modules/@babel/code-frame/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/code-frame/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/code-frame/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/@babel/code-frame/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, + "node_modules/@babel/code-frame/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/@babel/code-frame/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/code-frame/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + },
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The new dependencies introduced in the `package-lock.json` file are part of the `@anthropic-ai/sdk` and `@babel/code-frame` packages. However, it's not clear from the PR summary why these dependencies are needed. Please provide a justification for these new dependencies or remove them if they're not necessary. <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
521
coderabbitai
github-actions[bot]
@@ -250,21 +386,21 @@ } }, "node_modules/@babel/core/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true, "bin": { "semver": "bin/semver.js" }
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The version of `semver` has been updated from `6.3.0` to `6.3.1`. This is a patch version update, so it should be safe. However, it would be good to test this change thoroughly to ensure that it doesn't introduce any unexpected behavior. <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
521
coderabbitai
github-actions[bot]
@@ -250,21 +386,21 @@ } }, "node_modules/@babel/core/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true, "bin": { "semver": "bin/semver.js" } }, "node_modules/@babel/generator": { - "version": "7.21.3", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.21.3.tgz", - "integrity": "sha512-QS3iR1GYC/YGUnW7IdggFeN5c1poPUurnGttOV/bZgPGV+izC/D8HnD6DLwod0fsatNyVn1G3EVWMYIF0nHbeA==", + "version": "7.23.6", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.6.tgz", + "integrity": "sha512-qrSfCYxYQB5owCmGLbl8XRpX1ytXlpueOb0N0UmQwA073KZxejgQTzAmJezxvpwQD9uGtK2shHdi55QT+MbjIw==", "dev": true, "dependencies": { - "@babel/types": "^7.21.3", + "@babel/types": "^7.23.6",
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The version of `@babel/generator` has been updated from `7.21.3` to `7.23.6`. This is a minor version update, so it should be backward compatible according to semantic versioning rules. However, it's always a good idea to test this change thoroughly to ensure that it doesn't introduce any unexpected behavior. <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
typescript
513
coderabbitai
github-actions[bot]
@@ -34,7 +34,7 @@ IMPORTANT: Entire response must be in the language with ISO code: ${options.lang ` this.api = new ChatGPTAPI({ - apiBaseUrl: options.apiBaseUrl, + apiBaseUrl: process.env.OPENAI_API_BASE_URL,
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The change from using a value from `options` to directly using an environment variable for `apiBaseUrl` could potentially limit the flexibility of your code. If you want to instantiate `ChatGPTAPI` with different base URLs in different parts of your application, this change would prevent that. Consider keeping the ability to pass in `apiBaseUrl` through `options`, and use the environment variable as a fallback. ```diff - apiBaseUrl: process.env.OPENAI_API_BASE_URL, + apiBaseUrl: options.apiBaseUrl ?? process.env.OPENAI_API_BASE_URL, ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
typescript
513
coderabbitai
github-actions[bot]
@@ -32,8 +32,8 @@ export class Options { reviewCommentLGTM = false, pathFilters: string[] | null = null, systemMessage = '', - openaiLightModel = 'gpt-3.5-turbo', - openaiHeavyModel = 'gpt-3.5-turbo', + openaiLightModel = 'pai-001-light', + openaiHeavyModel = 'pai-001',
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The model names for `openaiLightModel` and `openaiHeavyModel` have been changed from 'gpt-3.5-turbo' to 'pai-001-light' and 'pai-001' respectively. Please ensure that these new models exist and are compatible with the rest of your codebase. If they don't exist or aren't compatible, you may encounter runtime errors or unexpected behavior. ```diff - openaiLightModel = 'gpt-3.5-turbo', - openaiHeavyModel = 'gpt-3.5-turbo', + openaiLightModel = 'pai-001-light', + openaiHeavyModel = 'pai-001', ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
513
coderabbitai
github-actions[bot]
@@ -152,11 +152,11 @@ inputs: required: false description: 'Model to use for simple tasks like summarizing diff on a file.' - default: 'gpt-3.5-turbo' + default: 'pai-001-light' openai_heavy_model: required: false description: 'Model to use for complex tasks such as code reviews.' - default: 'gpt-4' + default: 'pai-001'
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The indentation for the `default` field under `openai_heavy_model` is incorrect. It should be aligned with the other fields like `required` and `description`. Also, there's a missing space before `openai_model_temperature`, it should be on a new line. ```diff default: 'pai-001-light' openai_heavy_model: required: false description: 'Model to use for complex tasks such as code reviews.' default: 'pai-001' - openai_model_temperature: +160: +161: openai_model_temperature: required: false description: 'Temperature for GPT model' ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
513
coderabbitai
github-actions[bot]
@@ -104,6 +104,9 @@ jobs: - `OPENAI_API_KEY`: use this to authenticate with OpenAI API. You can get one [here](https://platform.openai.com/account/api-keys). Please add this key to your GitHub Action secrets. +- `OPENAI_API_BASE_URL`: (optional) use this to use a custom OpenAI API base + URL. This is useful if you are using a custom OpenAI API server. Defaults to + `https://api.openai.com`.
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The addition of the `OPENAI_API_BASE_URL` environment variable is a good idea for flexibility, especially for users who might be using a custom OpenAI API server. However, it would be helpful to provide instructions on how and where to add this key (similar to the other keys). This will ensure consistency in the documentation and make it easier for users to understand how to use this new option. ```diff - - `OPENAI_API_BASE_URL`: (optional) use this to use a custom OpenAI API base - URL. This is useful if you are using a custom OpenAI API server. Defaults to - `https://api.openai.com`. + - `OPENAI_API_BASE_URL`: (optional) use this to use a custom OpenAI API base + URL. This is useful if you are using a custom OpenAI API server. Defaults to + `https://api.openai.com`. Please add this key to your GitHub Action secrets if needed. ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
511
coderabbitai
github-actions[bot]
@@ -123,3 +123,11 @@ tags.lock .env .secrets bin/act +/.idea/.gitignore +/.idea/ai-pr-reviewer.iml +/.idea/codeStyles/codeStyleConfig.xml +/.idea/misc.xml +/.idea/modules.xml +/.idea/codeStyles/Project.xml +/.idea/inspectionProfiles/Project_Default.xml +/.idea/vcs.xml
The changes to the `.gitignore` file seem to be ignoring IDE-specific files, which is a good practice. However, instead of listing each file in the `.idea` directory individually, you can ignore the entire directory by simply adding `/.idea/`. This will make your `.gitignore` file cleaner and easier to maintain. ```diff - /.idea/.gitignore - /.idea/ai-pr-reviewer.iml - /.idea/codeStyles/codeStyleConfig.xml - /.idea/misc.xml - /.idea/modules.xml - /.idea/codeStyles/Project.xml - /.idea/inspectionProfiles/Project_Default.xml - /.idea/vcs.xml + /.idea/ ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
typescript
508
coderabbitai
github-actions[bot]
@@ -28,7 +28,6 @@ async function run(): Promise<void> { getInput('openai_timeout_ms'), getInput('openai_concurrency_limit'), getInput('github_concurrency_limit'), - getInput('openai_base_url'), getInput('language') )
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The removal of the `openai_base_url` input seems to be in line with the changes made to the `Bot` class and its interaction with the OpenAI API. However, please ensure that this change doesn't affect other parts of the codebase that might still be using this input. If there are such dependencies, they should be updated accordingly. ```diff - getInput('openai_base_url'), ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
508
coderabbitai
github-actions[bot]
@@ -15,6 +15,7 @@ "@octokit/action": "^6.0.4", "@octokit/plugin-retry": "^4.1.3", "@octokit/plugin-throttling": "^6.1.0", + "langchain": "^0.0.195",
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The addition of the "langchain" package is noted. However, without a description or context about why this new dependency is needed, it's hard to assess its impact. Please provide more information about why this package is necessary and how it will be used in the project. ```diff + "langchain": "^0.0.195", ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
508
coderabbitai
github-actions[bot]
@@ -198,6 +199,68 @@ "node": ">=6.0.0" } }, + "node_modules/@anthropic-ai/sdk": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/@anthropic-ai/sdk/-/sdk-0.9.1.tgz", + "integrity": "sha512-wa1meQ2WSfoY8Uor3EdrJq0jTiZJoKoSii2ZVWRY1oN4Tlr5s59pADg9T79FTbPe1/se5c3pBeZgJL63wmuoBA==", + "dependencies": { + "@types/node": "^18.11.18", + "@types/node-fetch": "^2.6.4", + "abort-controller": "^3.0.0", + "agentkeepalive": "^4.2.1", + "digest-fetch": "^1.3.0", + "form-data-encoder": "1.7.2", + "formdata-node": "^4.3.2", + "node-fetch": "^2.6.7", + "web-streams-polyfill": "^3.2.1" + } + }, + "node_modules/@anthropic-ai/sdk/node_modules/@types/node": { + "version": "18.19.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.3.tgz", + "integrity": "sha512-k5fggr14DwAytoA/t8rPrIz++lXK7/DqckthCmoZOKNsEbJkId4Z//BqgApXBUGrGddrigYa1oqheo/7YmW4rg==", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/@anthropic-ai/sdk/node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/@anthropic-ai/sdk/node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, + "node_modules/@anthropic-ai/sdk/node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "node_modules/@anthropic-ai/sdk/node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + },
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit A new package "@anthropic-ai/sdk" has been added as a dependency. This seems to be a significant change, but there's no explanation provided in the PR description. It would be helpful to understand why this package was added and how it will be used in the project. ```diff + "node_modules/@anthropic-ai/sdk": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/@anthropic-ai/sdk/-/sdk-0.9.1.tgz", + "integrity": "sha512-wa1meQ2WSfoY8Uor3EdrJq0jTiZJoKoSii2ZVWRY1oN4Tlr5s59pADg9T79FTbPe1/se5c3pBeZgJL63wmuoBA==", + "dependencies": { + "@types/node": "^18.11.18", + "@types/node-fetch": "^2.6.4", + "abort-controller": "^3.0.0", + "agentkeepalive": "^4.2.1", + "digest-fetch": "^1.3.0", + "form-data-encoder": "1.7.2", + "formdata-node": "^4.3.2", + "node-fetch": "^2.6.7", + "web-streams-polyfill": "^3.2.1" + } + }, ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
508
coderabbitai
github-actions[bot]
@@ -2136,7 +2199,7 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==", - "dev": true, + "devOptional": true,
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The "devOptional" property has been added to the "@tootallnate/once" package. This change seems fine, but it would be helpful to understand why this was necessary. ```diff + "devOptional": true, ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
508
coderabbitai
github-actions[bot]
@@ -2230,8 +2293,29 @@ "node_modules/@types/node": { "version": "20.4.2", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.2.tgz", - "integrity": "sha512-Dd0BYtWgnWJKwO1jkmTrzofjK2QXXcai0dmtzvIBhcA+RsG5h8R3xlyta0kGOZRNfL9GuRtb1knmPEhQrePCEw==", - "dev": true + "integrity": "sha512-Dd0BYtWgnWJKwO1jkmTrzofjK2QXXcai0dmtzvIBhcA+RsG5h8R3xlyta0kGOZRNfL9GuRtb1knmPEhQrePCEw==" + }, + "node_modules/@types/node-fetch": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.9.tgz", + "integrity": "sha512-bQVlnMLFJ2d35DkPNjEPmd9ueO/rh5EiaZt2bhqiSarPjZIuIV6bPQVqcrEyvNo+AfTrRGVazle1tl597w3gfA==", + "dependencies": { + "@types/node": "*", + "form-data": "^4.0.0" + } + }, + "node_modules/@types/node-fetch/node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + }
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit A new package "@types/node-fetch" has been added as a dependency. This seems to be a significant change, but there's no explanation provided in the PR description. It would be helpful to understand why this package was added and how it will be used in the project. ```diff + "node_modules/@types/node-fetch": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.9.tgz", + "integrity": "sha512-bQVlnMLFJ2d35DkPNjEPmd9ueO/rh5EiaZt2bhqiSarPjZIuIV6bPQVqcrEyvNo+AfTrRGVazle1tl597w3gfA==", + "dependencies": { + "@types/node": "*", + "form-data": "^4.0.0" + } + }, + "node_modules/@types/node-fetch/node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
508
coderabbitai
github-actions[bot]
@@ -2262,6 +2346,11 @@ "integrity": "sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==", "dev": true }, + "node_modules/@types/uuid": { + "version": "9.0.7", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.7.tgz", + "integrity": "sha512-WUtIVRUZ9i5dYXefDEAI7sh9/O7jGvHg7Df/5O/gtH3Yabe5odI3UWopVR1qbPXQtvOxWu3mM4XxlYeZtMWF4g==" + },
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit A new package "@types/uuid" has been added as a dependency. This seems to be a significant change, but there's no explanation provided in the PR description. It would be helpful to understand why this package was added and how it will be used in the project. ```diff + "node_modules/@types/uuid": { + "version": "9.0.7", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.7.tgz", + "integrity": "sha512-WUtIVRUZ9i5dYXefDEAI7sh9/O7jGvHg7Df/5O/gtH3Yabe5odI3UWopVR1qbPXQtvOxWu3mM4XxlYeZtMWF4g==" + }, ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
508
coderabbitai
github-actions[bot]
@@ -2500,13 +2589,24 @@ "version": "2.0.6", "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz", "integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==", - "dev": true + "devOptional": true + }, + "node_modules/abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "dependencies": { + "event-target-shim": "^5.0.0" + }, + "engines": { + "node": ">=6.5" + }
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit A new package "abort-controller" has been added as a dependency. This seems to be a significant change, but there's no explanation provided in the PR description. It would be helpful to understand why this package was added and how it will be used in the project. ```diff + "node_modules/abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "dependencies": { + "event-target-shim": "^5.0.0" + }, + "engines": { + "node": ">=6.5" + } + }, ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
508
coderabbitai
github-actions[bot]
@@ -2518,7 +2618,7 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-6.0.0.tgz", "integrity": "sha512-ZQl7LOWaF5ePqqcX4hLuv/bLXYQNfNWw2c0/yX/TsPRKamzHcTGQnlCjHT3TsmkOUVEPS3crCxiPfdzE/Trlhg==", - "dev": true, + "devOptional": true,
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The "devOptional" property has been added to the "acorn-globals" package. This change seems fine, but it would be helpful to understand why this was necessary. ```diff + "devOptional": true, ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
508
coderabbitai
github-actions[bot]
@@ -2528,7 +2628,7 @@ "version": "7.4.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", - "dev": true, + "devOptional": true,
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The "devOptional" property has been added to the "acorn" package. This change seems fine, but it would be helpful to understand why this was necessary. ```diff + "devOptional": true, ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
508
coderabbitai
github-actions[bot]
@@ -2549,7 +2649,7 @@ "version": "7.2.0", "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-7.2.0.tgz", "integrity": "sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==", - "dev": true, + "devOptional": true,
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The "devOptional" property has been added to the "acorn-walk" package. This change seems fine, but it would be helpful to understand why this was necessary. ```diff + "devOptional": true, ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
typescript
508
coderabbitai
github-actions[bot]
@@ -1,14 +1,11 @@ import './fetch-polyfill' import {info, setFailed, warning} from '@actions/core' -import { - ChatGPTAPI, - ChatGPTError, - ChatMessage, - SendMessageOptions - // eslint-disable-next-line import/no-unresolved -} from 'chatgpt' -import pRetry from 'p-retry' +import {ConversationChain} from 'langchain/chains' +import {ChatOpenAI} from 'langchain/chat_models/openai' +import {BufferMemory} from 'langchain/memory' +import {ChatPromptTemplate, MessagesPlaceholder} from 'langchain/prompts' +import {ChainValues} from 'langchain/schema'
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The import statements have been modified to use the `langchain` package instead of `chatgpt`. This change seems to be in line with the PR's goal of switching to Azure OpenAI. However, it's important to ensure that the new imports provide equivalent functionality to the old ones. ```diff - import { - ChatGPTAPI, - ChatGPTError, - ChatMessage, - SendMessageOptions - // eslint-disable-next-line import/no-unresolved - } from 'chatgpt' - import pRetry from 'p-retry' + import {ConversationChain} from 'langchain/chains' + import {ChatOpenAI} from 'langchain/chat_models/openai' + import {BufferMemory} from 'langchain/memory' + import {ChatPromptTemplate, MessagesPlaceholder} from 'langchain/prompts' + import {ChainValues} from 'langchain/schema' ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
typescript
508
coderabbitai
github-actions[bot]
@@ -18,83 +15,78 @@ export interface Ids { } export class Bot { - private readonly api: ChatGPTAPI | null = null // not free + private readonly model: ChatOpenAI | null = null + private readonly api: ConversationChain | null = null
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The `api` property has been replaced with `model` and `api` properties. It's crucial to verify that these new properties are used correctly throughout the class. ```diff - private readonly api: ChatGPTAPI | null = null // not free + private readonly model: ChatOpenAI | null = null + private readonly api: ConversationChain | null = null ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
typescript
508
coderabbitai
github-actions[bot]
@@ -18,83 +15,78 @@ export interface Ids { } export class Bot { - private readonly api: ChatGPTAPI | null = null // not free + private readonly model: ChatOpenAI | null = null + private readonly api: ConversationChain | null = null private readonly options: Options constructor(options: Options, openaiOptions: OpenAIOptions) { this.options = options - if (process.env.OPENAI_API_KEY) { + if ( + process.env.AZURE_OPENAI_API_KEY && + process.env.AZURE_OPENAI_API_VERSION && + process.env.AZURE_OPENAI_API_INSTANCE_NAME && + process.env.AZURE_OPENAI_API_DEPLOYMENT_NAME + ) { const currentDate = new Date().toISOString().split('T')[0] - const systemMessage = `${options.systemMessage} -Knowledge cutoff: ${openaiOptions.tokenLimits.knowledgeCutOff} -Current date: ${currentDate} + const systemMessage = `${options.systemMessage} + Knowledge cutoff: ${openaiOptions.tokenLimits.knowledgeCutOff} + Current date: ${currentDate} + + IMPORTANT: Entire response must be in the language with ISO code: ${options.language} + ` + const chatPrompt = ChatPromptTemplate.fromMessages([ + ['system', systemMessage], + new MessagesPlaceholder('history'), + ['human', '{input}'] + ]) -IMPORTANT: Entire response must be in the language with ISO code: ${options.language} -` - - this.api = new ChatGPTAPI({ - apiBaseUrl: options.apiBaseUrl, - systemMessage, - apiKey: process.env.OPENAI_API_KEY, - apiOrg: process.env.OPENAI_API_ORG ?? undefined, - debug: options.debug, - maxModelTokens: openaiOptions.tokenLimits.maxTokens, - maxResponseTokens: openaiOptions.tokenLimits.responseTokens, - completionParams: { - temperature: options.openaiModelTemperature, - model: openaiOptions.model - } + this.model = new ChatOpenAI({ + temperature: options.openaiModelTemperature, + azureOpenAIApiKey: process.env.AZURE_OPENAI_API_KEY, + azureOpenAIApiVersion: process.env.AZURE_OPENAI_API_VERSION, + azureOpenAIApiInstanceName: process.env.AZURE_OPENAI_API_INSTANCE_NAME, + azureOpenAIApiDeploymentName: + process.env.AZURE_OPENAI_API_DEPLOYMENT_NAME, + timeout: this.options.openaiTimeoutMS, + maxRetries: this.options.openaiRetries + }) + this.api = new ConversationChain({ + memory: new BufferMemory({returnMessages: true, memoryKey: 'history'}), + prompt: chatPrompt, + llm: this.model }) } else { const err = - "Unable to initialize the OpenAI API, both 'OPENAI_API_KEY' environment variable are not available" + "Unable to initialize the OpenAI API, both 'AZURE_OPENAI_API_KEY' environment variable are not available" throw new Error(err) }
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The constructor now initializes the `model` and `api` properties using environment variables related to Azure OpenAI. The error message when these environment variables are not available has also been updated accordingly. This is a significant change and should be thoroughly tested to ensure correct behavior. ```diff - if (process.env.OPENAI_API_KEY) { - const currentDate = new Date().toISOString().split('T')[0] - const systemMessage = `${options.systemMessage} - Knowledge cutoff: ${openaiOptions.tokenLimits.knowledgeCutOff} - Current date: ${currentDate} - - IMPORTANT: Entire response must be in the language with ISO code: ${options.language} - ` - - this.api = new ChatGPTAPI({ - apiBaseUrl: options.apiBaseUrl, - systemMessage, - apiKey: process.env.OPENAI_API_KEY, - apiOrg: process.env.OPENAI_API_ORG ?? undefined, - debug: options.debug, - maxModelTokens: openaiOptions.tokenLimits.maxTokens, - maxResponseTokens: openaiOptions.tokenLimits.responseTokens, - completionParams: { - temperature: options.openaiModelTemperature, - model: openaiOptions.model - } - }) - } else { - const err = - "Unable to initialize the OpenAI API, both 'OPENAI_API_KEY' environment variable are not available" - throw new Error(err) - } + if ( + process.env.AZURE_OPENAI_API_KEY && + process.env.AZURE_OPENAI_API_VERSION && + process.env.AZURE_OPENAI_API_INSTANCE_NAME && + process.env.AZURE_OPENAI_API_DEPLOYMENT_NAME + ) { + const currentDate = new Date().toISOString().split('T')[0] + const systemMessage = `${options.systemMessage} + Knowledge cutoff: ${openaiOptions.tokenLimits.knowledgeCutOff} + Current date: ${currentDate} + + IMPORTANT: Entire response must be in the language with ISO code: ${options.language} + ` + const chatPrompt = ChatPromptTemplate.fromMessages([ + ['system', systemMessage], + new MessagesPlaceholder('history'), + ['human', '{input}'] + ]) + + this.model = new ChatOpenAI({ + temperature: options.openaiModelTemperature, + azureOpenAIApiKey: process.env.AZURE_OPENAI_API_KEY, + azureOpenAIApiVersion: process.env.AZURE_OPENAI_API_VERSION, + azureOpenAIApiInstanceName: process.env.AZURE_OPENAI_API_INSTANCE_NAME, + azureOpenAIApiDeploymentName: + process.env.AZURE_OPENAI_API_DEPLOYMENT_NAME, + timeout: this.options.openaiTimeoutMS, + maxRetries: this.options.openaiRetries + }) + this.api = new ConversationChain({ + memory: new BufferMemory({returnMessages: true, memoryKey: 'history'}), + prompt: chatPrompt, + llm: this.model + }) + } else { + const err = + "Unable to initialize the OpenAI API, both 'AZURE_OPENAI_API_KEY' environment variable are not available" + throw new Error(err) + } ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
typescript
508
coderabbitai
github-actions[bot]
@@ -18,83 +15,78 @@ export interface Ids { } export class Bot { - private readonly api: ChatGPTAPI | null = null // not free + private readonly model: ChatOpenAI | null = null + private readonly api: ConversationChain | null = null private readonly options: Options constructor(options: Options, openaiOptions: OpenAIOptions) { this.options = options - if (process.env.OPENAI_API_KEY) { + if ( + process.env.AZURE_OPENAI_API_KEY && + process.env.AZURE_OPENAI_API_VERSION && + process.env.AZURE_OPENAI_API_INSTANCE_NAME && + process.env.AZURE_OPENAI_API_DEPLOYMENT_NAME + ) { const currentDate = new Date().toISOString().split('T')[0] - const systemMessage = `${options.systemMessage} -Knowledge cutoff: ${openaiOptions.tokenLimits.knowledgeCutOff} -Current date: ${currentDate} + const systemMessage = `${options.systemMessage} + Knowledge cutoff: ${openaiOptions.tokenLimits.knowledgeCutOff} + Current date: ${currentDate} + + IMPORTANT: Entire response must be in the language with ISO code: ${options.language} + ` + const chatPrompt = ChatPromptTemplate.fromMessages([ + ['system', systemMessage], + new MessagesPlaceholder('history'), + ['human', '{input}'] + ]) -IMPORTANT: Entire response must be in the language with ISO code: ${options.language} -` - - this.api = new ChatGPTAPI({ - apiBaseUrl: options.apiBaseUrl, - systemMessage, - apiKey: process.env.OPENAI_API_KEY, - apiOrg: process.env.OPENAI_API_ORG ?? undefined, - debug: options.debug, - maxModelTokens: openaiOptions.tokenLimits.maxTokens, - maxResponseTokens: openaiOptions.tokenLimits.responseTokens, - completionParams: { - temperature: options.openaiModelTemperature, - model: openaiOptions.model - } + this.model = new ChatOpenAI({ + temperature: options.openaiModelTemperature, + azureOpenAIApiKey: process.env.AZURE_OPENAI_API_KEY, + azureOpenAIApiVersion: process.env.AZURE_OPENAI_API_VERSION, + azureOpenAIApiInstanceName: process.env.AZURE_OPENAI_API_INSTANCE_NAME, + azureOpenAIApiDeploymentName: + process.env.AZURE_OPENAI_API_DEPLOYMENT_NAME, + timeout: this.options.openaiTimeoutMS, + maxRetries: this.options.openaiRetries + }) + this.api = new ConversationChain({ + memory: new BufferMemory({returnMessages: true, memoryKey: 'history'}), + prompt: chatPrompt, + llm: this.model }) } else { const err = - "Unable to initialize the OpenAI API, both 'OPENAI_API_KEY' environment variable are not available" + "Unable to initialize the OpenAI API, both 'AZURE_OPENAI_API_KEY' environment variable are not available" throw new Error(err) } } - chat = async (message: string, ids: Ids): Promise<[string, Ids]> => { - let res: [string, Ids] = ['', {}] + chat = async (message: string): Promise<string> => { + let res: string = '' try { - res = await this.chat_(message, ids) + res = await this.chat_(message) return res } catch (e: unknown) { - if (e instanceof ChatGPTError) { - warning(`Failed to chat: ${e}, backtrace: ${e.stack}`) - } return res } }
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The `chat` method has been simplified and no longer returns an array. It's important to ensure that all calls to this method have been updated accordingly. ```diff - chat = async (message: string, ids: Ids): Promise<[string, Ids]> => { - let res: [string, Ids] = ['', {}] - try { - res = await this.chat_(message, ids) - return res - } catch (e: unknown) { - if (e instanceof ChatGPTError) { - warning(`Failed to chat: ${e}, backtrace: ${e.stack}`) - } - return res - } - } + chat = async (message: string): Promise<string> => { + let res: string = '' + try { + res = await this.chat_(message) + return res + } catch (e: unknown) { + return res + } + } ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
typescript
508
coderabbitai
github-actions[bot]
@@ -18,83 +15,78 @@ export interface Ids { } export class Bot { - private readonly api: ChatGPTAPI | null = null // not free + private readonly model: ChatOpenAI | null = null + private readonly api: ConversationChain | null = null private readonly options: Options constructor(options: Options, openaiOptions: OpenAIOptions) { this.options = options - if (process.env.OPENAI_API_KEY) { + if ( + process.env.AZURE_OPENAI_API_KEY && + process.env.AZURE_OPENAI_API_VERSION && + process.env.AZURE_OPENAI_API_INSTANCE_NAME && + process.env.AZURE_OPENAI_API_DEPLOYMENT_NAME + ) { const currentDate = new Date().toISOString().split('T')[0] - const systemMessage = `${options.systemMessage} -Knowledge cutoff: ${openaiOptions.tokenLimits.knowledgeCutOff} -Current date: ${currentDate} + const systemMessage = `${options.systemMessage} + Knowledge cutoff: ${openaiOptions.tokenLimits.knowledgeCutOff} + Current date: ${currentDate} + + IMPORTANT: Entire response must be in the language with ISO code: ${options.language} + ` + const chatPrompt = ChatPromptTemplate.fromMessages([ + ['system', systemMessage], + new MessagesPlaceholder('history'), + ['human', '{input}'] + ]) -IMPORTANT: Entire response must be in the language with ISO code: ${options.language} -` - - this.api = new ChatGPTAPI({ - apiBaseUrl: options.apiBaseUrl, - systemMessage, - apiKey: process.env.OPENAI_API_KEY, - apiOrg: process.env.OPENAI_API_ORG ?? undefined, - debug: options.debug, - maxModelTokens: openaiOptions.tokenLimits.maxTokens, - maxResponseTokens: openaiOptions.tokenLimits.responseTokens, - completionParams: { - temperature: options.openaiModelTemperature, - model: openaiOptions.model - } + this.model = new ChatOpenAI({ + temperature: options.openaiModelTemperature, + azureOpenAIApiKey: process.env.AZURE_OPENAI_API_KEY, + azureOpenAIApiVersion: process.env.AZURE_OPENAI_API_VERSION, + azureOpenAIApiInstanceName: process.env.AZURE_OPENAI_API_INSTANCE_NAME, + azureOpenAIApiDeploymentName: + process.env.AZURE_OPENAI_API_DEPLOYMENT_NAME, + timeout: this.options.openaiTimeoutMS, + maxRetries: this.options.openaiRetries + }) + this.api = new ConversationChain({ + memory: new BufferMemory({returnMessages: true, memoryKey: 'history'}), + prompt: chatPrompt, + llm: this.model }) } else { const err = - "Unable to initialize the OpenAI API, both 'OPENAI_API_KEY' environment variable are not available" + "Unable to initialize the OpenAI API, both 'AZURE_OPENAI_API_KEY' environment variable are not available" throw new Error(err) } } - chat = async (message: string, ids: Ids): Promise<[string, Ids]> => { - let res: [string, Ids] = ['', {}] + chat = async (message: string): Promise<string> => { + let res: string = '' try { - res = await this.chat_(message, ids) + res = await this.chat_(message) return res } catch (e: unknown) { - if (e instanceof ChatGPTError) { - warning(`Failed to chat: ${e}, backtrace: ${e.stack}`) - } return res } } - private readonly chat_ = async ( - message: string, - ids: Ids - ): Promise<[string, Ids]> => { + private readonly chat_ = async (message: string): Promise<string> => { // record timing const start = Date.now() if (!message) { - return ['', {}] + return '' } - let response: ChatMessage | undefined + let response: ChainValues | undefined if (this.api != null) { - const opts: SendMessageOptions = { - timeoutMs: this.options.openaiTimeoutMS - } - if (ids.parentMessageId) { - opts.parentMessageId = ids.parentMessageId - } try { - response = await pRetry(() => this.api!.sendMessage(message, opts), { - retries: this.options.openaiRetries - }) + response = await this.api.call({input: message}) } catch (e: unknown) { - if (e instanceof ChatGPTError) { - info( - `response: ${response}, failed to send message to openai: ${e}, backtrace: ${e.stack}` - ) - } + info(`response: ${response}, failed to send message to openai: ${e}`)
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The `chat_` method has been significantly modified. It no longer uses the `pRetry` function or the `SendMessageOptions` type from the old `chatgpt` package. Instead, it directly calls the `api` property's `call` method. This change should be thoroughly tested to ensure correct behavior. ```diff - private readonly chat_ = async ( - message: string, - ids: Ids - ): Promise<[string, Ids]> => { - // record timing - const start = Date.now() - if (!message) { - return ['', {}] - } - - let response: ChatMessage | undefined - - if (this.api != null) { - const opts: SendMessageOptions = { - timeoutMs: this.options.openaiTimeoutMS - } - if (ids.parentMessageId) { - opts.parentMessageId = ids.parentMessageId - } - try { - response = await pRetry(() => this.api!.sendMessage(message, opts), { - retries: this.options.openaiRetries - }) - } catch (e: unknown) { - if (e instanceof ChatGPTError) { - info( - `response: ${response}, failed to send message to openai: ${e}, backtrace: ${e.stack}` - ) - } - } - const end = Date.now() - info(`response: ${JSON.stringify(response)}`) + private readonly chat_ = async (message: string): Promise<string> => { + // record timing + const start = Date.now() + if (!message) { + return '' + } + + let response: ChainValues | undefined + + if (this.api != null) { + try { + response = await this.api.call({input: message}) + } catch (e: unknown) { + info(`response: ${response}, failed to send message to openai: ${e}`) + } + const end = Date.now() + info(`response: ${JSON.stringify(response)}`) ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
typescript
504
coderabbitai
github-actions[bot]
@@ -6,18 +6,28 @@ export class TokenLimits { constructor(model = 'gpt-3.5-turbo') { this.knowledgeCutOff = '2021-09-01' - if (model === 'gpt-4-32k') { - this.maxTokens = 32600 - this.responseTokens = 4000 - } else if (model === 'gpt-3.5-turbo-16k') { - this.maxTokens = 16300 - this.responseTokens = 3000 - } else if (model === 'gpt-4') { - this.maxTokens = 8000 - this.responseTokens = 2000 - } else { - this.maxTokens = 4000 - this.responseTokens = 1000 + switch (model) { + case 'gpt-4-1106-preview': + this.maxTokens = 128000 + this.responseTokens = 4000 + this.knowledgeCutOff = '2023-04-01' + break + case 'gpt-4': + this.maxTokens = 8000 + this.responseTokens = 2000 + break + case 'gpt-4-32k': + this.maxTokens = 32600 + this.responseTokens = 4000 + break + case 'gpt-3.5-turbo-16k': + this.maxTokens = 16300 + this.responseTokens = 3000 + break + default: + this.maxTokens = 4000 + this.responseTokens = 1000 + break
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The switch-case statement is a good improvement over the previous if-else chain for readability and maintainability. However, there's no error handling or notification when an unsupported model is passed to the constructor. It would be beneficial to throw an error in the default case when an unsupported model is provided. ```diff default: this.maxTokens = 4000 this.responseTokens = 1000 + throw new Error(`Unsupported model: ${model}`); break ``` This way, developers will be immediately aware when they are trying to use an unsupported model, rather than having it silently default to certain values. <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
500
coderabbitai
github-actions[bot]
@@ -1,6 +1,12 @@ -# AI-based PR reviewer and summarizer +# CodeRabbit Pro + +This is an old version of [CodeRabbit](http://coderabbit.ai) and is now in the mainatance mode.
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit There's a typo in the word "maintenance". It should be corrected to maintain professionalism and clarity. ```diff - This is an old version of [CodeRabbit](http://coderabbit.ai) and is now in the mainatance mode. + This is an old version of [CodeRabbit](http://coderabbit.ai) and is now in the maintenance mode. ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
500
coderabbitai
github-actions[bot]
@@ -1,6 +1,12 @@ -# AI-based PR reviewer and summarizer +# CodeRabbit Pro + +This is an old version of [CodeRabbit](http://coderabbit.ai) and is now in the maintenance mode. +We recommend installing the Pro version from [CodeRabbit](http://coderabbit.ai). The Pro version is a total redesign and offers significantly better reviews that learn from your usage and improve over time. CodeRabbit Pro is free for open source projects. [![Discord](https://img.shields.io/badge/Join%20us%20on-Discord-blue?logo=discord&style=flat-square)](https://discord.gg/GsXnASn26c) + +# AI-based PR reviewer and summarizer +
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The changes made to the README file are clear and informative. However, it seems like there's a formatting issue with the badges for Discord, license, and last commit information. They should be on the same line as the title of the section they belong to, or at least in a new line right after the title. ```diff - 8: # AI-based PR reviewer and summarizer - 9: - [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) - [![GitHub](https://img.shields.io/github/last-commit/coderabbitai/ai-pr-reviewer/main?style=flat-square)](https://github.com/coderabbitai/ai-pr-reviewer/commits/main) + 8: # AI-based PR reviewer and summarizer + [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) + [![GitHub](https://img.shields.io/github/last-commit/coderabbitai/ai-pr-reviewer/main?style=flat-square)](https://github.com/coderabbitai/ai-pr-reviewer/commits/main) ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
python
499
coderabbitai
github-actions[bot]
@@ -0,0 +1,9 @@ + +def add(x, y): + z = x + y + k = 3 + l = 'ff' + return z
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The variables `k` and `l` are defined but not used in the function `add`. This is unnecessary and can lead to confusion. If these variables are not needed, consider removing them. ```diff - k = 3 - l = 'ff' ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
499
coderabbitai
github-actions[bot]
@@ -0,0 +1,36 @@ +name: OpenAI Reviewer + +permissions: + contents: read + pull-requests: write + +on: [push] + + +concurrency: + group: + ${{ github.repository }}-${{ github.event.number || github.head_ref || + github.sha }}-${{ github.workflow }}-${{ github.event_name == + 'pull_request_review_comment' && 'pr_comment' || 'pr' }} + cancel-in-progress: ${{ github.event_name != 'pull_request_review_comment' }} + +jobs: + review: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + repository: ${{github.event.pull_request.head.repo.full_name}} + ref: ${{github.event.pull_request.head.ref}} + submodules: false + - uses: ./ + env: + GITHUB_TOKEN: ${{ secrets.GGITHUB_TOKEN }} + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + with: + debug: true + review_comment_lgtm: false + openai_heavy_model: gpt-4 + path_filters: | + !dist/** + !**/*.lock
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The workflow file seems to be well structured and follows the standard conventions for GitHub Actions. However, there's a typo in line 28 where `GGITHUB_TOKEN` should be `GITHUB_TOKEN`. This could lead to an error as the incorrect environment variable name is used. ```diff - GITHUB_TOKEN: ${{ secrets.GGITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} ``` Also, it's important to note that storing sensitive keys like `OPENAI_API_KEY` directly in the workflow file can pose a security risk. It's recommended to use GitHub Secrets to store such sensitive information securely. But since you're already using `secrets.OPENAI_API_KEY`, it seems you're following best practices here. Lastly, please ensure that the custom action (referenced by `- uses: ./`) exists in your repository and works as expected. If not, this could cause the workflow to fail. <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
499
coderabbitai
github-actions[bot]
@@ -0,0 +1,39 @@ +name: OpenAI Reviewer + +permissions: + contents: read + pull-requests: write + +on: + pull_request_target: + types: [opened, synchronize, reopened] + pull_request_review_comment: + types: [created] + +concurrency: + group: + ${{ github.repository }}-${{ github.event.number || github.head_ref || + github.sha }}-${{ github.workflow }}-${{ github.event_name == + 'pull_request_review_comment' && 'pr_comment' || 'pr' }} + cancel-in-progress: ${{ github.event_name != 'pull_request_review_comment' }} + +jobs: + review: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + repository: ${{github.event.pull_request.head.repo.full_name}} + ref: ${{github.event.pull_request.head.ref}} + submodules: false + - uses: ./ + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + with: + debug: true + review_comment_lgtm: false + openai_heavy_model: gpt-4 + path_filters: | + !dist/** + !**/*.lock
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The workflow file seems to be well structured and follows the standard conventions for GitHub Actions. It correctly sets up the job to run on `ubuntu-latest`, checks out the repository, and runs a custom action with environment variables and parameters. However, I noticed that you are using `pull_request_target` as an event trigger. This event runs in the context of the base repository of the pull request, not in the forked repository. This means it has access to secrets from the base repository. If your workflow allows for arbitrary code execution (for example, by accepting a script as an input parameter), this could potentially expose your secrets to a malicious actor. If your workflow does not need to access secrets or write access to the repository, consider changing the event to `pull_request` instead of `pull_request_target`. If you do need these permissions, make sure your workflow does not execute untrusted code and carefully review additions to this workflow. ```diff - pull_request_target: + pull_request: ``` Also, please ensure that the secret `OPENAI_API_KEY` is properly secured and has the minimum necessary permissions, as it's being used here in the workflow. Lastly, the `path_filters` section is excluding changes in `dist/**` and `**/*.lock` files from triggering the workflow. Make sure this aligns with your project requirements. <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
487
coderabbitai
github-actions[bot]
@@ -39,7 +39,7 @@ "devDependencies": { "@jest/globals": "^29.5.0", "@types/node": "^20.4.2", - "@typescript-eslint/eslint-plugin": "^5.59.6", + "@typescript-eslint/eslint-plugin": "^6.8.0",
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The `@typescript-eslint/eslint-plugin` package has been updated from version `5.59.6` to `6.8.0`. Please ensure that this update does not introduce breaking changes and is compatible with other packages in your project. If the project has a test suite, it would be beneficial to run it to catch potential issues early. <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
479
coderabbitai
github-actions[bot]
@@ -39,7 +39,7 @@ "devDependencies": { "@jest/globals": "^29.5.0", "@types/node": "^20.4.2", - "@typescript-eslint/eslint-plugin": "^5.59.6", + "@typescript-eslint/eslint-plugin": "^6.7.5",
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The version of `@typescript-eslint/eslint-plugin` has been updated from `5.59.6` to `6.7.5`. Please ensure that this new version is compatible with the other packages in your project and that it doesn't introduce any breaking changes. If you have tests set up, running them would be a good way to verify this. <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
479
coderabbitai
github-actions[bot]
@@ -23,7 +23,7 @@ "devDependencies": { "@jest/globals": "^29.5.0", "@types/node": "^20.4.2", - "@typescript-eslint/eslint-plugin": "^5.59.6", + "@typescript-eslint/eslint-plugin": "^6.7.5",
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The version of `@typescript-eslint/eslint-plugin` has been updated from `5.59.6` to `6.7.5`. Please ensure that this update does not introduce breaking changes and is compatible with the rest of the codebase. ```diff - "@typescript-eslint/eslint-plugin": "^5.59.6", + "@typescript-eslint/eslint-plugin": "^6.7.5", ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
479
coderabbitai
github-actions[bot]
@@ -2216,9 +2216,9 @@ } }, "node_modules/@types/json-schema": { - "version": "7.0.11", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", - "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", + "version": "7.0.13", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.13.tgz", + "integrity": "sha512-RbSSoHliUbnXj3ny0CNFOoxrIDV6SUGyStHsvDqosw6CkdPV8TtWGlfecuK4ToyMEAql6pzNxgCFKanovUzlgQ==",
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The version of `@types/json-schema` has been updated from `7.0.11` to `7.0.13`. Ensure that this new version is compatible with your project. ```diff - "version": "7.0.11", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", - "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", + "version": "7.0.13", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.13.tgz", + "integrity": "sha512-RbSSoHliUbnXj3ny0CNFOoxrIDV6SUGyStHsvDqosw6CkdPV8TtWGlfecuK4ToyMEAql6pzNxgCFKanovUzlgQ==", ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
479
coderabbitai
github-actions[bot]
@@ -2251,9 +2251,9 @@ "integrity": "sha512-xoDlM2S4ortawSWORYqsdU+2rxdh4LRW9ytc3zmT37RIKQh6IHyKwwtKhKis9ah8ol07DCkZxPt8BBvPjC6v4g==" }, "node_modules/@types/semver": { - "version": "7.3.13", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz", - "integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==", + "version": "7.5.3", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.3.tgz", + "integrity": "sha512-OxepLK9EuNEIPxWNME+C6WwbRAOOI2o2BaQEGzz5Lu2e4Z5eDnEo+/aVEDMIXywoJitJ7xWd641wrGLZdtwRyw==",
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The version of `@types/semver` has been updated from `7.3.13` to `7.5.3`. Please ensure that this update does not introduce breaking changes and is compatible with the rest of the codebase. ```diff - "version": "7.3.13", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz", - "integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==", + "version": "7.5.3", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.3.tgz", + "integrity": "sha512-OxepLK9EuNEIPxWNME+C6WwbRAOOI2o2BaQEGzz5Lu2e4Z5eDnEo+/aVEDMIXywoJitJ7xWd641wrGLZdtwRyw==", ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
481
coderabbitai
github-actions[bot]
@@ -1,39 +1,77 @@ -name: OpenAI Reviewer +name: ai-pr-reviewer permissions: contents: read pull-requests: write
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The permissions set for the GitHub Actions workflow are appropriate and follow the principle of least privilege. The `contents: read` permission allows the action to read repository content, and `pull-requests: write` allows it to write pull request data. <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
481
coderabbitai
github-actions[bot]
@@ -1,39 +1,77 @@ -name: OpenAI Reviewer +name: ai-pr-reviewer permissions: contents: read pull-requests: write on: - pull_request_target: - types: [opened, synchronize, reopened] + pull_request: + types: [opened] + branches-ignore: + - master + - main pull_request_review_comment: types: [created] + issue_comment: + types: [created]
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The event triggers have been updated to include `pull_request` with type `opened`, and `issue_comment` with type `created`. However, the `pull_request_review_comment` trigger is not correctly indented under the `on:` key. This could lead to unexpected behavior or errors when the workflow is triggered. ```diff -13: pull_request_review_comment: +13: pull_request_review_comment: ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
481
coderabbitai
github-actions[bot]
@@ -1,39 +1,77 @@ -name: OpenAI Reviewer +name: ai-pr-reviewer permissions: contents: read pull-requests: write on: - pull_request_target: - types: [opened, synchronize, reopened] + pull_request: + types: [opened] + branches-ignore: + - master + - main pull_request_review_comment: types: [created] + issue_comment: + types: [created] concurrency: - group: - ${{ github.repository }}-${{ github.event.number || github.head_ref || - github.sha }}-${{ github.workflow }}-${{ github.event_name == - 'pull_request_review_comment' && 'pr_comment' || 'pr' }} + group: ${{ github.repository }}-${{ github.event.number || github.head_ref || github.sha }}-${{ github.workflow }}-${{ github.event_name == 'pull_request_review_comment' && 'pr_comment' || 'pr' }} cancel-in-progress: ${{ github.event_name != 'pull_request_review_comment' }}
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The concurrency settings seem fine. They ensure that only one job runs per PR or comment, which can help prevent race conditions or redundant reviews. <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
481
coderabbitai
github-actions[bot]
@@ -1,39 +1,77 @@ -name: OpenAI Reviewer +name: ai-pr-reviewer permissions: contents: read pull-requests: write on: - pull_request_target: - types: [opened, synchronize, reopened] + pull_request: + types: [opened] + branches-ignore: + - master + - main pull_request_review_comment: types: [created] + issue_comment: + types: [created] concurrency: - group: - ${{ github.repository }}-${{ github.event.number || github.head_ref || - github.sha }}-${{ github.workflow }}-${{ github.event_name == - 'pull_request_review_comment' && 'pr_comment' || 'pr' }} + group: ${{ github.repository }}-${{ github.event.number || github.head_ref || github.sha }}-${{ github.workflow }}-${{ github.event_name == 'pull_request_review_comment' && 'pr_comment' || 'pr' }} cancel-in-progress: ${{ github.event_name != 'pull_request_review_comment' }} jobs: review: runs-on: ubuntu-latest + if: (github.event_name == 'issue_comment' && contains(github.event.comment.body, '[run review]') && github.event.issue.pull_request) || (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '[run review]')) || (github.event_name == 'pull_request' && !contains(github.event.pull_request.title, 'release') && !contains(github.event.pull_request.title, 'Release')) + timeout-minutes: 15
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The job setup looks good. It's set to run on `ubuntu-latest` and has a timeout of 15 minutes. The condition for running the job seems complex but valid, triggering on issue comments, pull request review comments, and pull requests that don't have 'release' in the title. <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
481
coderabbitai
github-actions[bot]
@@ -1,39 +1,77 @@ -name: OpenAI Reviewer +name: ai-pr-reviewer permissions: contents: read pull-requests: write on: - pull_request_target: - types: [opened, synchronize, reopened] + pull_request: + types: [opened] + branches-ignore: + - master + - main pull_request_review_comment: types: [created] + issue_comment: + types: [created] concurrency: - group: - ${{ github.repository }}-${{ github.event.number || github.head_ref || - github.sha }}-${{ github.workflow }}-${{ github.event_name == - 'pull_request_review_comment' && 'pr_comment' || 'pr' }} + group: ${{ github.repository }}-${{ github.event.number || github.head_ref || github.sha }}-${{ github.workflow }}-${{ github.event_name == 'pull_request_review_comment' && 'pr_comment' || 'pr' }} cancel-in-progress: ${{ github.event_name != 'pull_request_review_comment' }} jobs: review: runs-on: ubuntu-latest + if: (github.event_name == 'issue_comment' && contains(github.event.comment.body, '[run review]') && github.event.issue.pull_request) || (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '[run review]')) || (github.event_name == 'pull_request' && !contains(github.event.pull_request.title, 'release') && !contains(github.event.pull_request.title, 'Release')) + timeout-minutes: 15 steps: - - uses: actions/checkout@v3 - with: - repository: ${{github.event.pull_request.head.repo.full_name}} - ref: ${{github.event.pull_request.head.ref}} - submodules: false - - uses: ./ + - uses: coderabbitai/openai-pr-reviewer@latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} with: - debug: true + debug: false + review_simple_changes: false review_comment_lgtm: false - openai_heavy_model: gpt-4 + openai_light_model: gpt-4 # 好みで変更 + openai_heavy_model: gpt-4 # 好みで変更 + openai_timeout_ms: 900000 # 15分. + language: ja-JP
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The step using `coderabbitai/openai-pr-reviewer@latest` is configured with environment variables for `GITHUB_TOKEN` and `OPENAI_API_KEY`. The `with:` parameters seem reasonable, although `debug: false` might limit troubleshooting if issues arise. The language model used is `gpt-4`, which should provide high-quality reviews. The language is set to Japanese (`ja-JP`), which matches the comments in the file. <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
481
coderabbitai
github-actions[bot]
@@ -1,39 +1,77 @@ -name: OpenAI Reviewer +name: ai-pr-reviewer permissions: contents: read pull-requests: write on: - pull_request_target: - types: [opened, synchronize, reopened] + pull_request: + types: [opened] + branches-ignore: + - master + - main pull_request_review_comment: types: [created] + issue_comment: + types: [created] concurrency: - group: - ${{ github.repository }}-${{ github.event.number || github.head_ref || - github.sha }}-${{ github.workflow }}-${{ github.event_name == - 'pull_request_review_comment' && 'pr_comment' || 'pr' }} + group: ${{ github.repository }}-${{ github.event.number || github.head_ref || github.sha }}-${{ github.workflow }}-${{ github.event_name == 'pull_request_review_comment' && 'pr_comment' || 'pr' }} cancel-in-progress: ${{ github.event_name != 'pull_request_review_comment' }} jobs: review: runs-on: ubuntu-latest + if: (github.event_name == 'issue_comment' && contains(github.event.comment.body, '[run review]') && github.event.issue.pull_request) || (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '[run review]')) || (github.event_name == 'pull_request' && !contains(github.event.pull_request.title, 'release') && !contains(github.event.pull_request.title, 'Release')) + timeout-minutes: 15 steps: - - uses: actions/checkout@v3 - with: - repository: ${{github.event.pull_request.head.repo.full_name}} - ref: ${{github.event.pull_request.head.ref}} - submodules: false - - uses: ./ + - uses: coderabbitai/openai-pr-reviewer@latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} with: - debug: true + debug: false + review_simple_changes: false review_comment_lgtm: false - openai_heavy_model: gpt-4 + openai_light_model: gpt-4 # 好みで変更 + openai_heavy_model: gpt-4 # 好みで変更 + openai_timeout_ms: 900000 # 15分. + language: ja-JP path_filters: | - !dist/** + !db/** !**/*.lock
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The path filters exclude database files and lock files from the review. This seems reasonable as these files typically don't need code review. <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
481
coderabbitai
github-actions[bot]
@@ -1,39 +1,77 @@ -name: OpenAI Reviewer +name: ai-pr-reviewer permissions: contents: read pull-requests: write on: - pull_request_target: - types: [opened, synchronize, reopened] + pull_request: + types: [opened] + branches-ignore: + - master + - main pull_request_review_comment: types: [created] + issue_comment: + types: [created] concurrency: - group: - ${{ github.repository }}-${{ github.event.number || github.head_ref || - github.sha }}-${{ github.workflow }}-${{ github.event_name == - 'pull_request_review_comment' && 'pr_comment' || 'pr' }} + group: ${{ github.repository }}-${{ github.event.number || github.head_ref || github.sha }}-${{ github.workflow }}-${{ github.event_name == 'pull_request_review_comment' && 'pr_comment' || 'pr' }} cancel-in-progress: ${{ github.event_name != 'pull_request_review_comment' }} jobs: review: runs-on: ubuntu-latest + if: (github.event_name == 'issue_comment' && contains(github.event.comment.body, '[run review]') && github.event.issue.pull_request) || (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '[run review]')) || (github.event_name == 'pull_request' && !contains(github.event.pull_request.title, 'release') && !contains(github.event.pull_request.title, 'Release')) + timeout-minutes: 15 steps: - - uses: actions/checkout@v3 - with: - repository: ${{github.event.pull_request.head.repo.full_name}} - ref: ${{github.event.pull_request.head.ref}} - submodules: false - - uses: ./ + - uses: coderabbitai/openai-pr-reviewer@latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} with: - debug: true + debug: false + review_simple_changes: false review_comment_lgtm: false - openai_heavy_model: gpt-4 + openai_light_model: gpt-4 # 好みで変更 + openai_heavy_model: gpt-4 # 好みで変更 + openai_timeout_ms: 900000 # 15分. + language: ja-JP path_filters: | - !dist/** + !db/** !**/*.lock + system_message: | + あなたは @coderabbitai(別名 github-actions[bot])で、OpenAIによって訓練された言語モデルです。 + あなたの目的は、非常に経験豊富なソフトウェアエンジニアとして機能し、コードの一部を徹底的にレビューし、 + 以下のようなキーエリアを改善するためのコードスニペットを提案することです: + - ロジック + - セキュリティ + - パフォーマンス + - データ競合 + - 一貫性 + - エラー処理 + - 保守性 + - モジュール性 + - 複雑性 + - 最適化 + - ベストプラクティス: DRY, SOLID, KISS + + 些細なコードスタイルの問題や、コメント・ドキュメントの欠落についてはコメントしないでください。 + 重要な問題を特定し、解決して全体的なコード品質を向上させることを目指してくださいが、細かい問題は意図的に無視してください。 + summarize: |
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The system message is written in Japanese and provides a detailed explanation of the bot's purpose and capabilities. This is a good practice for clarity and user understanding. <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
481
coderabbitai
github-actions[bot]
@@ -1,39 +1,77 @@ -name: OpenAI Reviewer +name: ai-pr-reviewer permissions: contents: read pull-requests: write on: - pull_request_target: - types: [opened, synchronize, reopened] + pull_request: + types: [opened] + branches-ignore: + - master + - main pull_request_review_comment: types: [created] + issue_comment: + types: [created] concurrency: - group: - ${{ github.repository }}-${{ github.event.number || github.head_ref || - github.sha }}-${{ github.workflow }}-${{ github.event_name == - 'pull_request_review_comment' && 'pr_comment' || 'pr' }} + group: ${{ github.repository }}-${{ github.event.number || github.head_ref || github.sha }}-${{ github.workflow }}-${{ github.event_name == 'pull_request_review_comment' && 'pr_comment' || 'pr' }} cancel-in-progress: ${{ github.event_name != 'pull_request_review_comment' }} jobs: review: runs-on: ubuntu-latest + if: (github.event_name == 'issue_comment' && contains(github.event.comment.body, '[run review]') && github.event.issue.pull_request) || (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '[run review]')) || (github.event_name == 'pull_request' && !contains(github.event.pull_request.title, 'release') && !contains(github.event.pull_request.title, 'Release')) + timeout-minutes: 15 steps: - - uses: actions/checkout@v3 - with: - repository: ${{github.event.pull_request.head.repo.full_name}} - ref: ${{github.event.pull_request.head.ref}} - submodules: false - - uses: ./ + - uses: coderabbitai/openai-pr-reviewer@latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} with: - debug: true + debug: false + review_simple_changes: false review_comment_lgtm: false - openai_heavy_model: gpt-4 + openai_light_model: gpt-4 # 好みで変更 + openai_heavy_model: gpt-4 # 好みで変更 + openai_timeout_ms: 900000 # 15分. + language: ja-JP path_filters: | - !dist/** + !db/** !**/*.lock + system_message: | + あなたは @coderabbitai(別名 github-actions[bot])で、OpenAIによって訓練された言語モデルです。 + あなたの目的は、非常に経験豊富なソフトウェアエンジニアとして機能し、コードの一部を徹底的にレビューし、 + 以下のようなキーエリアを改善するためのコードスニペットを提案することです: + - ロジック + - セキュリティ + - パフォーマンス + - データ競合 + - 一貫性 + - エラー処理 + - 保守性 + - モジュール性 + - 複雑性 + - 最適化 + - ベストプラクティス: DRY, SOLID, KISS + + 些細なコードスタイルの問題や、コメント・ドキュメントの欠落についてはコメントしないでください。 + 重要な問題を特定し、解決して全体的なコード品質を向上させることを目指してくださいが、細かい問題は意図的に無視してください。 + summarize: | + 次の内容でmarkdownフォーマットを使用して、最終的な回答を提供してください。 + + - *ウォークスルー*: 特定のファイルではなく、全体の変更に関する高レベルの要約を80語以内で。 + - *変更点*: ファイルとその要約のテーブル。スペースを節約するために、同様の変更を持つファイルを1行にまとめることができます。 + + GitHubのプルリクエストにコメントとして追加されるこの要約には、追加のコメントを避けてください。 + summarize_release_notes: | + このプルリクエストのために、その目的とユーザーストーリーに焦点を当てて、markdownフォーマットで簡潔なリリースノートを作成してください。 + 変更は次のように分類し箇条書きにすること: + "New Feature", "Bug fix", "Documentation", "Refactor", "Style", + "Test", "Chore", "Revert" + 例えば: + ``` + - New Feature: UIに統合ページが追加されました + ``` + 回答は50-100語以内にしてください。この回答はそのままリリースノートに使用されるので、追加のコメントは避けてください。
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The `summarize` and `summarize_release_notes` options are set with detailed instructions in Japanese. These settings seem to be well thought out and should provide useful summaries and release notes. <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
474
coderabbitai
github-actions[bot]
@@ -39,7 +39,7 @@ "devDependencies": { "@jest/globals": "^29.5.0", "@types/node": "^20.4.2", - "@typescript-eslint/eslint-plugin": "^5.59.6", + "@typescript-eslint/eslint-plugin": "^6.7.4",
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The update from `@typescript-eslint/eslint-plugin` version `5.62.0` to `6.7.4` is a major version change. This could potentially introduce breaking changes. Please ensure that you have thoroughly tested your application after this update, especially areas where this plugin is used for linting TypeScript code. If any issues arise due to the update, consider looking into the specific changes between these versions as mentioned in the release notes and adjust your code accordingly. <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
474
coderabbitai
github-actions[bot]
@@ -23,7 +23,7 @@ "devDependencies": { "@jest/globals": "^29.5.0", "@types/node": "^20.4.2", - "@typescript-eslint/eslint-plugin": "^5.59.6", + "@typescript-eslint/eslint-plugin": "^6.7.4",
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The version of `@typescript-eslint/eslint-plugin` has been updated from `5.59.6` to `6.7.4`. Please ensure that this update does not introduce breaking changes and is compatible with the rest of the codebase. <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
474
coderabbitai
github-actions[bot]
@@ -2216,9 +2216,9 @@ } }, "node_modules/@types/json-schema": { - "version": "7.0.11", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", - "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", + "version": "7.0.13", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.13.tgz", + "integrity": "sha512-RbSSoHliUbnXj3ny0CNFOoxrIDV6SUGyStHsvDqosw6CkdPV8TtWGlfecuK4ToyMEAql6pzNxgCFKanovUzlgQ==",
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The version of `@types/json-schema` has been updated from `7.0.11` to `7.0.13`. As this is a patch version update, it's unlikely to cause issues but please verify that there are no breaking changes introduced. <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
474
coderabbitai
github-actions[bot]
@@ -2251,9 +2251,9 @@ "integrity": "sha512-xoDlM2S4ortawSWORYqsdU+2rxdh4LRW9ytc3zmT37RIKQh6IHyKwwtKhKis9ah8ol07DCkZxPt8BBvPjC6v4g==" }, "node_modules/@types/semver": { - "version": "7.3.13", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz", - "integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==", + "version": "7.5.3", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.3.tgz", + "integrity": "sha512-OxepLK9EuNEIPxWNME+C6WwbRAOOI2o2BaQEGzz5Lu2e4Z5eDnEo+/aVEDMIXywoJitJ7xWd641wrGLZdtwRyw==",
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The version of `@types/semver` has been updated from `7.3.13` to `7.5.3`. This is a minor version update, so while it should not introduce breaking changes, it may add new features or improvements. Please ensure these changes are compatible with your project. <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
476
coderabbitai
github-actions[bot]
@@ -30,6 +30,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + BASE_API_URL: ${{ secrets.BASE_API_URL }}
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The addition of the `BASE_API_URL` environment variable is a good practice for maintaining flexibility and configurability in your application. However, please ensure that the `secrets.BASE_API_URL` is properly set in the GitHub secrets for this repository to avoid potential runtime errors or misconfigurations. <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
469
coderabbitai
github-actions[bot]
@@ -39,7 +39,7 @@ "devDependencies": { "@jest/globals": "^29.5.0", "@types/node": "^20.4.2", - "@typescript-eslint/eslint-plugin": "^5.59.6", + "@typescript-eslint/eslint-plugin": "^6.7.3",
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The version of `@typescript-eslint/eslint-plugin` has been updated from `5.59.6` to `6.7.3`. Please ensure that this update does not introduce breaking changes and is compatible with other dependencies, especially `@typescript-eslint/parser` which is still at version `5.59.6`. If necessary, consider updating `@typescript-eslint/parser` as well to maintain compatibility. ```diff - "@typescript-eslint/eslint-plugin": "^5.59.6", + "@typescript-eslint/eslint-plugin": "^6.7.3", ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
469
coderabbitai
github-actions[bot]
@@ -23,7 +23,7 @@ "devDependencies": { "@jest/globals": "^29.5.0", "@types/node": "^20.4.2", - "@typescript-eslint/eslint-plugin": "^5.59.6", + "@typescript-eslint/eslint-plugin": "^6.7.3",
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The version of `@typescript-eslint/eslint-plugin` has been updated from `^5.59.6` to `^6.7.3`. Please ensure that this update does not introduce breaking changes and is compatible with the rest of the codebase. ```diff - "@typescript-eslint/eslint-plugin": "^5.59.6", + "@typescript-eslint/eslint-plugin": "^6.7.3", ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
469
coderabbitai
github-actions[bot]
@@ -2216,9 +2216,9 @@ } }, "node_modules/@types/json-schema": { - "version": "7.0.11", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", - "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", + "version": "7.0.13", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.13.tgz", + "integrity": "sha512-RbSSoHliUbnXj3ny0CNFOoxrIDV6SUGyStHsvDqosw6CkdPV8TtWGlfecuK4ToyMEAql6pzNxgCFKanovUzlgQ==",
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The version of `@types/json-schema` has been updated from `7.0.11` to `7.0.13`. Ensure that this minor version bump doesn't affect any functionalities in your application. ```diff - "version": "7.0.11", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", - "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", + "version": "7.0.13", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.13.tgz", + "integrity": "sha512-RbSSoHliUbnXj3ny0CNFOoxrIDV6SUGyStHsvDqosw6CkdPV8TtWGlfecuK4ToyMEAql6pzNxgCFKanovUzlgQ==", ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
469
coderabbitai
github-actions[bot]
@@ -2251,9 +2251,9 @@ "integrity": "sha512-xoDlM2S4ortawSWORYqsdU+2rxdh4LRW9ytc3zmT37RIKQh6IHyKwwtKhKis9ah8ol07DCkZxPt8BBvPjC6v4g==" }, "node_modules/@types/semver": { - "version": "7.3.13", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz", - "integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==", + "version": "7.5.3", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.3.tgz", + "integrity": "sha512-OxepLK9EuNEIPxWNME+C6WwbRAOOI2o2BaQEGzz5Lu2e4Z5eDnEo+/aVEDMIXywoJitJ7xWd641wrGLZdtwRyw==",
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The version of `@types/semver` has been updated from `7.3.13` to `7.5.3`. Ensure that this minor version bump doesn't affect any functionalities in your application. ```diff - "version": "7.3.13", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz", - "integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==", + "version": "7.5.3", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.3.tgz", + "integrity": "sha512-OxepLK9EuNEIPxWNME+C6WwbRAOOI2o2BaQEGzz5Lu2e4Z5eDnEo+/aVEDMIXywoJitJ7xWd641wrGLZdtwRyw==", ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
463
coderabbitai
github-actions[bot]
@@ -39,7 +39,7 @@ "devDependencies": { "@jest/globals": "^29.5.0", "@types/node": "^20.4.2", - "@typescript-eslint/eslint-plugin": "^5.59.6", + "@typescript-eslint/eslint-plugin": "^6.7.2",
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The update of the `@typescript-eslint/eslint-plugin` from version `5.62.0` to `6.7.2` is a major version change. This could potentially introduce breaking changes. Please ensure that this update does not break any existing functionality and is compatible with other dependencies, especially `@typescript-eslint/parser` which is still at version `^5.59.6`. <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
463
coderabbitai
github-actions[bot]
@@ -23,7 +23,7 @@ "devDependencies": { "@jest/globals": "^29.5.0", "@types/node": "^20.4.2", - "@typescript-eslint/eslint-plugin": "^5.59.6", + "@typescript-eslint/eslint-plugin": "^6.7.2",
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The version of `@typescript-eslint/eslint-plugin` has been updated from `^5.59.6` to `^6.7.2`. Please ensure that this update does not introduce breaking changes and is compatible with the rest of the codebase. ```diff - "@typescript-eslint/eslint-plugin": "^5.59.6", + "@typescript-eslint/eslint-plugin": "^6.7.2", ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
463
coderabbitai
github-actions[bot]
@@ -2216,9 +2216,9 @@ } }, "node_modules/@types/json-schema": { - "version": "7.0.11", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", - "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", + "version": "7.0.13", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.13.tgz", + "integrity": "sha512-RbSSoHliUbnXj3ny0CNFOoxrIDV6SUGyStHsvDqosw6CkdPV8TtWGlfecuK4ToyMEAql6pzNxgCFKanovUzlgQ==",
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The version of `@types/json-schema` has been updated from `7.0.11` to `7.0.13`. Ensure that this new version is compatible with your project and doesn't introduce any breaking changes. ```diff - "version": "7.0.11", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", - "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", + "version": "7.0.13", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.13.tgz", + "integrity": "sha512-RbSSoHliUbnXj3ny0CNFOoxrIDV6SUGyStHsvDqosw6CkdPV8TtWGlfecuK4ToyMEAql6pzNxgCFKanovUzlgQ==", ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
463
coderabbitai
github-actions[bot]
@@ -2251,9 +2251,9 @@ "integrity": "sha512-xoDlM2S4ortawSWORYqsdU+2rxdh4LRW9ytc3zmT37RIKQh6IHyKwwtKhKis9ah8ol07DCkZxPt8BBvPjC6v4g==" }, "node_modules/@types/semver": { - "version": "7.3.13", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz", - "integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==", + "version": "7.5.2", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.2.tgz", + "integrity": "sha512-7aqorHYgdNO4DM36stTiGO3DvKoex9TQRwsJU6vMaFGyqpBA1MNZkz+PG3gaNUPpTAOYhT1WR7M1JyA3fbS9Cw==",
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The version of `@types/semver` has been updated from `7.3.13` to `7.5.2`. Please ensure that this update does not introduce breaking changes and is compatible with the rest of the codebase. ```diff - "version": "7.3.13", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz", - "integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==", + "version": "7.5.2", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.2.tgz", + "integrity": "sha512-7aqorHYgdNO4DM36stTiGO3DvKoex9TQRwsJU6vMaFGyqpBA1MNZkz+PG3gaNUPpTAOYhT1WR7M1JyA3fbS9Cw==", ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
359
coderabbitai
github-actions[bot]
@@ -1999,18 +1999,45 @@ } }, "node_modules/@octokit/plugin-retry": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/@octokit/plugin-retry/-/plugin-retry-4.1.3.tgz", - "integrity": "sha512-3YKBj7d0J/4mpEc4xzMociWsMNl5lZqrpAnYcW6mqiSGF3wFjU+c6GHih6GLClk31JNvKDr0x9jc5cfm7evkZg==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@octokit/plugin-retry/-/plugin-retry-6.0.0.tgz", + "integrity": "sha512-a1/A4A+PB1QoAHQfLJxGHhLfSAT03bR1jJz3GgQJZvty2ozawFWs93MiBQXO7SL2YbO7CIq0Goj4qLOBj8JeMQ==", "dependencies": { - "@octokit/types": "^9.0.0", + "@octokit/request-error": "^5.0.0", + "@octokit/types": "^11.0.0", "bottleneck": "^2.15.3" }, "engines": { - "node": ">= 14" + "node": ">= 18" }, "peerDependencies": { - "@octokit/core": ">=3" + "@octokit/core": ">=5" + }
:robot: OpenAI The updated version of `@octokit/plugin-retry` requires Node.js version 18 or higher and `@octokit/core` version 5 or higher. Please ensure that your project meets these requirements before merging this PR to avoid compatibility issues. <!-- This is an auto-generated comment by OpenAI -->
ai-pr-reviewer
github_2023
others
460
coderabbitai
github-actions[bot]
@@ -39,7 +39,7 @@ "devDependencies": { "@jest/globals": "^29.5.0", "@types/node": "^20.4.2", - "@typescript-eslint/eslint-plugin": "^5.59.6", + "@typescript-eslint/eslint-plugin": "^6.7.0",
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The version of `@typescript-eslint/eslint-plugin` has been updated from `5.62.0` to `6.7.0`. Please ensure that this new version is compatible with the rest of your codebase and doesn't introduce any breaking changes as per its [release notes](https://github.com/typescript-eslint/typescript-eslint/releases). If you have tests in place, make sure they all pass after this update. ```diff - "@typescript-eslint/eslint-plugin": "^5.59.6", + "@typescript-eslint/eslint-plugin": "^6.7.0", ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
460
coderabbitai
github-actions[bot]
@@ -23,7 +23,7 @@ "devDependencies": { "@jest/globals": "^29.5.0", "@types/node": "^20.4.2", - "@typescript-eslint/eslint-plugin": "^5.59.6", + "@typescript-eslint/eslint-plugin": "^6.7.0",
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The version of `@typescript-eslint/eslint-plugin` has been updated from `5.59.6` to `6.7.0`. Please ensure that this update does not introduce breaking changes and is compatible with the rest of the codebase. <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
460
coderabbitai
github-actions[bot]
@@ -2216,9 +2216,9 @@ } }, "node_modules/@types/json-schema": { - "version": "7.0.11", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", - "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", + "version": "7.0.12", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.12.tgz", + "integrity": "sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==",
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The version of `@types/json-schema` has been updated from `7.0.11` to `7.0.12`. This is a minor version update, so it should not introduce any breaking changes, but please verify that it's compatible with your project. <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
460
coderabbitai
github-actions[bot]
@@ -2251,9 +2251,9 @@ "integrity": "sha512-xoDlM2S4ortawSWORYqsdU+2rxdh4LRW9ytc3zmT37RIKQh6IHyKwwtKhKis9ah8ol07DCkZxPt8BBvPjC6v4g==" }, "node_modules/@types/semver": { - "version": "7.3.13", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz", - "integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==", + "version": "7.5.1", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.1.tgz", + "integrity": "sha512-cJRQXpObxfNKkFAZbJl2yjWtJCqELQIdShsogr1d2MilP8dKD9TE/nEKHkJgUNHdGKCQaf9HbIynuV2csLGVLg==",
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The version of `@types/semver` has been updated from `7.3.13` to `7.5.1`. This is a minor version update, so it should not introduce any breaking changes, but please verify that it's compatible with your project. <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
typescript
461
coderabbitai
github-actions[bot]
@@ -1,4 +1,4 @@ -import {info, warning} from '@actions/core' +import {getInput, info, warning} from '@actions/core'
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The `getInput` function from '@actions/core' has been added to the import statement. This function is used to get the input parameters passed to the GitHub Action. However, it's important to validate and sanitize this input before using it in your code to prevent potential security vulnerabilities such as code injection attacks. ```diff + import {getInput, info, warning} from '@actions/core' ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
typescript
461
coderabbitai
github-actions[bot]
@@ -7,7 +7,7 @@ import {octokit} from './octokit' const context = github_context const repo = context.repo -export const COMMENT_GREETING = `<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit` +export const COMMENT_GREETING = `${getInput('bot_icon')} CodeRabbit`
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The hardcoded image tag has been replaced with a call to `getInput('bot_icon')`. This allows users to customize the bot icon. However, there is no validation or sanitization of the input. If the user provides an invalid URL or malicious code, it could lead to unexpected behavior or security issues. Consider adding validation and sanitization for the 'bot_icon' input. ```diff - export const COMMENT_GREETING = `<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit` + export const COMMENT_GREETING = `${getInput('bot_icon')} CodeRabbit` ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
456
coderabbitai
github-actions[bot]
@@ -39,7 +39,7 @@ "devDependencies": { "@jest/globals": "^29.5.0", "@types/node": "^20.4.2", - "@typescript-eslint/eslint-plugin": "^5.59.6", + "@typescript-eslint/eslint-plugin": "^6.6.0",
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The `@typescript-eslint/eslint-plugin` package has been updated from version `5.59.6` to `6.6.0`. Please ensure that this major version upgrade does not introduce breaking changes or incompatibilities with other packages in your project. If you encounter issues, consider checking the package's release notes for potential fixes or workarounds. <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
456
coderabbitai
github-actions[bot]
@@ -23,7 +23,7 @@ "devDependencies": { "@jest/globals": "^29.5.0", "@types/node": "^20.4.2", - "@typescript-eslint/eslint-plugin": "^5.59.6", + "@typescript-eslint/eslint-plugin": "^6.6.0",
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The version of `@typescript-eslint/eslint-plugin` has been updated from `5.59.6` to `6.6.0`. Please ensure that this new version is compatible with the rest of your codebase and doesn't introduce any breaking changes. <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
456
coderabbitai
github-actions[bot]
@@ -2216,9 +2216,9 @@ } }, "node_modules/@types/json-schema": { - "version": "7.0.11", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", - "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", + "version": "7.0.12", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.12.tgz", + "integrity": "sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==",
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The version of `@types/json-schema` has been updated from `7.0.11` to `7.0.12`. As this is a patch update, it's unlikely to cause issues, but please verify that this change doesn't affect your application negatively. <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
456
coderabbitai
github-actions[bot]
@@ -2251,9 +2251,9 @@ "integrity": "sha512-xoDlM2S4ortawSWORYqsdU+2rxdh4LRW9ytc3zmT37RIKQh6IHyKwwtKhKis9ah8ol07DCkZxPt8BBvPjC6v4g==" }, "node_modules/@types/semver": { - "version": "7.3.13", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz", - "integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==", + "version": "7.5.1", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.1.tgz", + "integrity": "sha512-cJRQXpObxfNKkFAZbJl2yjWtJCqELQIdShsogr1d2MilP8dKD9TE/nEKHkJgUNHdGKCQaf9HbIynuV2csLGVLg==",
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The version of `@types/semver` has been updated from `7.3.13` to `7.5.1`. This is a minor version update, so while it shouldn't introduce breaking changes, it may add new features or improvements. Please confirm that these changes are compatible with your project. <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
449
coderabbitai
github-actions[bot]
@@ -39,7 +39,7 @@ "devDependencies": { "@jest/globals": "^29.5.0", "@types/node": "^20.4.2", - "@typescript-eslint/eslint-plugin": "^5.59.6", + "@typescript-eslint/eslint-plugin": "^6.5.0",
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The version of `@typescript-eslint/eslint-plugin` has been updated from `5.59.6` to `6.5.0`. This is a major version update, so please ensure that this new version doesn't introduce breaking changes that could affect your project. Also, make sure to test the project thoroughly after this update. ```diff - "@typescript-eslint/eslint-plugin": "^5.59.6", + "@typescript-eslint/eslint-plugin": "^6.5.0", ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
449
coderabbitai
github-actions[bot]
@@ -23,7 +23,7 @@ "devDependencies": { "@jest/globals": "^29.5.0", "@types/node": "^20.4.2", - "@typescript-eslint/eslint-plugin": "^5.59.6", + "@typescript-eslint/eslint-plugin": "^6.5.0",
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The version of `@typescript-eslint/eslint-plugin` has been updated from `^5.59.6` to `^6.5.0`. This is a major version update, so please ensure that this doesn't introduce any breaking changes in your project. <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
449
coderabbitai
github-actions[bot]
@@ -2216,9 +2216,9 @@ } }, "node_modules/@types/json-schema": { - "version": "7.0.11", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", - "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", + "version": "7.0.12", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.12.tgz", + "integrity": "sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==",
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The version of `@types/json-schema` has been updated from `7.0.11` to `7.0.12`. This is a patch version update and should not introduce any breaking changes, but it's still good to verify if everything works as expected after the update. <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
453
coderabbitai
github-actions[bot]
@@ -1,12 +1,14 @@ # AI-based PR reviewer and summarizer [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) - <div> <a href="https://github.com/coderabbitai/ai-pr-reviewer)/commits/main"> <img alt="GitHub" src="https://img.shields.io/github/last-commit/coderabbitai/ai-pr-reviewer/main?style=for-the-badge" height="20"> </a> </div> + +[![Discord](https://img.shields.io/badge/Join%20us%20on-Discord-blue?logo=discord&style=flat-square)](https://discord.gg/GsXnASn26c)
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The addition of the Discord badge is a good idea for community engagement. However, it's important to ensure that the link provided is correct and accessible. Please double-check the Discord invite link. ```diff - [![Discord](https://img.shields.io/badge/Join%20us%20on-Discord-blue?logo=discord&style=flat-square)](https://discord.gg/GsXnASn26c) + [![Discord](https://img.shields.io/badge/Join%20us%20on-Discord-blue?logo=discord&style=flat-square)](YOUR_CORRECT_DISCORD_INVITE_LINK) ``` Please replace `YOUR_CORRECT_DISCORD_INVITE_LINK` with the actual Discord invite link. <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
443
coderabbitai
github-actions[bot]
@@ -39,7 +39,7 @@ "devDependencies": { "@jest/globals": "^29.5.0", "@types/node": "^20.4.2", - "@typescript-eslint/eslint-plugin": "^5.59.6", + "@typescript-eslint/eslint-plugin": "^6.4.1",
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The version of `@typescript-eslint/eslint-plugin` has been updated from `^5.59.6` to `^6.4.1`. This is a major version update, so please ensure that this new version doesn't introduce breaking changes that might affect your project. ```diff - "@typescript-eslint/eslint-plugin": "^5.59.6", + "@typescript-eslint/eslint-plugin": "^6.4.1", ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
443
coderabbitai
github-actions[bot]
@@ -23,7 +23,7 @@ "devDependencies": { "@jest/globals": "^29.5.0", "@types/node": "^20.4.2", - "@typescript-eslint/eslint-plugin": "^5.59.6", + "@typescript-eslint/eslint-plugin": "^6.4.1",
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The version of `@typescript-eslint/eslint-plugin` has been updated from `^5.59.6` to `^6.4.1`. This is a major version update, so please ensure that this doesn't introduce any breaking changes in your project. <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
443
coderabbitai
github-actions[bot]
@@ -2216,9 +2216,9 @@ } }, "node_modules/@types/json-schema": { - "version": "7.0.11", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", - "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", + "version": "7.0.12", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.12.tgz", + "integrity": "sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==",
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The version of `@types/json-schema` has been updated from `7.0.11` to `7.0.12`. This is a patch version update, which typically means bug fixes or minor improvements. It's unlikely to cause any issues, but it's always good to verify. <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
442
coderabbitai
github-actions[bot]
@@ -206,33 +206,30 @@ inputs: required: false description: 'The prompt for final summarization response' default: | - Provide your final response in the `markdown` format with - the following content: - - *Walkthrough*: A high-level summary of the - overall change instead of specific files within 80 words. - - *Changes*: A table of files and their summaries. You can group - files with similar changes together into a single row to conserve - space. + Provide your final response in markdown with the following content: + + - **Walkthrough**: A high-level summary of the overall change instead of + specific files within 80 words. + - **Changes**: A markdown table of files and their summaries. Group files + with similar changes together into a single row to save space. + - **Poem**: Below the changes, include a whimsical, short poem written by + a rabbit to celebrate the changes. Format the poem as a quote using + the ">" symbol and feel free to use emojis where relevant. + + Avoid additional commentary as this summary will be added as a comment on the + GitHub pull request. Use the titles "Walkthrough" and "Changes" and they must be H2. - Avoid additional commentary as this summary will be added as a - comment on the GitHub pull request. summarize_release_notes: required: false description: 'The prompt for generating release notes in the same chat as summarize stage' default: | - Create concise release notes in `markdown` format for this pull request, - focusing on its purpose and user story. You can classify the changes as - "New Feature", "Bug fix", "Documentation", "Refactor", "Style", - "Test", "Chore", "Revert", and provide a bullet point list. For example: - "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. + Craft concise release notes for the pull request in Markdown format. + Focus on the purpose and user impact, categorizing changes as "New Feature", "Bug Fix", + "Documentation", "Refactor", "Style", "Test", "Chore", or "Revert". Provide a bullet-point list, + e.g., "- New Feature: Added search functionality to the UI". Limit your response to 50-100 words + and emphasize features visible to the end-user while omitting code-level details.
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The changes made to the `action.yml` file are mostly about reformatting and adding more detailed instructions for generating a final summarization response and release notes. However, there's a potential issue with the instruction on line 215-217. The instruction asks for a poem written by a rabbit. This could be confusing as it's not clear what is meant by "a rabbit". It might be better to clarify this point or remove it if it's not necessary. ```diff - - **Poem**: Below the changes, include a whimsical, short poem written by - a rabbit to celebrate the changes. Format the poem as a quote using - the ">" symbol and feel free to use emojis where relevant. + - **Poem**: Below the changes, include a whimsical, short poem to celebrate the changes. + Format the poem as a quote using the ">" symbol and feel free to use emojis where relevant. ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
typescript
430
coderabbitai
github-actions[bot]
@@ -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')
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The new `language` parameter is being fetched from the input but there's no validation or sanitization performed on it. This could lead to potential issues if an invalid or unexpected language code is provided. Consider adding a validation step to ensure that the `language` input matches the expected format (e.g., a valid ISO 639-1 language code). ```diff + const languageInput = getInput('language'); + if (!/^([a-z]{2}|[A-Z]{2})$/.test(languageInput)) { + throw new Error(`Invalid language code: ${languageInput}. Please provide a valid ISO 639-1 language code.`); + } - getInput('language') ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
typescript
430
coderabbitai
github-actions[bot]
@@ -21,6 +21,7 @@ export class Options { lightTokenLimits: TokenLimits heavyTokenLimits: TokenLimits apiBaseUrl: string + language: string
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The `language` property has been added to the `Options` class. However, it would be beneficial to add a comment explaining what this property is for and what values it can take. ```suggestion // ISO language code for the bot's responses language: string ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
typescript
430
coderabbitai
github-actions[bot]
@@ -135,28 +135,27 @@ implications. Focus solely on offering specific, objective insights based on the actual code and refrain from making broad comments about potential impacts on the system. -Use Markdown format for review comment text and fenced code blocks for code -snippets. - -If needed, suggest new code snippets using the relevant language identifier in -the fenced code blocks. These snippets may be added to a different file (e.g. -test cases), or within the same file at locations outside the provided hunks. -Multiple new code snippets are allowed within a single review section. - -If needed, provide a replacement snippet to fix an issue by using fenced code -blocks using the \`diff\` as the format, clearly marking the lines that need be -added or removed with \`+\` and \`-\` respectively. The line number range for -the review section that includes the replacement snippet must map exactly to the -line number range that has to be completely replaced within the new hunk. -If less than 10 lines of the hunk have to be replaced then you may alternatively -use the \`suggestion\` format. You must carefully include any lines of code that -remain unchanged in the replacement snippet to avoid issues when the replacement -snippet is committed as-is. Replacement snippet must be complete, correctly -formatted & indented and without the line number annotations. +Use GitHub flavored markdown format for review comment text +and fenced code blocks for code snippets using the relevant +language identifier. Do NOT annotate the code snippet with +line numbers. The code snippet must be correctly +formatted & indented. + +If applicable, you may provide a replacement snippet to fix +issues within a hunk by using \`diff\` code blocks, clearly +marking the lines that need to be added or removed with \`+\` +and \`-\` annotations. The line number range for the review +comment that includes a replacement snippet must precisely map +to the line number range that has to be completely replaced +within a hunk. Do NOT use \`suggestion\` code blocks for +replacement snippets.
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The instructions here are clear and concise, but it might be helpful to include an example of how to use `diff` code blocks for replacement snippets. This would provide a visual guide for users who may not be familiar with this format. <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
typescript
430
coderabbitai
github-actions[bot]
@@ -323,8 +323,11 @@ ${ ins.fileDiff = fileDiff // render prompt based on inputs so far - const summarizePrompt = prompts.renderSummarizeFileDiff(ins, options.reviewSimpleChanges) - let tokens = getTokenCount(summarizePrompt) + const summarizePrompt = prompts.renderSummarizeFileDiff( + ins, + options.reviewSimpleChanges + ) + const tokens = getTokenCount(summarizePrompt)
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The change from a single line function call to a multi-line function call doesn't seem to have any functional impact. However, it does improve readability by making the code more clear and easier to understand. ```diff - const summarizePrompt = prompts.renderSummarizeFileDiff(ins, options.reviewSimpleChanges) + const summarizePrompt = prompts.renderSummarizeFileDiff( + ins, + options.reviewSimpleChanges + ) ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
typescript
430
coderabbitai
github-actions[bot]
@@ -334,10 +337,7 @@ ${ // summarize content try { - const [summarizeResp] = await lightBot.chat( - summarizePrompt, - {} - ) + const [summarizeResp] = await lightBot.chat(summarizePrompt, {})
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit Similar to the previous comment, this change improves readability by breaking down the function call into multiple lines. This makes it easier to see what parameters are being passed to the function. ```diff - const [summarizeResp] = await lightBot.chat( - summarizePrompt, - {} - ) + const [summarizeResp] = await lightBot.chat(summarizePrompt, {}) ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
typescript
430
coderabbitai
github-actions[bot]
@@ -135,28 +135,27 @@ implications. Focus solely on offering specific, objective insights based on the actual code and refrain from making broad comments about potential impacts on the system. -Use Markdown format for review comment text and fenced code blocks for code -snippets. - -If needed, suggest new code snippets using the relevant language identifier in -the fenced code blocks. These snippets may be added to a different file (e.g. -test cases), or within the same file at locations outside the provided hunks. -Multiple new code snippets are allowed within a single review section. - -If needed, provide a replacement snippet to fix an issue by using fenced code -blocks using the \`diff\` as the format, clearly marking the lines that need be -added or removed with \`+\` and \`-\` respectively. The line number range for -the review section that includes the replacement snippet must map exactly to the -line number range that has to be completely replaced within the new hunk. -If less than 10 lines of the hunk have to be replaced then you may alternatively -use the \`suggestion\` format. You must carefully include any lines of code that -remain unchanged in the replacement snippet to avoid issues when the replacement -snippet is committed as-is. Replacement snippet must be complete, correctly -formatted & indented and without the line number annotations. +Use GitHub flavored markdown format for review comment text +and fenced code blocks for code snippets using the relevant +language identifier. Do NOT annotate the code snippet with +line numbers. The code snippet must be correctly +formatted & indented.
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The instructions for formatting code snippets in review comments have been updated to specify the use of GitHub flavored markdown and the exclusion of line numbers. This is a good change as it ensures consistency and readability in the review comments. ```diff - Use Markdown format for review comment text and fenced code blocks for code - snippets. + Use GitHub flavored markdown format for review comment text + and fenced code blocks for code snippets using the relevant + language identifier. Do NOT annotate the code snippet with + line numbers. The code snippet must be correctly + formatted & indented. ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
typescript
430
coderabbitai
github-actions[bot]
@@ -166,11 +165,6 @@ text \`LGTM!\` for that line range in the review section. z = x / y return z -15: def complex_function(x, y): -16: a = x * 2 -17: b = y / 3 -18: return a + b -19: 20: def add(x, y): 21: z = x + y 22: retrn z
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit There's a syntax error in the add function at line 170. The keyword `return` is misspelled as `retrn`. ```diff - 22: retrn z + 22: return z ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
typescript
430
coderabbitai
github-actions[bot]
@@ -207,23 +197,11 @@ Please review this change. ### Example response -15-18: -I suggest the following improvements: -\`\`\`diff -def complex_function(x, y): -- a = x * 2 -- b = y / 3 -- return a + b -+ a = x ** 2 -+ b = y ** 3 -+ c = a + b -+ return c / 2 -\`\`\` ---- 22-22: There's a syntax error in the add function. -\`\`\`suggestion - return z +\`\`\`diff +- retrn z ++ return z
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The example response has been updated to reflect the new guidelines for providing replacement snippets. This is a good change as it provides a clear example of how to follow the new guidelines. ```diff <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
typescript
430
coderabbitai
github-actions[bot]
@@ -135,28 +135,27 @@ implications. Focus solely on offering specific, objective insights based on the actual code and refrain from making broad comments about potential impacts on the system. -Use Markdown format for review comment text and fenced code blocks for code -snippets. - -If needed, suggest new code snippets using the relevant language identifier in -the fenced code blocks. These snippets may be added to a different file (e.g. -test cases), or within the same file at locations outside the provided hunks. -Multiple new code snippets are allowed within a single review section. - -If needed, provide a replacement snippet to fix an issue by using fenced code -blocks using the \`diff\` as the format, clearly marking the lines that need be -added or removed with \`+\` and \`-\` respectively. The line number range for -the review section that includes the replacement snippet must map exactly to the -line number range that has to be completely replaced within the new hunk. -If less than 10 lines of the hunk have to be replaced then you may alternatively -use the \`suggestion\` format. You must carefully include any lines of code that -remain unchanged in the replacement snippet to avoid issues when the replacement -snippet is committed as-is. Replacement snippet must be complete, correctly -formatted & indented and without the line number annotations. +Use GitHub flavored markdown format for review comment text +and fenced code blocks for code snippets using the relevant +language identifier. Do NOT annotate the code snippet with +line numbers. The code snippet must be correctly +formatted & indented. + +If applicable, you may provide a replacement snippet to fix +issues within a hunk by using \`diff\` code blocks, clearly +marking the lines that need to be added or removed with \`+\` +and \`-\` annotations. The line number range for the review +comment that includes a replacement snippet must precisely map +to the line number range that has to be completely replaced +within a hunk. Do NOT use \`suggestion\` code blocks for +replacement snippets. If there are no issues found on a line range, you MUST respond with the text \`LGTM!\` for that line range in the review section. +Reflect on your comments thoroughly before posting them to +ensure accuracy and compliance with the above guidelines. + ## Example ### Example changes
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit > Note: This review was outside of the patch, but no patch was found that overlapped with it. Original lines [15-18] - I suggest the following improvements: - \`\`\`diff - def complex_function(x, y): - - a = x * 2 - - b = y / 3 - - return a + b - + a = x ** 2 - + b = y ** 3 - + c = a + b - + return c / 2 - \`\`\` - --- <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
430
coderabbitai
github-actions[bot]
@@ -66,7 +55,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.
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The professional version of CodeRabbit is mentioned again here. It seems redundant as it was already mentioned in the previous hunk. Consider removing this repetition to improve readability. ```diff - ## 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. ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
others
430
coderabbitai
github-actions[bot]
@@ -212,7 +204,7 @@ appreciated. ### Developing > First, you'll need to have a reasonably modern version of `node` handy, tested -> with node 16. +> with node 17+.
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The Node.js version requirement has been updated from 16+ to 17+. Ensure that all dependencies are compatible with this new version and that this change is communicated to all developers. ```diff - > with node 17+. + > with node 16+. ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
typescript
424
coderabbitai
github-actions[bot]
@@ -9,6 +9,9 @@ export class TokenLimits { if (model === 'gpt-4-32k') { this.maxTokens = 32600 this.responseTokens = 4000 + if (model === 'gpt-3.5-turbo-16k') { + this.maxTokens = 16300 + this.responseTokens = 3000
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The new model `gpt-3.5-turbo-16k` is added within the condition for `gpt-4-32k`. This could lead to logical errors as the conditions are not mutually exclusive. I suggest moving the condition for `gpt-3.5-turbo-16k` outside of the `gpt-4-32k` condition. ```diff if (model === 'gpt-4-32k') { this.maxTokens = 32600 this.responseTokens = 4000 - if (model === 'gpt-3.5-turbo-16k') { - this.maxTokens = 16300 - this.responseTokens = 3000 } else if (model === 'gpt-4') { this.maxTokens = 8000 this.responseTokens = 2000 + } + if (model === 'gpt-3.5-turbo-16k') { + this.maxTokens = 16300 + this.responseTokens = 3000 } ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
typescript
416
coderabbitai
github-actions[bot]
@@ -171,7 +172,7 @@ text \`LGTM!\` for that line range in the review section. 18: return a + b 19: 20: def add(x, y): -21: z = x - y +21: z = x + y
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit There's a syntax error in the add function. The keyword `return` is misspelled as `retrn`. ```suggestion return z ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
typescript
416
coderabbitai
github-actions[bot]
@@ -868,21 +868,21 @@ function parseReview( ): Review[] { const reviews: Review[] = [] + response = sanitizeResponse(response.trim()) + const lines = response.split('\n') const lineNumberRangeRegex = /(?:^|\s)(\d+)-(\d+):\s*$/ - const lineNumberSingleRegex = /(?:^|\s)(\d+):\s*$/ // New single line regex const commentSeparator = '---' let currentStartLine: number | null = null let currentEndLine: number | null = null let currentComment = '' function storeReview(): void { if (currentStartLine !== null && currentEndLine !== null) { - const sanitizedComment = sanitizeComment(currentComment.trim()) const review: Review = { startLine: currentStartLine, endLine: currentEndLine, - comment: sanitizedComment.trim() + comment: currentComment
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The `sanitizeResponse` function is called on the `response` variable before it is split into lines. This is a good practice as it ensures that the entire response is sanitized before any further processing. However, I would suggest adding error handling to ensure that the `sanitizeResponse` function does not throw an error and halt the execution of the program. ```suggestion try { response = sanitizeResponse(response.trim()) } catch (error) { console.error(`Error sanitizing response: ${error}`) return reviews } ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
typescript
416
coderabbitai
github-actions[bot]
@@ -971,15 +971,14 @@ ${review.comment}` return comment } - function sanitizeComment(comment: string): string { + function sanitizeResponse(comment: string): string { comment = sanitizeCodeBlock(comment, 'suggestion') comment = sanitizeCodeBlock(comment, 'diff') return comment
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The `sanitizeResponse` function replaces the previous `sanitizeComment` function. It sanitizes code blocks for suggestions and diffs. This is a good improvement as it ensures that all parts of the response are sanitized, not just individual comments. However, similar to my previous comment, consider adding error handling here as well. ```suggestion function sanitizeResponse(comment: string): string { try { comment = sanitizeCodeBlock(comment, 'suggestion') comment = sanitizeCodeBlock(comment, 'diff') } catch (error) { console.error(`Error sanitizing code block: ${error}`) } return comment } ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
typescript
416
coderabbitai
github-actions[bot]
@@ -990,15 +989,6 @@ ${review.comment}` info(`Found line number range: ${currentStartLine}-${currentEndLine}`) } continue - } else if (lineNumberSingleMatch != null) { - storeReview() - currentStartLine = parseInt(lineNumberSingleMatch[1], 10) - currentEndLine = currentStartLine // For single line comments, start and end are the same - currentComment = '' - if (debug) { - info(`Found single line comment: ${currentStartLine}`) - } - continue } if (line.trim() === commentSeparator) {
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The feature that allowed for single line comments has been removed. If this was intentional and single line comments are no longer needed, then this change is fine. However, if single line comments are still required, you may need to reintroduce the relevant code. ```diff + const lineNumberSingleMatch = line.match(lineNumberSingleRegex) // Check for single line match + if (lineNumberRangeMatch != null) { storeReview() + } else if (lineNumberSingleMatch != null) { + storeReview() + currentStartLine = parseInt(lineNumberSingleMatch[1], 10) + currentEndLine = currentStartLine // For single line comments, start and end are the same + currentComment = '' + if (debug) { + info(`Found single line comment: ${currentStartLine}`) + } + continue } ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
typescript
413
coderabbitai
github-actions[bot]
@@ -143,7 +143,7 @@ test cases), or within the same file at locations outside the provided hunks. Multiple new code snippets are allowed within a single review section. If necessary, provide a replacement snippet to fix an issue by using fenced code -blocks using with the \`diff\` format, marking additions with \`+\` and deletions +blocks using the \`diff\` format, marking additions with \`+\` and deletions
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The change is a correction of a typographical error in the comment. The word "with" was removed to make the sentence grammatically correct. ```suggestion blocks using the \`diff\` format, marking additions with \`+\` and deletions ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->
ai-pr-reviewer
github_2023
typescript
412
coderabbitai
github-actions[bot]
@@ -101,153 +101,137 @@ $short_summary ## Parsing changes -The format for changes provided below consists of multiple change -sections, each containing a new hunk (annotated with line numbers), -an old hunk, and optionally, existing comment chains. Note that the -old hunk code has been replaced by the new hunk. The line number -annotation on some lines in the new hunk is of the format -\`<line_number><colon><whitespace>\`. - -### Format for changes - - ---new_hunk--- - \`\`\` - <new hunk annotated with line numbers> - \`\`\` - - ---old_hunk--- - \`\`\` - <old hunk that was replaced by the new hunk above> - \`\`\` - - ---comment_chains--- - \`\`\` - <comment chains> - \`\`\` - - ---end_change_section--- - ... +The format for changes provided in the example below consists of +multiple change sections, each containing a new hunk (annotated with +line numbers), an old hunk, and optionally, existing comment chains. +Note that the old hunk code has been replaced by the new hunk. Some +lines on the new hunk may be annotated with line numbers.
<img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit The text in these lines is a bit redundant and could be simplified for better readability. The phrase "The format for changes provided in the example below consists of multiple change sections, each containing a new hunk (annotated with line numbers), an old hunk, and optionally, existing comment chains." could be shortened to "The format for changes includes new hunks, old hunks, and optional comment chains." ```suggestion The format for changes includes new hunks, old hunks, and optional comment chains. Note that the old hunk code has been replaced by the new hunk. Some lines on the new hunk may be annotated with line numbers. ``` <!-- This is an auto-generated comment by OSS CodeRabbit -->