Skip to content

Latest commit

 

History

History
50 lines (38 loc) · 2.46 KB

File metadata and controls

50 lines (38 loc) · 2.46 KB

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Build & Development Commands

npm install        # Install dependencies
npm run dev        # Start dev server (http://localhost:5173)
npm run build      # Type-check (tsc -b) then build (vite build)
npm run lint       # ESLint
npm run preview    # Preview production build

No test framework is configured. The project deploys to GitHub Pages via .github/workflows/deploy.yml on push to master.

Architecture

Batch LLM Studio is a privacy-first PWA for batch LLM inference. Users import CSVs, configure prompts with {{column}} template syntax, and process rows concurrently against local (LM Studio, Ollama) or cloud (OpenAI, Gemini, OpenRouter) providers.

Data Layer

  • Dexie wraps IndexedDB with three tables: Projects, DataRows, AppSettings (defined in src/db/db.ts)
  • All state lives in IndexedDB — no backend, no external state library
  • Components use useLiveQuery() from dexie-react-hooks for reactive DB reads

Routing

  • HashRouter (react-router-dom) for GitHub Pages compatibility
  • Routes: / (ProjectList), /project/:id (Workspace), /settings (GlobalSettings), /instructions (InstructionPage)
  • Defined in src/App.tsx

Feature Organization

  • src/features/ — domain-grouped feature components (projects, runner, results, prompt-builder, settings, instructions)
  • src/components/ui/ — Shadcn UI components (Radix primitives + Tailwind + class-variance-authority)
  • src/lib/llm.ts — all LLM API integration (generateCompletion, testConnection); supports OpenAI-compatible APIs and Gemini
  • src/lib/utils.ts — shared utilities (cn for classname merging)

Data Flow

  1. CSV import → Project + bulk DataRows insert
  2. Prompt config with {{column}} interpolation → Project update
  3. BatchRunner fetches pending rows → concurrent processing → status updates (pending → processing → completed/error)
  4. ResultsTable display → CSV export via papaparse

Styling

  • Tailwind CSS with class-based dark mode and CSS variable theming
  • Shadcn UI config in components.json; import path alias @/./src/

Key Conventions

  • Vite base URL is /batch_llm/ (GitHub Pages subdirectory)
  • Global API credentials stored in AppSettings; projects can override with project-level settings
  • Shadcn UI files use lowercase-dash naming (alert-dialog.tsx); feature components use PascalCase