aki-008 commited on
Commit
ad2a150
·
1 Parent(s): aef0df4

feat: notes quiz generator complete

Browse files
Files changed (1) hide show
  1. Frontend/src/pages/quize.tsx +12 -4
Frontend/src/pages/quize.tsx CHANGED
@@ -102,7 +102,7 @@ const ResumeGeneratedQuize: React.FC = () => {
102
 
103
  // ---------- GENERATE QUIZ ----------
104
  const generateQuiz = async () => {
105
- if (!fileObject || !quizType) return;
106
 
107
  setIsProcessing(true);
108
  setFileError(null);
@@ -118,15 +118,23 @@ const ResumeGeneratedQuize: React.FC = () => {
118
  );
119
  }
120
 
121
- // 2. Prepare Payload matching Backend `Quiz_input` schema
 
122
  const payload = {
123
  parsed_doc: extractedText.trim(),
124
  user_prompt:
125
  customPrompt.trim() || "Generate a quiz based on this content.",
126
  };
127
 
128
- // 3. Send to Backend
129
- const response = await API.post("/quiz/resume", payload);
 
 
 
 
 
 
 
130
 
131
  setQuizData(response.data);
132
  setShowQuiz(true);
 
102
 
103
  // ---------- GENERATE QUIZ ----------
104
  const generateQuiz = async () => {
105
+ if (!fileObject || !quizType || !uploadType) return; // Added uploadType check
106
 
107
  setIsProcessing(true);
108
  setFileError(null);
 
118
  );
119
  }
120
 
121
+ // 2. Prepare Payload
122
+ // Both /resume and /notes endpoints accept 'parsed_doc' and 'user_prompt'
123
  const payload = {
124
  parsed_doc: extractedText.trim(),
125
  user_prompt:
126
  customPrompt.trim() || "Generate a quiz based on this content.",
127
  };
128
 
129
+ // 3. Determine Endpoint based on Upload Type
130
+ // If uploadType is "notes", use /quiz/notes (which ingests data)
131
+ // If uploadType is "resume", use /quiz/resume (transient)
132
+ const endpoint = uploadType === "notes" ? "/quiz/notes" : "/quiz/resume";
133
+
134
+ console.log(`Sending to ${endpoint}...`);
135
+
136
+ // 4. Send to Backend
137
+ const response = await API.post(endpoint, payload);
138
 
139
  setQuizData(response.data);
140
  setShowQuiz(true);