GPT Chat Client leveraging Neural Network Service
- Based on ng-video-lecture, nanoGPT and nanochat
- Using the Neural Network service
See API.md for the full request/response contracts between the React client, Express proxy, and Neural Network service.
-
Clone the Repository:
git clone https://github.com/derinworks/penr-oz-gpt-chat.git cd penr-oz-gpt-chat -
Setup:
- Install dependencies:
npm install
- Configure environment by copying the example file and editing it:
Update
cp .env.example .env
.envwith your Neural Network service URL:VITE_PREDICTION_SERVER_URL=http://localhost:8000
- Install dependencies:
-
Neural Network Service:
- Follow instructions on Quick Start Guide
- Deployed remotely then use a
.envfile as such to configure url:
VITE_PREDICTION_SERVER_URL=http://???:8000
-
Run:
- Launch React client (Vite dev server only):
App running at http://localhost:3000
npm start
- Build for production (type-check + Vite bundle):
npm run build
- Start the proxy server (Express on port 3001):
npm run server
- Run client and server together (recommended for development):
React client at http://localhost:3000, proxy server at http://localhost:3001 (auto-restarts on server file changes)
npm run dev
- Preview the production build:
npm run preview
- Launch React client (Vite dev server only):
-
Testing:
- Run all unit tests:
npm test - Run tests with coverage report (requires ≥ 80% line/function coverage on core modules):
npm run test:coverage
- Tests live alongside source files (
src/api.test.ts) and in the server directory (server/index.test.ts). - The test stack uses Vitest with Supertest for HTTP assertions and built-in
vi.fn()mocks for dependency isolation.
- Run all unit tests: