Possibly solved part of the issue with speaking

This commit is contained in:
Tiago Ribeiro
2024-05-20 21:28:45 +01:00
parent e3ded29e77
commit 489c9c3b7e
3 changed files with 394 additions and 510 deletions

View File

@@ -45,10 +45,11 @@ export const evaluateSpeakingAnswer = async (
exercise: SpeakingExercise | InteractiveSpeakingExercise,
solution: UserSolution,
id: string,
task: number,
): Promise<UserSolution | undefined> => {
switch (exercise?.type) {
case "speaking":
return {...(await evaluateSpeakingExercise(exercise, exercise.id, solution, id)), id} as UserSolution;
return {...(await evaluateSpeakingExercise(exercise, exercise.id, solution, id, task)), id} as UserSolution;
case "interactiveSpeaking":
return {...(await evaluateInteractiveSpeakingExercise(exercise.id, solution, id)), id} as UserSolution;
default:
@@ -66,6 +67,7 @@ const evaluateSpeakingExercise = async (
exerciseId: string,
solution: UserSolution,
id: string,
task: number,
): Promise<UserSolution | undefined> => {
const formData = new FormData();
@@ -81,6 +83,7 @@ const evaluateSpeakingExercise = async (
`${exercise.text.replaceAll("\n", "")}` + (exercise.prompts.length > 0 ? `You should talk about: ${exercise.prompts.join(", ")}` : "");
formData.append("question", evaluationQuestion);
formData.append("id", id);
formData.append("task", task.toString());
const config = {
headers: {