diff --git a/docs/dev-audit-findings.md b/docs/dev-audit-findings.md index bf55fa3..59877db 100644 --- a/docs/dev-audit-findings.md +++ b/docs/dev-audit-findings.md @@ -50,3 +50,25 @@ Tangani #1 dan #2 sebelum go-live. #2 adalah kelas bug "OTP di-generate tapi tak - GET /payments/session/{id}: payments for one session, accessible by that session's mentee or mentor (powers both dashboards) - Session mentor may confirm their own payments (previously admins only) — verified e2e - FE: /mentoring/my-sessions (mentee) + /mentoring/mentor-dashboard (mentor), both with live payment status and refresh/confirm actions; QRIS step renders real QR from qr_string + + +## 6. Materi + AI Agent RAG (2026-08-05, commit 164c186 BE / 7294040 FE) + +Fitur yang "harusnya ada" menurut user (Figma hanya berisi Design System, halaman Materi/AI Agent tidak ada di file) — dibangun dari pemahaman alur bisnis mentoring. + +**Backend — modul materials** (`imphnen-dimentorin/src/materials/`): +- `app_materials` table: mentor_id, title, slug, category, description, content, cover_url, is_published +- Pola articles: domain/repository/service + postgres repo + DTO ZodValidate +- Routes: GET /materials (public, published), /materials/{id|slug|categories}, POST/PUT/DELETE (auth, author-only) +- ENV baru: AI_LLM_BASE_URL/API_KEY/MODEL, AI_EMBEDDING_MODEL, QDRANT_URL + +**Backend — AI agent RAG** (`imphnen-dimentorin/src/ai_agent/`): +- Chunking materi (700 chars, overlap 80) -> embed via 9router `gemini/gemini-embedding-001` (3072 dim!) +- Qdrant collection `dimentorin_materi` (3072d cosine, point id = u64 dari uuid xor index — Qdrant TOLAK string non-UUID) +- Chat: embed question -> search top-4 -> LLM (`text` -> gemini-3.1-flash-lite) jawab dengan konteks + sources +- Routes: POST /ai/chat, POST /ai/materials/{id}/index, POST /ai/reindex +- 9router chat SELALU SSE-streaming walau tanpa stream:true — parser harus agregate `data:` lines + +**Verified e2e**: reindex 3 chunks; chat 'ownership' -> source materi Rust 0.88; chat 'endpoint axum' -> Axum 0.82; browser: list materi, detail, chatbox jawab + sources 84/64/61%. + +**Pitfall**: embedding Gemini = 3072 dim (bukan 768); Qdrant point id harus u64/UUID; model embedding yang berfungsi di 9router = `gemini/gemini-embedding-001` (llama-nemotron -> 'No credentials for provider: openai').