mirror of
https://github.com/freeedcom/ai-codereviewer.git
synced 2024-11-23 04:29: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 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 octokit = new rest_1.Octokit({ auth: GITHUB_TOKEN });
|
const octokit = new rest_1.Octokit({ auth: GITHUB_TOKEN });
|
||||||
const configuration = new openai_1.Configuration({
|
const configuration = new openai_1.Configuration({
|
||||||
apiKey: OPENAI_API_KEY,
|
apiKey: OPENAI_API_KEY,
|
||||||
@ -151,7 +152,7 @@ function getAIResponse(prompt) {
|
|||||||
var _a, _b;
|
var _a, _b;
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const queryConfig = {
|
const queryConfig = {
|
||||||
model: "gpt-4",
|
model: OPENAI_API_MODEL,
|
||||||
temperature: 0.2,
|
temperature: 0.2,
|
||||||
max_tokens: 700,
|
max_tokens: 700,
|
||||||
top_p: 1,
|
top_p: 1,
|
||||||
@ -210,16 +211,15 @@ function main() {
|
|||||||
const newBaseSha = eventData.before;
|
const newBaseSha = eventData.before;
|
||||||
const newHeadSha = eventData.after;
|
const newHeadSha = eventData.after;
|
||||||
const response = yield octokit.repos.compareCommits({
|
const response = yield octokit.repos.compareCommits({
|
||||||
|
headers: {
|
||||||
|
accept: "application/vnd.github.v3.diff",
|
||||||
|
},
|
||||||
owner: prDetails.owner,
|
owner: prDetails.owner,
|
||||||
repo: prDetails.repo,
|
repo: prDetails.repo,
|
||||||
base: newBaseSha,
|
base: newBaseSha,
|
||||||
head: newHeadSha,
|
head: newHeadSha,
|
||||||
});
|
});
|
||||||
diff = response.data.diff_url
|
diff = String(response.data);
|
||||||
? yield octokit
|
|
||||||
.request({ url: response.data.diff_url })
|
|
||||||
.then((res) => res.data)
|
|
||||||
: null;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log("Unsupported event:", process.env.GITHUB_EVENT_NAME);
|
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