Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call to LLM (get wrong answers) and function for front-end. #41

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

RaquelSuarezSanchez
Copy link

@RaquelSuarezSanchez RaquelSuarezSanchez commented Mar 5, 2025

I implemented two main things:

  • First, I updated the wrong answers in the question schema. Now, it gets an array obtained from calling a function in the LLMService, that should be later implemented by my classmates, and will return 3 wrong answers. We combine the correct answer with the wrong ones and create the "options" array.
  • Then, I added an attribute to the Question shema: alreadyShown. This will help us know if the question has already been shown to the player, without deleting it from the data base. I created a function called "getAndUpdateQuestion()" that returns one of the questions that has not been shown, and sets that attribute to true. This function should be called from the front-end.

… method to get one question (that hasn't already been shown) that will be called from front-end.
Copy link

sonarqubecloud bot commented Mar 5, 2025

Copy link

@SergioMulet SergioMulet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good implementation, I think it would be also important to add another function to check if the option selected by the user is the right one.

  • isRightAnswer(selectedAnswer)

@@ -62,6 +69,24 @@ async function saveQuestionsToDB(questions){
}
}

// Should be called from front-end
async function getAndUpdateQuestion() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the name is a bit confusing, i would just call it getQuestion(), the update is done because of how we deal with the question so users don't get repeated ones, but they don't have to know how it works. Good implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants