return empty array for parsing

This commit is contained in:
Ville Saukkonen 2023-03-28 00:36:30 +03:00
parent 626621db03
commit bcec1128c8
3 changed files with 5 additions and 3 deletions

View file

@ -130,7 +130,7 @@ async function getAIResponse(prompt: string): Promise<Array<{
],
});
const res = response.data.choices[0].message?.content?.trim() || "";
const res = response.data.choices[0].message?.content?.trim() || "[]";
return JSON.parse(res);
} catch (error) {
console.error("Error:", error);