Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
b35b7d3
fix(web): remove the leftover ViteMcp plugin call
a2751012962 Oct 2, 2026
e38a027
feat(web): stream the pages web search read as source-url events
a2751012962 Oct 2, 2026
4aee6fe
test(web): cover source-url streaming and the truncation filter
a2751012962 Oct 2, 2026
9d03020
feat(web): parse source-url events into chat stream chunks
a2751012962 Oct 2, 2026
4071034
test(web): cover source-url parsing in the chat SSE client
a2751012962 Oct 2, 2026
18ee5d0
feat(web): keep each reply's sources in chat history
a2751012962 Oct 2, 2026
ff1637d
chore(web): set up shadcn/ui with the AI Elements chat components
a2751012962 Oct 2, 2026
fe76b51
feat(web): let the InlineCitation trigger take a custom label
a2751012962 Oct 2, 2026
612ed0a
feat(web): rebuild the chat thread on shadcn/ui and AI Elements
a2751012962 Oct 2, 2026
66742f1
docs: describe the shadcn/ui and AI Elements chat stack
a2751012962 Oct 2, 2026
65d6dc9
fix(web): show list markers in chat replies
a2751012962 Oct 2, 2026
3cba7ec
fix(web): remove both carousel listeners on unmount
a2751012962 Oct 2, 2026
32148d8
perf(web): memoize the carousel context value
a2751012962 Oct 2, 2026
52dbac8
perf(web): transition only border and shadow on the chat composer
a2751012962 Oct 2, 2026
4ac0a19
refactor(web): split AssistantMessage into header, actions, follow-ups
a2751012962 Oct 2, 2026
a26ac5e
perf(web): write a tool call's source-url events in one chunk
a2751012962 Oct 2, 2026
98adbd4
chore(web): exempt shadcn's upstream patterns from React Doctor
a2751012962 Oct 2, 2026
f5c9e01
chore(web): document why the chat composer keeps autofocus
a2751012962 Oct 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ Run checks before delivery; `package.json` defines no validation scripts, so
## Architecture

- `apps/web/src` is the React 19 SPA: react-router 7, Tailwind CSS 4,
assistant-ui for chat, Mapbox GL for the dorm map, and supabase-js for auth
and user data.
shadcn/ui and AI Elements for chat, Mapbox GL for the dorm map, and
supabase-js for auth and user data.
- `apps/web/worker` is the Cloudflare Worker named `uiuc`. It routes `/api/*` and
serves the SPA's static assets for every other path, so the app and the whole
API share one origin. It also hosts the streaming tool-use agent
Expand Down
34 changes: 21 additions & 13 deletions apps/web/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ Feature SQL, after the core schema:
`add_floor_plan_bed_size.sql`; `add_soul_and_memory.sql` (all in
`scripts/migrations/`).
- `scripts/create_dorm_user_features.sql`: dorm favorites and viewing history.
- `scripts/migrations/add_message_sources.sql`: `messages.sources`, the web
pages each chat reply cited. Until it runs, replies are saved without them.

The tracked SQL does not create every table the app uses. Create `conversations`
(referenced by `add_soul_and_memory.sql`), `messages`, `reading_history`,
Expand Down Expand Up @@ -155,26 +157,32 @@ service-role key that bypasses RLS. The seed upserts the bundled `UIUC_DORMS` in
tags with stored ones, and never deletes rows. It does not read the archived
`dorm_overrides`.

## assistant-ui
## shadcn/ui and AI Elements

