Files
brainwave/frontend/src/api/gradeApi.ts
T
LaurensBartelds 993265318b
Test / backend (push) Successful in 16s
Test / frontend (push) Successful in 24s
Release Pipeline / build-and-release (push) Successful in 5m22s
feat: integrate AI grading functionality
- Added OpenAI package to backend dependencies for AI grading.
- Implemented new grading routes and services to handle AI grading requests.
- Updated admin settings to include AI provider configuration options.
- Enhanced frontend components to support AI grading, including UI for testing AI connection and displaying AI feedback.
- Updated results component to allow for AI-assisted grading and display of suggested grades.
- Added internationalization support for new AI grading features in both English and Dutch.
2026-05-02 12:41:53 +02:00

22 lines
499 B
TypeScript

import { apiFetch } from '../utils/api.js'
export interface GradingResult {
suggestedGrade: number
feedback: string
detail?: unknown
}
export interface GradeRequest {
type: 'essay' | 'short-answer' | 'translation' | 'math' | 'ordering' | 'match'
question: Record<string, unknown>
answer: unknown
language: string
}
export function gradeQuestion(req: GradeRequest): Promise<GradingResult> {
return apiFetch('/api/grade', {
method: 'POST',
body: JSON.stringify(req),
})
}