fixed put in order questions

This commit is contained in:
yoannchb-pro
2023-06-20 21:17:58 -04:00
parent 46b4ebb7b7
commit 4d18aaf1b2
5 changed files with 21 additions and 22 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+3 -2
View File
@@ -29,10 +29,11 @@ async function getChatGPTResponse(
content: `
Follow those rules:
- Sometimes there won't be a question, so just answer the statement as you normally would without following the other rules and give the most detailled and complete answer with explication.
- For put in order question just give the good order separate by new line
- Your goal is to understand the statement and to reply to each question by giving only the answer.
- You will keep the same order for the answers as it's asked event if it's a put in order question. Never change the order of the response for each questions.
- You will keep the same order for the answers like in the text.
- You will separate all the answer with new lines and only show the correctes one.
- You will onyl give the answers for each question and omit the questions, statement, title or other informations from the response.
- You will only give the answers for each question and omit the questions, statement, title or other informations from the response.
- You will only give answer with exactly the same text as the gived answers.
- The question always have the good answer so you should always give an answer to the question.
- You will always respond in the same langage as the user question.`,
+12 -11
View File
@@ -49,28 +49,29 @@ function handleSelect(
/* Handle put in order question */
if (!/[^\d]+/gi.test(content)) {
console.log("Checking put in order...");
const content = normalizeText(
(option.parentNode as HTMLElement)
.closest("tr")
.querySelector(".text").textContent
);
const index = correct.findIndex((answer) => {
const elementTitle = (option.parentNode as HTMLElement)
.closest("tr")
.querySelector(".text");
const content = normalizeText(elementTitle.textContent);
const indexCorrectAnswer = correct.findIndex((answer) => {
const valide = answer.includes(content);
if (config.logs) Logs.responseTry(content, valide);
return valide;
});
if (index !== -1) {
if (indexCorrectAnswer !== -1) {
//we do + 1 because we skip the first option: Choose...
if (config.mouseover) {
options[index].closest("select").addEventListener(
options[indexCorrectAnswer + 1].closest("select").addEventListener(
"click",
function () {
options[index + 1].selected = "selected" as any;
options[indexCorrectAnswer + 1].selected = "selected" as any;
},
{ once: true }
);
} else {
options[index + 1].selected = "selected" as any;
options[indexCorrectAnswer + 1].selected = "selected" as any;
}
break;
}
+4 -7
View File
@@ -131,17 +131,14 @@
<!-- Select Number -->
<section class="formulation">
<div class="qtext">
<p>
Put the three steps needed in a general sense for a computer program
to solve the problem in the correct order
</p>
<p>Put in order the step to create a java program.</p>
</div>
<div>
<div class="inp">
<table>
<tr>
<td class="text">
<p>Understand the problem</p>
<p>Write java code</p>
</td>
<td>
<select>
@@ -154,7 +151,7 @@
</tr>
<tr>
<td class="text">
<p>Carry out the plan and write the actual code</p>
<p>Execute the java executable file</p>
</td>
<td>
<select>
@@ -168,7 +165,7 @@
<tr>
<td class="text">
<p>Create a step-by-step plan for how you'll solve it</p>
<p>Compile the java code</p>
</td>
<td>
<select>