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
@@ -1,23 +1,30 @@
<script lang="ts">
import TextField from '$lib/components/Form/TextField.svelte';
import { t } from '$lib/utils/functions/translations';
import { snackbar } from '../Snackbar/store';
export let gradeMax = 0;
export let disableGrading = false;
export let grade: number | undefined;
export let grade: number | undefined = 0;
$: if (grade && grade > gradeMax) {
snackbar.error('grade cant be more than max value');
grade = gradeMax;
}
</script>
{#if typeof grade !== 'undefined'}
<div class="flex items-center">
<TextField
placeholder={$t('course.navItem.lessons.exercises.new_exercise_modal.points')}
bind:value={grade}
type="number"
className="w-12"
isDisabled={disableGrading}
/>
<p class="dark:text-white ml-2 text-lg flex items-center">
<span class="mr-1">/</span> <span>{gradeMax}</span>
</p>
</div>
{/if}
<div class="flex items-center font-semibold">
<TextField
placeholder={$t('course.navItem.lessons.exercises.new_exercise_modal.points')}
bind:value={grade}
max={gradeMax}
type="number"
className="w-12"
inputClassName="h-10"
isDisabled={disableGrading}
/>
<p class="dark:text-white ml-2 text-base flex items-center font-semibold">
<span class="mr-1">/</span> <span>{gradeMax}</span>
</p>
</div>