mirror of
https://github.com/freeedcom/ai-codereviewer.git
synced 2025-04-20 17:46:47 +00:00
Formatting
This commit is contained in:
parent
ea35bd1354
commit
1389e1211e
7 changed files with 38442 additions and 25847 deletions
|
@ -10,4 +10,4 @@
|
||||||
// "ghcr.io/jungaretti/features/ripgrep:1": {},
|
// "ghcr.io/jungaretti/features/ripgrep:1": {},
|
||||||
// "ghcr.io/lukewiwa/features/shellcheck:0": {},
|
// "ghcr.io/lukewiwa/features/shellcheck:0": {},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
4
.github/PULL_REQUEST_TEMPLATE.md
vendored
4
.github/PULL_REQUEST_TEMPLATE.md
vendored
|
@ -1,7 +1,5 @@
|
||||||
|
|
||||||
# Summary | Résumé
|
# Summary | Résumé
|
||||||
|
|
||||||
|
|
||||||
> 1-3 sentence description of the changed you're proposing, including a link to
|
> 1-3 sentence description of the changed you're proposing, including a link to
|
||||||
> a GitHub Issue # or Trello card if applicable.
|
> a GitHub Issue # or Trello card if applicable.
|
||||||
|
|
||||||
|
@ -25,4 +23,4 @@
|
||||||
> modification. Elles aideront les développeurs à faire des tests sans avoir à
|
> modification. Elles aideront les développeurs à faire des tests sans avoir à
|
||||||
> jouer au détective. Veuillez aussi inclure toutes les étapes de configuration
|
> jouer au détective. Veuillez aussi inclure toutes les étapes de configuration
|
||||||
> de l’environnement qui ne font pas partie des étapes normales dans le fichier
|
> de l’environnement qui ne font pas partie des étapes normales dans le fichier
|
||||||
> README et tout élément temporel requis.
|
> README et tout élément temporel requis.
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
{
|
{
|
||||||
"action": "opened",
|
"action": "opened",
|
||||||
"repository": {
|
"repository": {
|
||||||
"owner": {
|
"owner": {
|
||||||
"login": "cds-snc"
|
"login": "cds-snc"
|
||||||
},
|
|
||||||
"name": "cds-ai-codereviewer"
|
|
||||||
},
|
},
|
||||||
"number": 3
|
"name": "cds-ai-codereviewer"
|
||||||
}
|
},
|
||||||
|
"number": 3
|
||||||
|
}
|
||||||
|
|
61883
dist/index.js
vendored
61883
dist/index.js
vendored
File diff suppressed because one or more lines are too long
2352
dist/sourcemap-register.js
vendored
2352
dist/sourcemap-register.js
vendored
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,4 @@
|
||||||
{
|
{
|
||||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
"extends": [
|
"extends": ["local>cds-snc/renovate-config"]
|
||||||
"local>cds-snc/renovate-config"
|
}
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
24
src/main.ts
24
src/main.ts
|
@ -16,12 +16,12 @@ const OPENAI_BASE_URL: string = core.getInput("OPENAI_BASE_URL"); // Keep the de
|
||||||
const debugHttp: string | undefined = process.env.DEBUG_HTTP;
|
const debugHttp: string | undefined = process.env.DEBUG_HTTP;
|
||||||
if (debugHttp) {
|
if (debugHttp) {
|
||||||
// Intercept all HTTP requests
|
// Intercept all HTTP requests
|
||||||
const nock = require('nock');
|
const nock = require("nock");
|
||||||
nock.recorder.rec({
|
nock.recorder.rec({
|
||||||
output_objects: true,
|
output_objects: true,
|
||||||
logging: (content: any) => {
|
logging: (content: any) => {
|
||||||
console.log('HTTP Request:', content);
|
console.log("HTTP Request:", content);
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
console.log("HTTP calls interception enabled");
|
console.log("HTTP calls interception enabled");
|
||||||
}
|
}
|
||||||
|
@ -107,8 +107,9 @@ function createPrompt(file: File, chunk: Chunk, prDetails: PRDetails): string {
|
||||||
- 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.
|
||||||
|
|
||||||
Review the following code diff in the file "${file.to
|
Review the following code diff in the file "${
|
||||||
}" and take the pull request title and description into account when writing the response.
|
file.to
|
||||||
|
}" and take the pull request title and description into account when writing the response.
|
||||||
|
|
||||||
Pull request title: ${prDetails.title}
|
Pull request title: ${prDetails.title}
|
||||||
Pull request description:
|
Pull request description:
|
||||||
|
@ -122,9 +123,9 @@ Git diff to review:
|
||||||
\`\`\`diff
|
\`\`\`diff
|
||||||
${chunk.content}
|
${chunk.content}
|
||||||
${chunk.changes
|
${chunk.changes
|
||||||
// @ts-expect-error - ln and ln2 exists where needed
|
// @ts-expect-error - ln and ln2 exists where needed
|
||||||
.map((c) => `${c.ln ? c.ln : c.ln2} ${c.content}`)
|
.map((c) => `${c.ln ? c.ln : c.ln2} ${c.content}`)
|
||||||
.join("\n")}
|
.join("\n")}
|
||||||
\`\`\`
|
\`\`\`
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
@ -146,7 +147,8 @@ async function getAIResponse(prompt: string): Promise<Array<{
|
||||||
const response = await openai.chat.completions.create({
|
const response = await openai.chat.completions.create({
|
||||||
...queryConfig,
|
...queryConfig,
|
||||||
// return JSON if the model supports it:
|
// return JSON if the model supports it:
|
||||||
...(OPENAI_API_MODEL === "gpt-4-1106-preview" || OPENAI_API_MODEL === "gpt-4o"
|
...(OPENAI_API_MODEL === "gpt-4-1106-preview" ||
|
||||||
|
OPENAI_API_MODEL === "gpt-4o"
|
||||||
? { response_format: { type: "json_object" } }
|
? { response_format: { type: "json_object" } }
|
||||||
: {}),
|
: {}),
|
||||||
messages: [
|
messages: [
|
||||||
|
@ -229,7 +231,9 @@ async function main() {
|
||||||
|
|
||||||
diff = String(response.data);
|
diff = String(response.data);
|
||||||
} else {
|
} else {
|
||||||
console.log(`Unsupported event: action=${eventData.action}, process.env.GITHUB_EVENT_NAME=${process.env.GITHUB_EVENT_NAME}`);
|
console.log(
|
||||||
|
`Unsupported event: action=${eventData.action}, process.env.GITHUB_EVENT_NAME=${process.env.GITHUB_EVENT_NAME}`
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue