feat: implement AI tutor memory and RAG system for continuous learning

- Added chat sessions and message persistence for interaction history.
- Integrated Knowledge Base (RAG) using PostgreSQL Full Text Search.
- Implemented automated ingestion of lesson content during course sync.
- Updated AITutor frontend to support persistent session IDs via localStorage.
- Added database migrations for chat_sessions, chat_messages, and knowledge_base.
- Fixed SQLx build issues to allow offline Docker image compilation.
This commit is contained in:
2026-01-23 15:59:53 -03:00
parent 470c7f0172
commit c774c3608b
7 changed files with 300 additions and 30 deletions
+3 -3
View File
@@ -354,13 +354,13 @@ export const lmsApi = {
return res.json();
});
},
async chatWithTutor(lessonId: string, message: string): Promise<{ response: string }> {
async chatWithTutor(lessonId: string, message: string, sessionId?: string): Promise<{ response: string, session_id: string }> {
return apiFetch(`/lessons/${lessonId}/chat`, {
method: 'POST',
body: JSON.stringify({ message })
body: JSON.stringify({ message, session_id: sessionId })
});
},
async getLessonFeedback(lessonId: string): Promise<{ response: string }> {
async getLessonFeedback(lessonId: string): Promise<{ response: string, session_id: string }> {
return apiFetch(`/lessons/${lessonId}/feedback`);
}
};