feat/course-plan-rag-media #5
Reference in New Issue
Block a user
Delete Branch "feat/course-plan-rag-media"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Audit of the admin Configuration section (FAQ Manager, Notification Rules, Approval Config) surfaced three contract mismatches and one missing schema. FAQ * Backend `encoach.faq.category.audience` / `encoach.faq.item.audience` rejected the `both` and `entity` values emitted by the FAQ Manager UI. Widened the Selection so the UI's full vocabulary round-trips. * FAQ item `video_url` was already accepted by the UI but silently dropped by the controller; now persisted via a new `video_url` field on `encoach.faq.item` and serialized on list/get responses. Notification Rules * Added `days_before`, `frequency`, `channel`, `entity_id` to `encoach.notification.rule`. These are the exact fields the admin form collects; prior to this change they were serialized into the JSON body, ignored by the controller, and omitted from responses, leaving the Active switch permanently off and the table columns blank. * Controller now translates `active` <-> `is_active` both ways so the new frontend contract and legacy callers coexist. Missing required fields return HTTP 400 instead of 500. Approval Workflows * The controller had been hand-rolling raw SQL against three tables (`encoach_approval_workflow`, `_stage`, `_request`) that no Odoo model declared, so the tables never existed. List() was guarded and returned empty; create() would 500 with "relation does not exist". * Introduced real ORM models in `encoach_exam_template/models/approval.py` plus access rights, which auto-provision the tables on -u. * Rewrote the controller to use ORM, added PATCH, and emitted both `items` and `results` in the list envelope so the frontend's PaginatedResponse reader and legacy callers both work. Step payloads now carry `max_days`, `auto_escalate`, and `notification_email` end to end. * Frontend `approvalsService` and `ApprovalWorkflowConfig` updated to send the full stage shape + `allow_bypass`, tolerate both envelope keys, and validate at least one approver before submit. Schema delta applied via `./run.sh -u encoach_exam_template,encoach_lms_api`. Verified with new `test_config_flows.py`: 24/24 passing. Regression runs on `test_support_flows.py` (29/29) and `test_training_flows.py` (26/26) remain green. Made-with: CursorRoadmap P0 - Ship /logo.svg fallback and rewire asset references (superseded later by the project-manager PNG in a separate commit). Roadmap P1 - Response envelope alignment ({items,total,page,size}) across services and query hooks. - Approval/ticket UX updates tied to the new backend rollback semantics. Roadmap P2 - React.lazy + Vite manualChunks to split vendor-radix/charts/icons/forms from the main bundle and cut initial JS. - Fix the 181 tsc errors (PaginationParams class + per-service generics). - Auto-refresh flow for JWT refresh tokens wired into api-client.ts. Roadmap P3 - i18n: i18next + language detector, en/ar locales, RTL auto-switch, LanguageToggle component in RoleLayout and AdminLmsLayout. - GDPR: PrivacyCenter page for data export and right-to-erasure, backed by gdpr.service.ts; logout via AuthContext after erasure. - Human-in-the-loop exam review UI: admin ExamReviewQueue + ExamReviewDetail pages, useExamReview hooks, exam-review.service.ts. - AI quality loop: AIPromptEditor (versioning + render preview), AIFeedbackButtons for students, AIFeedbackTriage admin page, dedicated services, hooks, and types. - Dark mode: ThemeProvider + ThemeToggle + chart color tokens. - Accessibility: DialogDescription on every DialogContent; alert-dialog and sheet updates. - Retire dead pages: ExamPage marketing, Index, ProfilePage import. - Playwright e2e scaffolding: playwright.config.ts + e2e/login.spec.ts smoke tests, npm scripts test:e2e / test:e2e:install. Made-with: CursorAddresses the QA notes on the end-to-end approval flow. Highlights: Backend - encoach_ai/generation_submit: create encoach.approval.request on submit so submitted exams actually reach the approver queue (previously only the workflow id was stored on the exam, leaving approvers with an empty inbox). Initial exam status flips to pending_approval instead of draft. - encoach_exam_template/approval_workflows: * /api/approval-users filters out students (user_type='student', op_student_id set, share=True) so the approver dropdown only lists staff. * _ser_request enriches requests with target_name / target_status and the current stage approver for UI badges. * list_requests supports mine=1 / requester=1 so approvers only see queue items awaiting their action. * approve_request / reject_request now transition the underlying encoach.exam.custom to published / rejected on final approval. - encoach.exam.custom.status: add pending_approval and rejected states to match the approval workflow transitions. Frontend UX - GenerationPage: rubric field shows "Auto-graded — no rubric" for Listening and Reading (rubrics only apply to Writing / Speaking). Divider dropdowns now carry explicit help text explaining None / Line / Space / Page Break and where to write prompts. Selecting an official exam structure auto-populates the required tasks/sections/parts, the delete button is hidden for essential tasks, and submit is blocked if the user dropped below the structure's required count. - RubricsPage: "Add Criterion" is now a dropdown with IELTS-specific presets (Task Achievement, Coherence & Cohesion, Fluency & Coherence, …) keyed off the selected skill, plus a "Custom (blank row)" fallback. - AdminCourses: added tooltips and helper copy clarifying Difficulty vs CEFR Level in the Create Course dialog. - CustomExamCreate: validate the whole form before Save/Publish, surface backend error messages (413/504/401) instead of a generic toast, read the exam id from the correct response field, and avoid marking Publish as failed when only the optional Save-as-Template step errors. - ResourceManager / TeacherLibrary: upload toast now shows a concrete reason (HTTP 413 / 504 / 401) instead of a generic "Upload failed". Config (504 / 413 / resource upload fixes) - odoo.conf + odoo-docker.conf: raise limit_time_cpu to 600s, limit_time_real to 900s, limit_request to 128 MB, and memory caps so /api/exam/generation/submit and multipart resource uploads stop hitting 504 / 413 during QA. - frontend/Dockerfile (nginx): add client_max_body_size 128m, bump proxy_read_timeout / proxy_send_timeout to 900s, and disable request buffering so large AI/resource payloads stream through the proxy. Made-with: CursorBuilds the §24 product on top of the LangGraph runtime from §22: Phase A (Sources / RAG) - encoach.course.plan.source model (file | url | text) - SourceIndexer extracts PDF (pypdf), DOCX (python-docx), HTML, plain text and embeds chunks via the existing pgvector pipeline scoped to plan_id, so resources.search only returns the plan's own corpus - Endpoints: list/create/upload/reindex/delete + plan-scoped retrieval Phase B (Deliverables) - services.deliverables.compute_deliverables walks the plan, derives {planned, generated, ready} per week from material + media state - GET /api/ai/course-plan/<id>/deliverables drives the new wizard preview step and the live progress strip on the detail page Phase C (Multi-modal media) - encoach.course.plan.media model + MediaService: audio: AWS Polly (default) or ElevenLabs image: OpenAI DALL-E 3, capped per plan via system parameter video: local ffmpeg subprocess (image + audio -> MP4 1280x720) - Three new agent tools (media.synthesize_audio / generate_image / compose_video), wired into course_week_materials and a new course_media_director agent - Endpoints per material + week-level batch generator Phase D (Assignments) - encoach.course.plan.assignment supports mode='batch' (op.batch) or mode='students' (res.users), with due_date + message + state - REST endpoints to list / create / delete assignments Phase E (Student view) - /api/student/course-plans + /api/student/course-plans/<id> enforce visibility via assignment.expand_user_ids() - New /student/course-plans list + read-only drilldown rendering audio/image/video tiles from /web/content/<attachment_id> Cross-cutting - encoach.ai.tool.category: + media (so the new tools register) - encoach.embedding gains a plan_id filter for plan-scoped RAG - Wizard adds Sources + Multimedia steps; AdminCoursePlanDetail rewritten with DeliverablesStrip + SourcesCard + AssignmentsCard + per-material MediaDrawer - ~280 new EN + AR i18n keys (full RTL coverage) - smoke_course_plan.py exercises every phase via odoo-bin shell; last run: PASS A/B/D/E + DALL-E 3 image (753 KB), Polly audio fails cleanly when AWS creds aren't configured (expected) Documentation: §24 added to docs/PROJECT_SUMMARY.md with phase-by-phase artefact list, endpoints, smoke test, ops notes, and gotchas. Made-with: CursorView command line instructions
Checkout
From your project repository, check out a new branch and test the changes.