Update app.py
Browse files
app.py
CHANGED
@@ -156,22 +156,22 @@ def chatbot(input_text, image, audio, pdf_file, openai_api_key, reasoning_effort
|
|
156 |
if new_pdf_content:
|
157 |
# Generate MCQ quiz questions
|
158 |
quiz_response = generate_mcq_quiz(new_pdf_content, int(num_quiz_questions), openai_api_key, model_choice)
|
159 |
-
history.append((f"
|
160 |
else:
|
161 |
-
history.append(("
|
162 |
else:
|
163 |
# Regular chat mode - generate the response
|
164 |
response = generate_response(input_text, image, new_pdf_content, openai_api_key, reasoning_effort, model_choice)
|
165 |
|
166 |
# Append the response to the history
|
167 |
if input_text:
|
168 |
-
history.append((f"
|
169 |
elif image is not None:
|
170 |
-
history.append((f"
|
171 |
elif pdf_file is not None:
|
172 |
-
history.append((f"
|
173 |
else:
|
174 |
-
history.append((f"
|
175 |
|
176 |
return "", None, None, None, new_pdf_content, history
|
177 |
|
|
|
156 |
if new_pdf_content:
|
157 |
# Generate MCQ quiz questions
|
158 |
quiz_response = generate_mcq_quiz(new_pdf_content, int(num_quiz_questions), openai_api_key, model_choice)
|
159 |
+
history.append((f"π€: [Uploaded PDF for Quiz - {int(num_quiz_questions)} questions]", f"π€: {quiz_response}"))
|
160 |
else:
|
161 |
+
history.append(("π€: [Attempted to generate quiz without PDF]", "π€: Please upload a PDF file to generate quiz questions."))
|
162 |
else:
|
163 |
# Regular chat mode - generate the response
|
164 |
response = generate_response(input_text, image, new_pdf_content, openai_api_key, reasoning_effort, model_choice)
|
165 |
|
166 |
# Append the response to the history
|
167 |
if input_text:
|
168 |
+
history.append((f"π€: {input_text}", f"π€: {response}"))
|
169 |
elif image is not None:
|
170 |
+
history.append((f"π€: [Uploaded image]", f"π€: {response}"))
|
171 |
elif pdf_file is not None:
|
172 |
+
history.append((f"π€: [Uploaded PDF]", f"π€: {response}"))
|
173 |
else:
|
174 |
+
history.append((f"π€: [No input provided]", f"π€: Please provide some input (text, image, or PDF) for me to respond to."))
|
175 |
|
176 |
return "", None, None, None, new_pdf_content, history
|
177 |
|