# AI Chat OIDC + Ollama Cloud This repository includes: - `backend/` — FastAPI service validating OIDC JWTs and proxying chat to Ollama Cloud with SSE streaming - `frontend/` — React + Vite + TypeScript UI performing OIDC Authorization Code Flow with PKCE - `docker-compose.yml` — brings up backend, frontend, and optional Keycloak (dev-only) ## Prerequisites - Docker >= 24.0 - Docker Compose >= 2.0 - An Ollama Cloud API key - An OIDC issuer URL, client ID, and client secret ## Setup 1. Copy `.env.example` to `.env` and set values. 2. In the frontend, set `VITE_OIDC_REDIRECT_URI` to `http://localhost:5173` or your UI URL. 3. If using the local Keycloak dev service, enable the `dev` profile: ```bash docker compose --profile dev up --build ``` 4. If you only want backend/frontend with an external OIDC provider: ```bash docker compose up --build ``` ## API - `GET /health` — health check - `GET /auth/config` — OIDC discovery endpoints for the frontend - `POST /auth/callback` — exchanges OIDC code for tokens - `POST /chat` — protected chat endpoint streaming SSE from Ollama Cloud ## Notes - The backend requires `OLLAMA_API_KEY` in environment. - Optionally set `OLLAMA_MODEL` to a valid Ollama Cloud model name, for example `llama3` or `gpt-4o-mini`. - The frontend stores the access token in `localStorage` for simplicity. - OpenAPI docs are available at `http://localhost:8000/docs`.