feat: implement quiz ai feedback (#8897)

* wip

* wip

* wip

* wip

* wip

* Add AI summary at the end

---------

Co-authored-by: Kamran Ahmed <kamranahmed.se@gmail.com>
This commit is contained in:
Arik ChakmaandKamran Ahmed authored and GitHub committed 2025-07-16 13:02:02 +01:00
1 parent 20506756d6
commit b4b581b1f4
3 files changed
+221 -69

No files matched your search

+6 -1
View File
@@ -110,7 +110,6 @@ export async function generateAIQuiz(options: GenerateAIQuizOptions) {
await readChatStream(stream, {
onMessage: async (message) => {
const questions = generateAiQuizQuestions(message);
console.log(questions);
onQuestionsChange?.(questions);
},
onMessageEnd: async (result) => {
@@ -158,6 +157,12 @@ export function generateAiQuizQuestions(questionData: string): QuizQuestion[] {
return;
}
if (currentQuestion.type === 'mcq') {
currentQuestion.options = currentQuestion.options.sort(
() => Math.random() - 0.5,
);
}
questions.push(currentQuestion);
currentQuestion = null;
};