Updated the Speaking to also work the with exam session persistence
This commit is contained in:
@@ -45,16 +45,17 @@ export const evaluateSpeakingAnswer = async (exercise: SpeakingExercise | Intera
|
||||
}
|
||||
};
|
||||
|
||||
const downloadBlob = async (url: string): Promise<Buffer> => {
|
||||
export const downloadBlob = async (url: string): Promise<Buffer> => {
|
||||
const blobResponse = await axios.get(url, {responseType: "arraybuffer"});
|
||||
return Buffer.from(blobResponse.data, "binary");
|
||||
};
|
||||
|
||||
const evaluateSpeakingExercise = async (exercise: SpeakingExercise, exerciseId: string, solution: UserSolution, id: string) => {
|
||||
const formData = new FormData();
|
||||
|
||||
const audioBlob = await downloadBlob(solution.solutions[0].solution.trim());
|
||||
const audioFile = new File([audioBlob], "audio.wav", {type: "audio/wav"});
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append("audio", audioFile, "audio.wav");
|
||||
|
||||
const evaluationQuestion =
|
||||
@@ -64,7 +65,7 @@ const evaluateSpeakingExercise = async (exercise: SpeakingExercise, exerciseId:
|
||||
|
||||
const config = {
|
||||
headers: {
|
||||
"Content-Type": "audio/mp3",
|
||||
"Content-Type": "audio/wav",
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user