feat: grade exercise with AI (#296)

* working on the UI of the grading

* working on the grading function of the radio and checkboxes

* ai grading fully implemented with dummy functions for generating scores

* working on the openai response

* working on the openai response

* finished with the ai_grading

* finished with the ai_grading

* creating new migration file

* working on reviews

* updated the translations

* improvements

---------

Co-authored-by: Rotimi Best <best@classroomio.com>
This commit is contained in:
Em_Dev
2024-05-13 19:35:06 +01:00
committed by GitHub
co-authored by Rotimi Best
parent fc8b8e1898
commit e243564113
37 changed files with 688 additions and 150 deletions
@@ -14,7 +14,7 @@ import { STATUS } from '$lib/utils/constants/course';
import type { PostgrestSingleResponse } from '@supabase/supabase-js';
export async function fetchCourse(courseId?: Course['id'], slug?: Course['slug']) {
let match: { slug?: string; id?: string; status?: string } = {};
const match: { slug?: string; id?: string; status?: string } = {};
if (slug) {
match.slug = slug;
@@ -24,6 +24,7 @@ export function fetchSubmissions(course_id: string) {
)
),
status_id,
feedback,
course:course_id(*),
groupmember:submitted_by(
profile(*)
@@ -66,6 +67,7 @@ export async function fetchSubmission({
id,
answers:question_answer(*),
status_id,
feedback,
submitted_by:groupmember!inner(
profile!inner(
id,
@@ -80,14 +82,21 @@ export async function fetchSubmission({
}
export async function updateSubmission(
{ id, status_id, total }: { id?: number; status_id?: number; total?: number },
{
id,
status_id,
total,
feedback
}: { id?: number; status_id?: number; total?: number; feedback?: string },
otherArgs?: any
) {
const toUpdate: {
status_id?: number;
total?: number;
feedback?: string;
} = {
status_id
status_id,
feedback
};
if (typeof total === 'number') {
@@ -447,6 +447,21 @@
"submitted": "Eingereicht",
"in_progress": "Im Gange",
"graded": "Benotet"
},
"grading_modal": {
"details": "Einzelheiten",
"early": "Früh",
"late": "Spät",
"total_grade": "Gesamtnote",
"student": "Student",
"status": "Status",
"add_comment": "Einen Kommentar hinzufügen",
"grade_with_ai": "Benoten Sie mit KI",
"submit_grades": "Noten einreichen",
"accept_grade": "Akzeptieren",
"reject_grade": "Ablehnen",
"add_comment_placeholder": "Hinterlasse einen Kommentar",
"questions_tried": "Diese Punktzahl wurde aufgrund der Gesamtzahl der Versuche vergeben:"
}
},
"attendance": {
@@ -1137,4 +1152,4 @@
"seconds": "Sekunden",
"snackbar_error": "Fehler beim Senden des Codes"
}
}
}
@@ -716,6 +716,21 @@
"submitted": "Submitted",
"in_progress": "In Progress",
"graded": "Graded"
},
"grading_modal": {
"details": "Details",
"early": "Early",
"late": "Late",
"total_grade": "Total grade",
"student": "Student",
"status": "Status",
"add_comment": "Add comment",
"add_comment_placeholder": "Leave a comment",
"grade_with_ai": "Grade with AI",
"submit_grades": "Submit Grades",
"accept_grade": "Accept",
"reject_grade": "Reject",
"questions_tried": "Allocated this score because of total tries:"
}
},
@@ -447,6 +447,21 @@
"submitted": "Enviado",
"in_progress": "En curso",
"graded": "Calificado"
},
"grading_modal": {
"details": "Detalles",
"early": "Temprano",
"late": "Tarde",
"total_grade": "Nota total",
"student": "Alumno",
"status": "Estado",
"add_comment": "Agregar comentario",
"grade_with_ai": "Calificar con IA",
"submit_grades": "Enviar calificaciones",
"accept_grade": "Aceptar",
"reject_grade": "Rechazar",
"add_comment_placeholder": "Deja un comentario",
"questions_tried": "Se asignó esta puntuación debido al total de intentos:"
}
},
"attendance": {
@@ -1137,4 +1152,4 @@
"seconds": "segundos",
"snackbar_error": "error al enviar código"
}
}
}
@@ -447,6 +447,19 @@
"submitted": "Soumis",
"in_progress": "En cours",
"graded": "Noté"
},
"grading_modal": {
"details": "Détails",
"early": "Tôt",
"late": "En retard",
"total_grade": "Note totale",
"student": "Étudiant",
"status": "Statut",
"add_comment": "Ajouter un commentaire",
"grade_with_ai": "Noter avec l'IA",
"submit_grades": "Soumettre les notes",
"accept_grade": "Accepter",
"reject_grade": "Rejeter"
}
},
"attendance": {
@@ -1137,4 +1150,4 @@
"seconds": "secondes",
"snackbar_error": "erreur lors de l'envoi du code"
}
}
}
@@ -447,6 +447,21 @@
"submitted": "प्रस्तुत",
"in_progress": "प्रगति पर है",
"graded": "ग्रेड दिया गया"
},
"grading_modal": {
"details": "विवरण",
"early": "जल्दी",
"late": "देर",
"total_grade": "कुल ग्रेड",
"student": "विद्यार्थी",
"status": "स्थिति",
"add_comment": "टिप्पणी जोड़ना",
"grade_with_ai": "एआई के साथ ग्रेड",
"submit_grades": "ग्रेड जमा करें",
"accept_grade": "स्वीकार करना",
"reject_grade": "अस्वीकार करना",
"add_comment_placeholder": "एक टिप्पणी छोड़ें",
"questions_tried": "कुल प्रयासों के कारण यह स्कोर आवंटित किया गया:"
}
},
"attendance": {
@@ -1137,4 +1152,4 @@
"seconds": "सेकंड",
"snackbar_error": "कोड भेजते समय त्रुटि"
}
}
}
@@ -447,6 +447,21 @@
"submitted": "Submetido",
"in_progress": "Em andamento",
"graded": "Classificado"
},
"grading_modal": {
"details": "Detalhes",
"early": "Cedo",
"late": "Tarde",
"total_grade": "Nota total",
"student": "Estudante",
"status": "Status",
"add_comment": "Adicionar comentário",
"grade_with_ai": "Nota com IA",
"submit_grades": "Enviar notas",
"accept_grade": "Aceitar",
"reject_grade": "Rejeitar",
"add_comment_placeholder": "Deixe um comentário",
"questions_tried": "Alocada esta pontuação por causa do total de tentativas:"
}
},
"attendance": {
@@ -1137,4 +1152,4 @@
"seconds": "segundos",
"snackbar_error": "erro ao enviar código"
}
}
}
@@ -447,6 +447,21 @@
"submitted": "Поданный",
"in_progress": "В ходе выполнения",
"graded": "Оцененный"
},
"grading_modal": {
"details": "Подробности",
"early": "Рано",
"late": "Поздно",
"total_grade": "Общая оценка",
"student": "Студент",
"status": "Положение дел",
"add_comment": "Добавить комментарий",
"grade_with_ai": "Оценка с помощью ИИ",
"submit_grades": "Отправить оценки",
"accept_grade": "Принимать",
"reject_grade": "Отклонять",
"add_comment_placeholder": "Оставить комментарий",
"questions_tried": "Присвоен этот балл из-за общего количества попыток:"
}
},
"attendance": {
@@ -1137,4 +1152,4 @@
"seconds": "секунды",
"snackbar_error": "ошибка при отправке кода"
}
}
}
@@ -447,6 +447,19 @@
"submitted": "Đã gửi",
"in_progress": "Trong tiến trình",
"graded": "Đã chấm điểm"
},
"grading_modal": {
"details": "Chi tiết",
"early": "Sớm",
"late": "Muộn",
"total_grade": "Tổng điểm",
"student": "Học sinh",
"status": "Trạng thái",
"add_comment": "Thêm bình luận",
"grade_with_ai": "Chấm điểm bằng AI",
"submit_grades": "Gửi điểm",
"accept_grade": "Chấp nhận",
"reject_grade": "Từ chối"
}
},
"attendance": {
@@ -1137,4 +1150,4 @@
"seconds": "giây",
"snackbar_error": "lỗi khi gửi mã"
}
}
}