removed option for ai to give media (in generate q uing ai, in create in kahhot clone), as it may give a wrong link as its not up to date and cant get the internet
This commit is contained in:
parent
d448517fb3
commit
389a7de0b5
1 changed files with 12 additions and 5 deletions
|
@ -14,14 +14,11 @@ Generate a list of quiz questions with possible answers and the correct answer i
|
||||||
Each question must have:
|
Each question must have:
|
||||||
- A "questionText" (what the question is about)
|
- A "questionText" (what the question is about)
|
||||||
- A "timeLimit" (in seconds, any of these: null (no time limit), 5, 10, 15, 30, 60, 120, 300)
|
- A "timeLimit" (in seconds, any of these: null (no time limit), 5, 10, 15, 30, 60, 120, 300)
|
||||||
- An "type" (only set to "SingleAnswer" for now)
|
|
||||||
- An "options" (an array of options with at least 2 and at most 8 options)
|
- An "options" (an array of options with at least 2 and at most 8 options)
|
||||||
- A "CorrectOption" (an object with a key "SingleAnswer" and a value that is the index of the correct answer)
|
- A "CorrectOption" (an object with a key "SingleAnswer" and a value that is the index of the correct answer)
|
||||||
- A "hasMedia" (boolean indicating if the question has media) only set to true if you are sure the URL is valid and related to the question.
|
|
||||||
- A "mediaURL" (a URL to the media, can be null if no media is present) only add this if you are sure the URL is valid and related to the question.
|
|
||||||
Ensure the questions are diverse.
|
Ensure the questions are diverse.
|
||||||
Example format:
|
Example format:
|
||||||
[{"questionText":"What should you do when you're free?","timeLimit":15,"type":"SingleAnswer","options":["Do something in real life!","Play video games","Code!","Touch grass!"],"CorrectOption":{"SingleAnswer":2},"hasMedia":false,"mediaURL":null},{"questionText":"Is RezHackXYZ the best programmer in the world?","timeLimit":5,"type":"SingleAnswer","options":["Yes :)","No :("],"CorrectOption":{"SingleAnswer":0},"hasMedia":true,"mediaURL":"https://github.com/RezHackXYZ.png"},{"questionText":"Best place in the world?","timeLimit":5,"type":"SingleAnswer","options":["Google","Microsoft","Apple","Samsung","Hack Club!! :D","Amazon","Facebook","Twitter"],"CorrectOption":{"SingleAnswer":4},"hasMedia":false,"mediaURL":null}]
|
[{"questionText":"What should you do when you're free?","timeLimit":15,"options":["Do something in real life!","Play video games","Code!","Touch grass!"],"CorrectOption":2},{"questionText":"Is RezHackXYZ the best programmer in the world?","timeLimit":5,"options":["Yes :)","No :("],"CorrectOption":0},{"questionText":"Best place in the world?","timeLimit":5,"options":["Google","Microsoft","Apple","Samsung","Hack Club!! :D","Amazon","Facebook","Twitter"],"CorrectOption":4}]
|
||||||
|
|
||||||
JUST PROVIDE THE JSON AND NOTHING ELSE.
|
JUST PROVIDE THE JSON AND NOTHING ELSE.
|
||||||
|
|
||||||
|
@ -49,7 +46,17 @@ The User wants [number of questions] questions.
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
QuestionsData.v = JSON.parse(data.choices[0].message.content);
|
QuestionsData.v = JSON.parse(data.choices[0].message.content).map((q) => ({
|
||||||
|
questionText: q.questionText,
|
||||||
|
timeLimit: q.timeLimit,
|
||||||
|
type: "SingleAnswer",
|
||||||
|
options: q.options,
|
||||||
|
CorrectOption: {SingleAnswer: q.CorrectOption},
|
||||||
|
hasMedia: false,
|
||||||
|
mediaURL: null,
|
||||||
|
}));
|
||||||
|
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (ParsingTry <= 5) {
|
if (ParsingTry <= 5) {
|
||||||
ParsingTry++;
|
ParsingTry++;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue