dolgolyov.alexei 8b8fe916f0 Phase 4: Documents & Memory — upload, FTS, AI tools, context injection
Backend:
- Document + MemoryEntry models with Alembic migration (GIN FTS index)
- File upload endpoint with path traversal protection (sanitized filenames)
- Background document text extraction (PyMuPDF)
- Full-text search on extracted_text via PostgreSQL tsvector/tsquery
- Memory CRUD with enum-validated categories/importance, field allow-list
- AI tools: save_memory, search_documents, get_memory (Claude function calling)
- Tool execution loop in stream_ai_response (multi-turn tool use)
- Context assembly: injects critical memory + relevant doc excerpts
- File storage abstraction (local filesystem, S3-swappable)
- Secure file deletion (DB flush before disk delete)

Frontend:
- Document upload dialog (drag-and-drop + file picker)
- Document list with status badges, search, download (via authenticated blob)
- Document viewer with extracted text preview
- Memory list grouped by category with importance color coding
- Memory editor with category/importance dropdowns
- Documents + Memory pages with full CRUD
- Enabled sidebar navigation for both sections

Review fixes applied:
- Sanitized upload filenames (path traversal prevention)
- Download via axios blob (not bare <a href>, preserves auth)
- Route ordering: /search before /{id}/reindex
- Memory update allows is_active=False + field allow-list
- MemoryEditor form resets on mode switch
- Literal enum validation on category/importance schemas
- DB flush before file deletion for data integrity

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 13:46:59 +03:00

Personal AI Assistant

A client-server web application for managing personal health and life areas with AI-powered assistance. Upload documents, chat with AI specialists, receive proactive health reminders, and track critical information across multiple life domains.

Key Features

  • AI Chat with Specialists — create chats using configurable skills (e.g., cardiologist, nutritionist). Each skill shapes the AI's behavior as a domain expert.
  • Document Management — upload health records, lab results, prescriptions, and consultation notes. AI extracts and indexes content for intelligent retrieval.
  • Proactive Notifications — AI analyzes your health profile and schedules reminders (checkups, medication reviews) via in-app, email, or Telegram.
  • PDF Compilation — request AI-generated health summaries as downloadable PDF documents.
  • Global Memory — AI maintains a shared memory of critical health information across all your chats.
  • Multi-language — English and Russian support.

Tech Stack

Layer Technology
Backend Python 3.12, FastAPI, SQLAlchemy 2.0, Alembic
Frontend React 18, TypeScript, Vite, Shadcn/ui, Tailwind CSS
Database PostgreSQL 16
AI Claude API (Anthropic)
Notifications WebSocket, Email (SMTP), Telegram Bot
Deployment Docker Compose

Getting Started

Prerequisites: Docker and Docker Compose installed.

# Clone the repository
git clone https://git.dolgolyov-family.by/alexei.dolgolyov/personal-ai-assistant.git
cd personal-ai-assistant

# Copy environment config
cp .env.example .env
# Edit .env with your API keys and settings

# Start all services
docker compose up -d

# Create initial admin user
docker compose exec backend python scripts/seed_admin.py

The app will be available at http://localhost.

Project Structure

personal-ai-assistant/
├── backend/          # FastAPI application
├── frontend/         # React SPA
├── telegram-bot/     # Telegram notification bot
├── nginx/            # Reverse proxy config
├── plans/            # Phase subplans
├── docker-compose.yml
└── GeneralPlan.md    # Full implementation plan

License

Private project. All rights reserved.

Description
No description provided
Readme 583 KiB
Languages
Python 52.9%
TypeScript 42.3%
HTML 3.8%
CSS 0.4%
Dockerfile 0.4%
Other 0.2%