feat(dimentorin): AI agent RAG (embedding materi -> Qdrant + chat via 9router)

- ENV: AI_LLM_BASE_URL/API_KEY/MODEL, AI_EMBEDDING_MODEL (gemini-embedding-001), QDRANT_URL
- ai_agent module: chunking materi, embed_text + chat_completion (9router, SSE parse), Qdrant repo (dimentorin_materi collection, 3072d cosine)
- routes: POST /ai/chat (RAG answer + sources), POST /ai/materials/{id}/index, POST /ai/reindex
- e2e verified: reindex 3 chunks; chat 'ownership' -> materi Rust paling relevan 0.88; chat 'endpoint axum' -> materi Axum 0.82; jawaban gronding konteks
This commit is contained in:
asepharyana
2026-08-05 17:15:11 +07:00
parent ac8177d87e
commit 164c1860da
18 changed files with 741 additions and 3 deletions
+5 -3
View File
@@ -6,9 +6,10 @@ use imphnen_cms::{
roadmap_public_routes, testimonials_protected_routes, testimonials_public_routes,
};
use imphnen_dimentorin::{
articles_protected_routes, articles_public_routes, materials_protected_routes,
materials_public_routes, mentors_protected_routes, mentors_public_routes,
payments_protected_routes, sessions_protected_routes, sessions_public_routes,
ai_agent_routes, articles_protected_routes, articles_public_routes,
materials_protected_routes, materials_public_routes, mentors_protected_routes,
mentors_public_routes, payments_protected_routes, sessions_protected_routes,
sessions_public_routes,
};
use imphnen_gacha::gacha_router;
use imphnen_hackathon::hackathon_router;
@@ -77,6 +78,7 @@ pub async fn gateway_service(postgres_clients: PostgresClients) -> Router {
.merge(sessions_public_routes(db.clone()))
.merge(articles_public_routes(db.clone()))
.merge(materials_public_routes(db.clone()))
.merge(ai_agent_routes(db.clone(), Arc::clone(&state_arc)))
.merge(
Router::new()
.merge(mentors_protected_routes(db.clone(), Arc::clone(&state_arc)))