AOSSIE-Org / AOSSIE-Org/EduAid
[BUG]: Hard difficulty endpoints use incorrect parameter (input_question vs max_questions)
- Lenguaje dominante
- JavaScript
- Estrellas
- 171
- Forks
- 425
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
## Bug Description
The hard difficulty quiz generation endpoints (`/get_shortq_hard`, `/get_mcq_hard`, and `/get_boolq_hard`) expect the parameter `input_question` from the request body, while the frontend sends `max_questions`.
Because of this mismatch, the backend receives an empty list instead of the expected number of questions. This may lead to incorrect question generation or inconsistent behavior when generating hard difficulty quizzes.
Affected endpoints in `server.py`:
- `/get_shortq_hard`
- `/get_mcq_hard`
- `/get_boolq_hard`
Current backend implementation:
```python
input_questions = data.get("input_question", [])
output = qg.generate(
article=input_text,
num_questions=input_questions,
answer_style="multiple_choice"
)
```
However, the frontend sends:
```json
{
"input_text": "Sample text for question generation.",
"max_questions": 5
}
```
Because of this inconsistency, the backend does not receive the correct number of questions for generation.
---
## Steps to Reproduce
1. Start the EduAid backend server.
2. Send a POST request to one of the hard difficulty endpoints:
- `/get_mcq_hard`
- `/get_shortq_hard`
- `/get_boolq_hard`
3. Use the following request body:
```json
{
"input_text": "Sample text for question generation.",
"max_questions": 5
}
```
4. The backend attempts to read `input_question` instead of `max_questions`, leading to incorrect behavior.
---
## Logs and Screenshots
Relevant code snippet from `server.py`:
```python
input_questions = data.get("input_question", [])
output = qg.generate(
article=input_text,
num_questions=input_questions,
answer_style="multiple_choice"
)
```
Expected behavior:
The endpoint should read `max_questions` instead of `input_question` to remain consistent with other endpoints such as `/get_mcq`, `/get_boolq`, and `/get_shortq`.
---
## Environment Details
- OS: Windows 11
- Backend: Flask (Python)
- Python Version: 3.x
- Frontend: React
- Repository: EduAid
---
## Impact
High - Major feature is broken
---
## Code of Conduct
- [x] I have joined the Discord server and will post updates there
- [x] I have searched existing issues to avoid duplicates
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Evaluación
Este issue todavía no se ha evaluado.