Public Access
- 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.
22 lines
499 B
TypeScript
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),
|
|
})
|
|
}
|