Spaces:
Sleeping
Sleeping
Commit History
-
feat: per-user OpenAI key + model preferences persisted in DB
Fabio Antonini +1: Claude Sonnet 4.6- UserSettings table stores encrypted OpenAI key (Fernet) and last-selected models (rag, vlm, ocr, embed) per user - ContextVar propagates the user's decrypted key to all core modules without changing function signatures; global OPENAI_API_KEY env var as fallback - set_openai_context FastAPI dependency injected in rag, compliance, agent routers - GET/PUT /users/me/settings and PATCH /users/me/settings/models endpoints - DELETE /users/me/settings/openai-key to revoke personal key - Sidebar restores saved model selections on login and persists changes - Inline DB migration in init_db() adds new columns to existing user_settings table - docker-compose: OPENAI_API_KEY and SETTINGS_ENCRYPTION_KEY passed as env vars - Remove PUT /rag/openai-key (global key is env-only, never written to file) - Sidebar: uppercase removed from section headers; "Configurazione" now title-case Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>413c3b1
-
feat: add FastAPI backend (Phase 1 — feature/backend)
Fabio Antonini +1: Claude Sonnet 4.6New backend/ package with 35 REST endpoints: - config.py: pydantic-settings (DB, MinIO, JWT, Ollama, CORS) - database.py: async SQLAlchemy engine + session dependency - models/user.py: User, Organization, Role (admin/examiner/viewer) - models/project.py: Project, Document, Analysis ORM models - auth/password.py: bcrypt hash/verify - auth/jwt.py: access token (30min) + refresh token (7d) - auth/dependencies.py: get_current_user(), require_role() - routers/auth.py: POST /auth/login|refresh|logout - routers/users.py: CRUD /users/ + /users/me - routers/projects.py: CRUD /projects/ + document upload/delete - routers/analysis.py: POST /analysis/{htr,sig,ner,writer,grapho,pipeline,dating} - routers/rag.py: streaming SSE /rag/chat + doc management - storage/minio_client.py: async MinIO wrapper (anyio thread offload) - main.py: FastAPI app with CORS, lifespan, health check - Dockerfile: backend container image - .env.example: environment variable template Also: - requirements-backend.txt: fast…76f414d