This project uses assistant-ui for chat interfaces.
UI primitives come from [shadcn/ui](https://ui.shadcn.com) and chat building
blocks from [AI Elements](https://ai-sdk.dev/elements), both copied into the
repo by the shadcn CLI (`components.json`):

Documentation: https://www.assistant-ui.com/llms-full.txt

Key patterns:

- Use AssistantRuntimeProvider at the app root
- Thread component for full chat interface
- AssistantModal for floating chat widget
- useChatRuntime hook with AI SDK transport
- `src/components/ui/` holds shadcn primitives next to the app's own generic
UI. `src/components/ai-elements/` holds AI Elements components.
- Add components with `npx shadcn@latest add <name>` or
`npx shadcn@latest add @ai-elements/<name>` from `apps/web`. The CLI may
write `import { cn } from "cn"`; the helper lives at `@/utils/cn`.
- Copied files are ours to edit; mark local changes with a comment so a later
`add --overwrite` does not silently drop them.
- Theme tokens (`--background`, `--primary`, ...) are defined in
`src/index.css` and mapped onto the slate + Illini palette. The app is
light-only; `dark:` utilities only apply under a `.dark` ancestor.

## Chat Components

### General Chat (`src/components/chat/**` + `src/pages/chat/ChatPage.tsx`)

- Full-page general-purpose chat interface
- Uses assistant-ui runtime (ChatRuntimeProvider, ChatThread)
- Supports tool-use (SearchToolUI, WebSearchToolUI, GrepDocsToolUI)
- Full-page general-purpose chat interface (`ChatThread`), state in
`useChatSession`, scrolling in `useTopAnchoredScroll`
- Replies show the agent's thinking steps until the answer starts, then the
web pages it read (`source-url` SSE events) as a sources pill and numbered
citations
- Conversation management with persistent IDs
- Route: `/chat`

Expand Down
24 changes: 24 additions & 0 deletions apps/web/components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "new-york",
"rsc": false,
"tsx": true,
"tailwind": {
"config": "",
"css": "src/index.css",
"baseColor": "neutral",
"cssVariables": true,
"prefix": ""
},
"iconLibrary": "lucide",
"aliases": {
"components": "@/components",
"ui": "@/components/ui",
"utils": "@/utils/cn",
"lib": "@/utils",
"hooks": "@/hooks"
},
"registries": {
"@ai-elements": "https://ai-sdk.dev/elements/api/registry/{name}.json"
}
}
26 changes: 26 additions & 0 deletions apps/web/doctor.config.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"$schema": "https://react.doctor/schema/config.json",
"ignore": {
// Files the shadcn CLI copied in (see AGENTS.md). They keep upstream's
// patterns so a later `shadcn add --overwrite` stays a drop-in update;
// real bugs in them are fixed in place and marked "Local change".
"overrides": [
{
// badgeVariants / buttonVariants are shadcn's shared API: other shadcn
// components import them from these files.
"files": ["src/components/ui/badge.tsx", "src/components/ui/button.tsx"],
"rules": ["react-doctor/only-export-components"],
},
{
// `setApi` is Embla's documented way to hand the carousel API to a
// parent; AI Elements' InlineCitationCarousel relies on it.
"files": ["src/components/ui/carousel.tsx"],
"rules": [
"react-doctor/no-pass-data-to-parent",
"react-doctor/no-pass-live-state-to-parent",
"react-doctor/no-prop-callback-in-effect",
],
},
],
},
}
10 changes: 7 additions & 3 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,24 @@
"dev": "vp dev"
},
"dependencies": {
"@assistant-ui/react": "^0.15.22",
"@assistant-ui/react-markdown": "0.14.17",
"@headlessui/react": "^2.2.10",
"@supabase/supabase-js": "^2.117.2",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"embla-carousel-react": "^8.6.0",
"framer-motion": "^13.4.4",
"lucide-react": "^1.48.0",
"mapbox-gl": "^3.31.0",
"radix-ui": "^1.6.7",
"rc-slider": "^11.1.9",
"react": "^19.3.0",
"react-dom": "^19.3.0",
"react-map-gl": "^8.1.3",
"react-markdown": "^10.1.0",
"react-router-dom": "^7.18.4",
"remark-gfm": "^4.0.1"
"remark-gfm": "^4.0.1",
"tailwind-merge": "^3.7.0",
"tw-animate-css": "^1.4.0"
},
"devDependencies": {
"@cloudflare/vite-plugin": "^2.0.0-beta.sha-238e489d5",
Expand Down
11 changes: 11 additions & 0 deletions apps/web/scripts/migrations/add_message_sources.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-- Migration: Add sources to chat messages
-- Purpose: Keep the web pages an assistant reply was based on, so the
-- "N sources" button and numbered citations survive reloading a conversation.
-- Shape: [{ "id": text, "url": text, "title": text, "snippet"?: text }]
-- Until this runs, the app saves messages without their sources.

ALTER TABLE public.messages
ADD COLUMN IF NOT EXISTS sources JSONB;

-- Reload PostgREST's schema cache so the new column is accepted right away.
NOTIFY pgrst, 'reload schema';
Loading
Loading