export interface QuestionItem { questionTitle: string maxScore: number referenceAnswer: string rubric: string referenceAnswerImage?: string } export interface GradeResult { score: number confidence: number deductions: string[] comment: string commit?: string } export interface ApiConfig { apiKey: string baseUrl: string model: string } export interface AppSettings { apiKey: string baseUrl: string model: string shortcut: string theme: string fontSize: number proxy: string timeout: number screenshotSavePath: string } export interface HistoryRecord { id: number question_id: number image_path: string student_answer: string ai_score: number teacher_score: number confidence: number created_at: string question_title?: string max_score?: number reference_answer?: string rubric?: string deductions?: string comment?: string result_json?: string image_data?: string reference_answer_image?: string } export interface ElectronAPI { window: { dragMove: (deltaX: number, deltaY: number) => Promise dragEnd: (x: number, y: number) => Promise resizeMain: (width: number) => Promise } screenshot: { start: () => Promise capture: (region: { x: number; y: number; width: number; height: number }) => Promise cancel: () => Promise getLastImage: () => Promise onCompleted: (callback: (base64: string) => void) => () => void } ai: { grade: (data: { imageBase64: string; rubric: string; apiConfig: ApiConfig; maxScore?: number; referenceAnswer?: string; questionTitle?: string; referenceAnswerImage?: string }) => Promise } settings: { get: () => Promise set: (settings: Record) => Promise selectDirectory: () => Promise } history: { list: () => Promise delete: (id: number) => Promise getById: (id: number) => Promise } grading: { submit: (data: { questionId: number imagePath: string aiScore: number teacherScore: number confidence: number studentAnswer?: string questionTitle?: string maxScore?: number referenceAnswer?: string rubric?: string deductions?: string[] comment?: string resultJson?: string imageData?: string referenceAnswerImage?: string }) => Promise, storeData: (data: any) => Promise, getData: () => Promise } rubric: { storeData: (data: any) => Promise getData: () => Promise exportJson: () => Promise importJson: () => Promise<{ questions: QuestionItem[]; currentIndex: number } | null> getNextIndex: () => Promise setNextIndex: (idx: number) => Promise resetNextIndex: () => Promise } template: { list: () => Promise save: (data: { name: string; course: string }) => Promise } dialog: { open: (type: string, data?: any) => Promise close: () => void getPayload: (type: string) => Promise openImage: () => Promise<{ base64: string; mime: string; filePath: string } | null> } } declare global { interface Window { electronAPI: ElectronAPI } }