mirror of
https://github.com/freeedcom/ai-codereviewer.git
synced 2025-06-29 12:24:16 +00:00
chore: fix formatting issues in main.ts file
This commit is contained in:
parent
271056abf4
commit
977935fd5e
1 changed files with 53 additions and 54 deletions
11
src/main.ts
11
src/main.ts
|
@ -128,8 +128,9 @@ async function getAIResponse(prompt: string): Promise<Array<{
|
||||||
presence_penalty: 0,
|
presence_penalty: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
const response =
|
||||||
const response = await openai.chat.completions.create({
|
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-4-1106-preview"
|
||||||
|
@ -144,11 +145,9 @@ async function getAIResponse(prompt: string): Promise<Array<{
|
||||||
});
|
});
|
||||||
|
|
||||||
const res = response.choices[0].message?.content?.trim() || "{}";
|
const res = response.choices[0].message?.content?.trim() || "{}";
|
||||||
|
console.log("GPT response:")
|
||||||
|
console.log(res);
|
||||||
return parseJsonForChatGPTResponse(res).reviews;
|
return parseJsonForChatGPTResponse(res).reviews;
|
||||||
} catch (error) {
|
|
||||||
console.error("Error:", error);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function createComment(
|
function createComment(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue