mirror of
https://github.com/freeedcom/ai-codereviewer.git
synced 2024-11-26 22:19:03 +00:00
commit
bc0dab4a3c
12
dist/index.js
vendored
12
dist/index.js
vendored
@ -50,6 +50,7 @@ const parse_diff_1 = __importDefault(__nccwpck_require__(4833));
|
||||
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 octokit = new rest_1.Octokit({ auth: GITHUB_TOKEN });
|
||||
const configuration = new openai_1.Configuration({
|
||||
apiKey: OPENAI_API_KEY,
|
||||
@ -151,7 +152,7 @@ function getAIResponse(prompt) {
|
||||
var _a, _b;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const queryConfig = {
|
||||
model: "gpt-4",
|
||||
model: OPENAI_API_MODEL,
|
||||
temperature: 0.2,
|
||||
max_tokens: 700,
|
||||
top_p: 1,
|
||||
@ -210,16 +211,15 @@ function main() {
|
||||
const newBaseSha = eventData.before;
|
||||
const newHeadSha = eventData.after;
|
||||
const response = yield octokit.repos.compareCommits({
|
||||
headers: {
|
||||
accept: "application/vnd.github.v3.diff",
|
||||
},
|
||||
owner: prDetails.owner,
|
||||
repo: prDetails.repo,
|
||||
base: newBaseSha,
|
||||
head: newHeadSha,
|
||||
});
|
||||
diff = response.data.diff_url
|
||||
? yield octokit
|
||||
.request({ url: response.data.diff_url })
|
||||
.then((res) => res.data)
|
||||
: null;
|
||||
diff = String(response.data);
|
||||
}
|
||||
else {
|
||||
console.log("Unsupported event:", process.env.GITHUB_EVENT_NAME);
|
||||
|
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user