Generation Page (complete rebuild): - Full production-parity exam generation wizard with 4 IELTS modules - Reading: AI passage gen, 5 exercise types (MCQ, Fill, Write, T/F, Match) - Listening: 4 section types, AI context gen, TTS audio gen (ElevenLabs) - Writing: Task 1/2, AI instruction gen, word limits, marks - Speaking: 3 parts, AI script gen, avatar video gen (7 avatars) - Per-module config: timer, CEFR difficulty, access, approval, rubrics - Exam submission workflow (draft/published) Exam Structures: - New encoach.exam.structure model + CRUD controller - ExamStructuresPage wired to real API AI Module (encoach_ai): - OpenAI service, ElevenLabs TTS, AWS Polly, ELAI avatars - AI settings model with Odoo config parameters - 7 generation endpoints (passage, exercises, instructions, scripts, context) Vector Module (encoach_vector): - pgvector integration for RAG-based content search - Embedding service with sentence-transformers Exam Session Fixes: - Fixed ExamSession.tsx field mapping (question_type→type, exam_title→title) - Fixed submit payload to include attempt_id and answers - Fixed normalizeType to handle null/undefined Tested: 12/12 API tests passed, browser-verified with real OpenAI calls Made-with: Cursor
56 lines
1.5 KiB
TypeScript
56 lines
1.5 KiB
TypeScript
import { api } from "@/lib/api-client";
|
|
|
|
interface CoachChatRequest {
|
|
message: string;
|
|
history?: { role: string; content: string }[];
|
|
context?: unknown;
|
|
}
|
|
|
|
interface CoachChatResponse {
|
|
reply: string;
|
|
}
|
|
|
|
interface CoachTipResponse {
|
|
tip: string;
|
|
category: string;
|
|
}
|
|
|
|
interface CoachSuggestResponse {
|
|
suggestion: string;
|
|
focus_areas: string[];
|
|
daily_plan: { activity: string; duration_min: number; skill: string }[];
|
|
motivation: string;
|
|
}
|
|
|
|
interface CoachWritingResponse {
|
|
improved_text: string;
|
|
changes: { original: string; revised: string; reason: string }[];
|
|
tips: string[];
|
|
}
|
|
|
|
export const coachingService = {
|
|
async chat(data: CoachChatRequest): Promise<CoachChatResponse> {
|
|
return api.post<CoachChatResponse>("/coach/chat", data);
|
|
},
|
|
|
|
async getHint(data: { topic_id: number; question_id: string }): Promise<{ hint: string; strategy: string }> {
|
|
return api.post("/coach/hint", data);
|
|
},
|
|
|
|
async explain(data: { score_data: Record<string, unknown>; student_context?: string }): Promise<{ explanation: string }> {
|
|
return api.post("/coach/explain", data);
|
|
},
|
|
|
|
async suggest(data?: Record<string, unknown>): Promise<CoachSuggestResponse> {
|
|
return api.post("/coach/suggest", data);
|
|
},
|
|
|
|
async writingHelp(data: { task: string; draft: string; help_type: string }): Promise<CoachWritingResponse> {
|
|
return api.post("/coach/writing-help", data);
|
|
},
|
|
|
|
async getTip(context: string): Promise<CoachTipResponse> {
|
|
return api.get<CoachTipResponse>("/coach/tip", { context });
|
|
},
|
|
};
|