Chat frontend for DigiHome — smart-home assistant. Single-thread chat with history, PDF upload (RAG), and document sync.
React 19 + TypeScript + Vite, Tailwind v4, shadcn/base-nova, TanStack Query, React Router, redaxios.
- Chat —
useInfiniteQueryhistory (GET /chat?before=),POST /chat {prompt}with optimistic update, infinite scroll (IntersectionObserver) - Documents — PDF dropzone (max 10, preview),
POST /rag/document,POST /rag/seedsync - Theme — light / dark / system, persisted, applied via
html.dark(dropdown in header)
cp .env.example .env # set VITE_BASE_URL / VITE_API_BASE_URL (default http://localhost:8080) and VITE_ASSETS_BASE_URL (default http://localhost:9000)
bun install # respects bunfig.toml minimumReleaseAge=3d
bun dev # http://localhost:5173# Git hooks — oxlint --fix + oxfmt --write on pre-commit, tsc --noEmit on pre-push (see prek.toml)
bunx prek install # install hooks
bunx prek run --all-files # run all hooks manually
# shadcn — add UI components (alias @/* → src/* is pre-configured)
bunx shadcn@latest add button dialog sonner # etc.
# Alternatives if you don't use prek
bun run lint:fix # oxlint --fix
bun run format # oxfmt --write (semi: false, config .oxfmtrc.json)
bunx tsc --noEmit # typecheck| Command | Description |
|---|---|
bun dev |
dev server |
bun run build |
tsc -b && vite build |
bun run lint |
oxlint (config .oxlintrc.json) |
bun run lint:fix |
oxlint --fix |
bun run format |
oxfmt --write (.oxfmtrc.json) |
bun run format:check |
oxfmt --check |
bunx tsc --noEmit |
typecheck |
bunx prek run --all-files |
all hooks (oxlint + oxfmt + tsc) |
VITE_API_BASE_URL (API, default http://localhost:8080, fallback VITE_BASE_URL) and VITE_ASSETS_BASE_URL (RustFS, default http://localhost:9000) — see .env.example (also supports typo VITE_ASSETS_BASED_URL).
src/main.tsx → app/providers.tsx → routes/router.tsx
pages/home.tsx, hooks/home/useHomePage.ts
components/home/{ChatBubble, dropzone/DocumentDropzone, modal/InsertDocumentModal, button/SyncDocumentsButton}
components/theme/{theme-provider, theme-toggle}
components/ui/* (shadcn), lib/*, api/*, schemas/*
- Alias
@/*→src/* FormDatauploads must not setContent-Typemanually (let browser set boundary)- Tailwind theme in
src/index.css, dark mode via@custom-variant dark (&:is(.dark *))