Updated the writing evaluation to use the different endpoints

This commit is contained in:
Tiago Ribeiro
2024-03-26 21:46:53 +00:00
parent 259ed03ee4
commit bb7558afb8
3 changed files with 11 additions and 4 deletions

View File

@@ -11,10 +11,16 @@ import {
import axios from "axios";
import {speakingReverseMarking, writingReverseMarking} from "./score";
export const evaluateWritingAnswer = async (exercise: WritingExercise, solution: UserSolution, id: string): Promise<UserSolution | undefined> => {
export const evaluateWritingAnswer = async (
exercise: WritingExercise,
task: number,
solution: UserSolution,
id: string,
): Promise<UserSolution | undefined> => {
const response = await axios.post<Evaluation>("/api/evaluate/writing", {
question: `${exercise.prompt} ${exercise.attachment ? exercise.attachment.description : ""}`.replaceAll("\n", ""),
answer: solution.solutions[0].solution.trim().replaceAll("\n", " "),
task,
id,
});