mirror of
https://github.com/freeedcom/ai-codereviewer.git
synced 2025-06-28 20:14:14 +00:00
Merge fdb86a5a8c
into a9a064dfa1
This commit is contained in:
commit
7192f3f04b
2 changed files with 9 additions and 1 deletions
|
@ -11,6 +11,10 @@ inputs:
|
|||
description: "OpenAI API model."
|
||||
required: false
|
||||
default: "gpt-4"
|
||||
max_tokens:
|
||||
description: "Maximum number of tokens that can be generated per analysis."
|
||||
required: false
|
||||
default: "700"
|
||||
exclude:
|
||||
description: "Glob patterns to exclude files from the diff analysis"
|
||||
required: false
|
||||
|
|
|
@ -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 MAX_TOKENS: number = Number(core.getInput("max_tokens"));
|
||||
|
||||
const octokit = new Octokit({ auth: GITHUB_TOKEN });
|
||||
|
||||
|
@ -117,7 +118,7 @@ async function getAIResponse(prompt: string): Promise<Array<{
|
|||
const queryConfig = {
|
||||
model: OPENAI_API_MODEL,
|
||||
temperature: 0.2,
|
||||
max_tokens: 700,
|
||||
max_tokens: MAX_TOKENS,
|
||||
top_p: 1,
|
||||
frequency_penalty: 0,
|
||||
presence_penalty: 0,
|
||||
|
@ -139,6 +140,9 @@ async function getAIResponse(prompt: string): Promise<Array<{
|
|||
});
|
||||
|
||||
const res = response.choices[0].message?.content?.trim() || "{}";
|
||||
|
||||
console.log(`Trimmed Response: ${res}`);
|
||||
|
||||
return JSON.parse(res).reviews;
|
||||
} catch (error) {
|
||||
console.error("Error:", error);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue