Skip to content

p196hql/notebook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Notebook AI

Small full-stack notebook chat app.

  • web/: React + Vite frontend
  • server/: Express API
  • server/rag/: Python RAG service
  • server/storage/rag/: RAG runtime state (qdrant/, temporary uploads)

Setup

Requirements:

  • Node.js
  • Python 3
  • MongoDB running locally

Install frontend deps:

cd web
npm install

Install server deps:

cd server
npm install

Install Python deps:

cd server
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt

Configure environment:

  • Copy or edit server/.env
  • Set MONGO_URI
  • Set UPLOAD_STORAGE=local for a fully offline setup. In that mode, uploaded files are stored under server/storage/rag/uploads/assets and served from LOCAL_UPLOADS_BASE_PATH.
  • If you keep UPLOAD_STORAGE=cloudinary, set the Cloudinary values
  • Set the AI provider values
  • Optional: override QDRANT_PATH and UPLOADS_PATH if you want different RAG storage locations

Run

Start the Python RAG service:

cd server
source .venv/bin/activate
python rag/app.py

Start the Express API:

cd server
npm run dev

Start the frontend:

cd web
npm run dev

Frontend default URL: http://localhost:5173

Test

Server tests:

cd server
npm test

Reset only the local RAG storage:

cd server
npm run rag:wipe

AI Provider Config

The Python RAG service now uses the official OpenAI Python SDK with a configurable base_url, so it can target OpenAI-compatible providers like OpenRouter.

Preferred variables:

AI_API_KEY=...
AI_BASE_URL=https://openrouter.ai/api/v1
AI_LLM_MODEL=openai/gpt-4.1-mini
AI_EMBEDDING_MODEL=text-embedding-3-small
AI_RERANK_MODEL=...
UPLOAD_STORAGE=local
LOCAL_UPLOADS_BASE_PATH=/uploads
AI_APP_NAME=Notebook 2
AI_SITE_URL=http://localhost:5173
QDRANT_PATH=storage/rag/qdrant
UPLOADS_PATH=storage/rag/uploads

Notes:

  • AI_RERANK_MODEL is optional. If your provider does not support /rerank, the app falls back to the vector search ordering.
  • For local Ollama, use AI_BASE_URL=http://localhost:11434/v1 and any non-empty AI_API_KEY such as ollama.
  • Existing OPENROUTER_* variables still work as backward-compatible aliases.
  • OPENAI_API_KEY and OPENAI_BASE_URL are also accepted as aliases.

About

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors