s33 #22

Merged
kar merged 1 commits from tmp into master 2025-02-04 12:58:48 +00:00
2 changed files with 12 additions and 12 deletions

View File

@ -2,7 +2,7 @@ const AWS = require('aws-sdk');
const axios = require('axios');
const mongoose = require('mongoose');
const Game = require('../../models/gameModel'); // Ensure this path matches your project structure
const FormData = require('form-data');
const aiEvaluateImageToStar = async (req, res) => {
try {
const { childId, gameName, gameID, gameTime, gameStar, screenShot } = req.body;
@ -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: [
@ -62,14 +62,14 @@ const aiEvaluateImageToStar = async (req, res) => {
const scoreResponse = openAiResponse.data.choices[0].message.content;
const parsedScore = JSON.parse(scoreResponse);
console.log(openAiResponse)
console.log(scoreResponse)
const gameData = new Game({
gameName,
childId,
gameID,
gameTime,
score: parsedScore.score || 'N/A', // Adjust key to match OpenAI response
gameStar: parsedScore.score || 'N/A',
gameStar,
screenshotUrl,
});

View File

@ -31,10 +31,10 @@ const aiMarkDrawing = require("../api/aiMarkDrawing");
const aiFeedbackOnReportWithFollowup = require("../api/aiFeedbackOnReportWithFollowup");
const aiTextToSpeech = require("../api/aiTextToSpeech");
const aiEvaluateImageToStar = require("../api/aiEvaluateImageToStar");
const getGameInfo = require("../api/getGameInfo");
// const getGameInfo = require("../api/getGameInfo");
const saveGalleryImage = require("../api/saveGalleryImage");
const getGalleryImage = require("../api/getGalleryImage");
const aiTest = require("../api/aiTest");
// const aiTest = require("../api/aiTest");
const router = express.Router();
@ -195,9 +195,9 @@ router.get("/ping", (req, res) => {
});
// getGameInfo.
router.get("/getGameInfo", (req, res) => {
getGameInfo(req, res);
});
// router.get("/getGameInfo", (req, res) => {
// getGameInfo(req, res);
// });
// Save Drawing Game Gallery Image
router.post("/saveGalleryImage", (req, res) => {
@ -210,9 +210,9 @@ router.get("/ping", (req, res) => {
});
// Get Drawing Game Gallery Image
router.post("/aiTest", (req, res) => {
aiTest(req, res);
});
// router.post("/aiTest", (req, res) => {
// aiTest(req, res);
// });
module.exports = router;