Skip to content

michaeljabbour/workspaces-spa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Workspaces 🛠️

A lean, fully-local Single-Page App that lets you:

  1. Chat with either OpenAI or Anthropic (token-streamed).
  2. Upload reference files the back-end can later vectorise.
  3. Persist chat history in the browser (no server DB).

Why local? Zero cloud services, zero build tools — perfect for rapid prototyping or an internal proof-of-concept before you wire up Auth0, Entra ID, or Azure Functions.


🗂 Repo layout

workspaces/
├─ spa/                 # static front-end (vanilla JS)
│   ├─ index.html
│   ├─ styles.css
│   └─ app.js
├─ api/                 # FastAPI back-end
│   ├─ main.py
│   ├─ models.py
│   ├─ provider.py
│   ├─ requirements.txt
│   └─ uploads/         # receives files (in .gitignore)
├─ .env.example         # ← copy → api/.env
└─ README.md

🏃‍♂️ Quick-start (macOS/Linux bash)

# 1 — clone
git clone https://github.com/<your-org>/workspaces.git
cd workspaces

# 2 — back-end
cd api
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
cp ../.env.example .env      # paste your provider keys here
uvicorn main:app --reload --port 8080 &
cd ..

# 3 — front-end (static)
cd spa
python -m http.server 3000 & xdg-open http://localhost:3000  # macOS: open

Windows PowerShell

# Replace these commands for Windows:
# 1. Replace source .venv/bin/activate with .venv\Scripts\Activate.ps1
# 2. Replace xdg-open with Start-Process

🔐 Environment variables (api/.env)

Key Example Notes
OPENAI_API_KEY sk-… Any valid OpenAI or Azure OpenAI key
OPENAI_API_BASE https://api.openai.com/v1 For Azure: https:///openai/deployments/
ANTHROPIC_API_KEY anthropic-… Sign up at console.anthropic.com
SPA_ORIGIN http://localhost:3000 Front-end origin allowed by CORS

Copy .env.example → api/.env, then paste real keys.


➕ Extending

Feature How
Auth0 / Entra ID Add MSAL/Auth0 to spa/app.js; verify JWT in api/main.py with python-jose.
Vector search Pipe files in uploads/ through LangChain → FAISS or Azure AI Search.
Docker dev See docker-compose.yml snippet below.
Model selection Front-end passes "provider":"anthropic" (default is OpenAI).
🛳 Minimal docker-compose.yml
version: "3.9"
services:
  api:
    build: ./api
    env_file: ./api/.env
    ports: ["8080:8080"]
  spa:
    image: nginx:alpine
    volumes: ["./spa:/usr/share/nginx/html:ro"]
    ports: ["3000:80"]

🩺 Troubleshooting

Symptom Fix
401 Invalid API key Double-check you pasted keys into api/.env and restarted Uvicorn.
Browser blocks SSE Confirm both servers run on localhost ports 3000 & 8080; CORS header comes from SPA_ORIGIN.
Upload >1 MB stalls FastAPI default body limit is inherited from Uvicorn (no hard cap); likely a proxy/browser issue.

📝 License

MIT. See LICENSE file.


© 2025 Workspaces team — Making meetings productive again.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors