mirror of
https://github.com/freeedcom/ai-codereviewer.git
synced 2025-06-28 20:14:14 +00:00
feat: build
This commit is contained in:
parent
78cde26787
commit
b72e5a9c1a
2 changed files with 1303 additions and 1298 deletions
5
dist/index.js
vendored
5
dist/index.js
vendored
|
@ -51,6 +51,7 @@ const minimatch_1 = __importDefault(__nccwpck_require__(2002));
|
||||||
const GITHUB_TOKEN = core.getInput("GITHUB_TOKEN");
|
const GITHUB_TOKEN = core.getInput("GITHUB_TOKEN");
|
||||||
const OPENAI_API_KEY = core.getInput("OPENAI_API_KEY");
|
const OPENAI_API_KEY = core.getInput("OPENAI_API_KEY");
|
||||||
const OPENAI_API_MODEL = core.getInput("OPENAI_API_MODEL");
|
const OPENAI_API_MODEL = core.getInput("OPENAI_API_MODEL");
|
||||||
|
const EXTRA_PROMPTS = core.getInput("EXTRA_PROMPTS");
|
||||||
const octokit = new rest_1.Octokit({ auth: GITHUB_TOKEN });
|
const octokit = new rest_1.Octokit({ auth: GITHUB_TOKEN });
|
||||||
const openai = new openai_1.default({
|
const openai = new openai_1.default({
|
||||||
apiKey: OPENAI_API_KEY,
|
apiKey: OPENAI_API_KEY,
|
||||||
|
@ -105,6 +106,9 @@ function analyzeCode(parsedDiff, prDetails) {
|
||||||
return comments;
|
return comments;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
const extractExtraPrompts = () => {
|
||||||
|
return EXTRA_PROMPTS.split(',').map((prompt) => `- IMPORTANT: ${prompt}\n`).join('');
|
||||||
|
};
|
||||||
function createPrompt(file, chunk, prDetails) {
|
function createPrompt(file, chunk, prDetails) {
|
||||||
return `Your task is to review pull requests. Instructions:
|
return `Your task is to review pull requests. Instructions:
|
||||||
- Provide the response in following JSON format: {"reviews": [{"lineNumber": <line_number>, "reviewComment": "<review comment>"}]}
|
- Provide the response in following JSON format: {"reviews": [{"lineNumber": <line_number>, "reviewComment": "<review comment>"}]}
|
||||||
|
@ -113,6 +117,7 @@ function createPrompt(file, chunk, prDetails) {
|
||||||
- Write the comment in GitHub Markdown format.
|
- Write the comment in GitHub Markdown format.
|
||||||
- Use the given description only for the overall context and only comment the code.
|
- Use the given description only for the overall context and only comment the code.
|
||||||
- IMPORTANT: NEVER suggest adding comments to the code.
|
- IMPORTANT: NEVER suggest adding comments to the code.
|
||||||
|
${extractExtraPrompts()}
|
||||||
|
|
||||||
Review the following code diff in the file "${file.to}" and take the pull request title and description into account when writing the response.
|
Review the following code diff in the file "${file.to}" and take the pull request title and description into account when writing the response.
|
||||||
|
|
||||||
|
|
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue