tmp #21
|
@ -5,7 +5,7 @@ const Game = require('../../models/gameModel'); // Ensure this path matches your
|
|||
|
||||
const aiEvaluateImageToStar = async (req, res) => {
|
||||
try {
|
||||
const { userId, gameName, gameID, gameTime, gameStar, screenShot } = req.body;
|
||||
const { childId, gameName, gameID, gameTime, gameStar, screenShot } = req.body;
|
||||
if (!screenShot) {
|
||||
return res.status(400).json({ error: 'Screenshot is required' });
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ const aiEvaluateImageToStar = async (req, res) => {
|
|||
// .catch(error => {
|
||||
// console.error('Error:', error);
|
||||
// });
|
||||
console.log(screenshotUrl.data.filePath)
|
||||
// console.log(screenshotUrl.data.filePath)
|
||||
const openAiPayload = {
|
||||
model: 'gpt-4o-mini',
|
||||
messages: [
|
||||
|
@ -65,11 +65,11 @@ const aiEvaluateImageToStar = async (req, res) => {
|
|||
console.log(openAiResponse)
|
||||
const gameData = new Game({
|
||||
gameName,
|
||||
userId,
|
||||
childId,
|
||||
gameID,
|
||||
gameTime,
|
||||
score: parsedScore.score || 'N/A', // Adjust key to match OpenAI response
|
||||
gameStar,
|
||||
gameStar: parsedScore.score || 'N/A',
|
||||
screenshotUrl,
|
||||
});
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@ const saveGalleryImage = async (req, res) => {
|
|||
throw new Error('Image upload failed: ' + uploadResponse.statusText);
|
||||
}
|
||||
|
||||
|
||||
// Extract and store the uploaded image URL from the response
|
||||
const screenshotUrl = uploadResponse.data.urls[0];
|
||||
|
||||
|
|
Loading…
Reference in New Issue