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

No packages published