aiFeedbackOnReport working

galleryApi
Kar 2024-09-20 15:19:25 +05:30
parent a9a0cd5ca3
commit 67bc3e9995
1 changed files with 4 additions and 4 deletions

View File

@ -1,13 +1,13 @@
const aiFeedbackOnReport = async (req, res) => {
const url = process.env.AI_API_ENDOINT;
const api_key = process.env.AI_API_KEY;
console.log(req.body.score);
const payload = {
"model": "gpt-4o-mini",
"messages": [{ "role": "user",
"content": JSON.stringify(req.score) + "\n above is a sample of a students report card\n" + req.instruction }]
"content": JSON.stringify(req.body.score) + " - is a sample of a students report card " + req.body.instruction }]
}
// res.send(req);
try {
const apiResponse = await fetch(url, {
method: 'POST',
@ -20,7 +20,7 @@ const aiFeedbackOnReport = async (req, res) => {
});
if (!apiResponse.ok) {
return res.status(apiResponse.status).send({ error: 'API response was not ok' });
return res.status(apiResponse.status).send({ error: 'API response was not ok'+res });
}
const data = await apiResponse.json();