diff --git a/GptService/controllers/gptController.js b/GptService/controllers/gptController.js index 264bb57a9..9b478bcd5 100644 --- a/GptService/controllers/gptController.js +++ b/GptService/controllers/gptController.js @@ -29,7 +29,7 @@ async function getResponse(req, res, next) { async function exitSession(req, res, next) { try { - const userId = req.body.userId; + const userId = req.params.userId; const response = gptService.exitSession(userId); @@ -49,7 +49,7 @@ async function exitSession(req, res, next) { async function getCache(req, res, next) { try { - const userId = req.body.userId; + const userId = req.params.userId; const response = gptService.getCache(userId); diff --git a/GptService/routes/gptRoute.js b/GptService/routes/gptRoute.js index 738ad63cb..81e4d5c43 100644 --- a/GptService/routes/gptRoute.js +++ b/GptService/routes/gptRoute.js @@ -8,8 +8,8 @@ router.get('/', (req, res) => { router.post('/generate', controller.getResponse); -router.delete('/exitGpt', controller.exitSession); +router.delete('/exitGpt/:userId', controller.exitSession); -router.get('/getCache', controller.getCache); +router.get('/getCache/:userId', controller.getCache); module.exports = router; \ No newline at end of file diff --git a/MatchingService/controllers/matchingController.js b/MatchingService/controllers/matchingController.js index 7f53921a5..809c8a086 100644 --- a/MatchingService/controllers/matchingController.js +++ b/MatchingService/controllers/matchingController.js @@ -85,7 +85,7 @@ async function getSession(req, res, next) { async function endSession(req, res, next) { try { const sessionId = req.params.sessionId; - const sessionInfo = await getMatchedPairBySessionId(sessionId); + const sessionInfo = await matchingDB.getMatchedPairBySessionId(sessionId); const isEnded = await matchingDB.endSession(sessionId); if (isEnded) { @@ -100,6 +100,7 @@ async function endSession(req, res, next) { } } catch (error) { + console.log(error); await res.status(500).json({ status: 'error', message: 'Failed to end session' }); } }