mirror of
https://github.com/freeedcom/ai-codereviewer.git
synced 2025-04-21 10:06:47 +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,
|
||||
};
|
||||
|
||||
try {
|
||||
const response = await openai.chat.completions.create({
|
||||
const response =
|
||||
await openai.chat.completions.create(
|
||||
{
|
||||
...queryConfig,
|
||||
// return JSON if the model supports it:
|
||||
...(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() || "{}";
|
||||
console.log("GPT response:")
|
||||
console.log(res);
|
||||
return parseJsonForChatGPTResponse(res).reviews;
|
||||
} catch (error) {
|
||||
console.error("Error:", error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function createComment(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue