mirror of
https://github.com/freeedcom/ai-codereviewer.git
synced 2025-02-21 16:50:27 +00:00
feat: language support updated.
feat: Language updated.
This commit is contained in:
parent
a9a064dfa1
commit
2cdefb1001
4 changed files with 1312 additions and 1298 deletions
|
@ -11,6 +11,10 @@ inputs:
|
|||
description: "OpenAI API model."
|
||||
required: false
|
||||
default: "gpt-4"
|
||||
LANGUAGE:
|
||||
description: "Language for the code review."
|
||||
required: false
|
||||
default: "English"
|
||||
exclude:
|
||||
description: "Glob patterns to exclude files from the diff analysis"
|
||||
required: false
|
||||
|
|
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 OPENAI_API_KEY = core.getInput("OPENAI_API_KEY");
|
||||
const OPENAI_API_MODEL = core.getInput("OPENAI_API_MODEL");
|
||||
const LANGUAGE = core.getInput("LANGUAGE");
|
||||
const octokit = new rest_1.Octokit({ auth: GITHUB_TOKEN });
|
||||
const openai = new openai_1.default({
|
||||
apiKey: OPENAI_API_KEY,
|
||||
|
@ -153,6 +154,10 @@ function getAIResponse(prompt) {
|
|||
role: "system",
|
||||
content: prompt,
|
||||
},
|
||||
{
|
||||
role: "system",
|
||||
content: `(OOC: Answer in ${LANGUAGE})`
|
||||
}
|
||||
] }));
|
||||
const res = ((_b = (_a = response.choices[0].message) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.trim()) || "{}";
|
||||
return JSON.parse(res).reviews;
|
||||
|
|
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
|
@ -8,6 +8,7 @@ import minimatch from "minimatch";
|
|||
const GITHUB_TOKEN: string = core.getInput("GITHUB_TOKEN");
|
||||
const OPENAI_API_KEY: string = core.getInput("OPENAI_API_KEY");
|
||||
const OPENAI_API_MODEL: string = core.getInput("OPENAI_API_MODEL");
|
||||
const LANGUAGE: string = core.getInput("LANGUAGE");
|
||||
|
||||
const octokit = new Octokit({ auth: GITHUB_TOKEN });
|
||||
|
||||
|
@ -135,6 +136,10 @@ async function getAIResponse(prompt: string): Promise<Array<{
|
|||
role: "system",
|
||||
content: prompt,
|
||||
},
|
||||
{
|
||||
role: "system",
|
||||
content: `(OOC: Answer in ${LANGUAGE})`
|
||||
}
|
||||
],
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue