chore: fix formatting issues in main.ts file

This commit is contained in:
Will Hohyon Ryu 2024-03-07 19:06:50 -08:00
commit 977935fd5e

View file

@ -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(