diff --git a/src/routes/api/aiFeedbackOnReport.js b/src/routes/api/aiFeedbackOnReport.js index d420004..f130a6f 100644 --- a/src/routes/api/aiFeedbackOnReport.js +++ b/src/routes/api/aiFeedbackOnReport.js @@ -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();