Luke Cheng

Luke-Cheng.github.io

An experimental personal website with a portfolio canvas powered by Chrome’s on-device AI.

Current app

This site uses Next.js App Router with static export. npm run build writes the deployable site to out/. Routes live in app/; shared UI, browser hooks, and build-time blog data are organized under app/_components/, app/_hooks/, and app/_lib/.

Blog routes and their draft HTML are generated at build time from blogs/ in luke-cheng/luke-cheng. That repository is also the source of LukeCheng.md. The Pages workflow checks it out to the ignored content-source/ directory, uses it to generate the static pages, and publishes one copy as /portfolio.md for the browser’s on-device AI. The site can be hosted as static files; it does not require a running Next.js server.

Publishing content

Updating LukeCheng.md or a Markdown file under blogs/ in the content repository sends a content-updated repository-dispatch event here. The Pages workflow then downloads those files before it builds the static site. The content repository needs a PAGES_REPOSITORY_DISPATCH_TOKEN Actions secret containing a fine-grained personal access token that can dispatch to luke-cheng/luke-cheng.github.io.

For local builds, clone the content repository into content-source/, or point CONTENT_DIR at an existing checkout:

git clone https://github.com/luke-cheng/luke-cheng.git content-source
CONTENT_DIR=content-source npm run build

Development

npm install
npm run dev
npm run build

Original project prompt (archive)

code is cheap, show me the prompts

./docs/chatSessions

Initial Prompt

Help me build an experimental personal portfolio website powered by Chrome's built-in Prompt API (`languageModel`). The site lets a local SLM dynamically dictate full page layouts, themes, and content on the fly using `/public/portfolio.md` as its context base.

---

## Tech Stack & Architecture

- **Original build tool:** Vite + React (the app has since moved to Next.js).
- **AI Engine:** Chrome Built-in Prompt API (`languageModel`).
- **HTML Sanitization:** `DOMPurify`.

---

## Key Core Requirements

### 1. Data & Feature Detection

- Feature-check for Chrome's Prompt API on boot. Render an `ErrorFallback` UI with model download progress if missing/downloading, including a fallback link to raw `/public/portfolio.md`.
- Fetch `/public/portfolio.md` once at application startup and cache it as context in a persistent SLM session.

### 2. Theme Engine

- Prompt the on-device AI on page load to generate a JSON map of CSS variables

### 3. Header & Navigation

- **Header Components:**
  1. Static Name / Brand title.
  2. Text Input Box to ask freeform questions about the portfolio (triggers an AI query to update the main canvas).
  3. Dynamic Navigation Bar featuring 4 tab buttons generated by the SLM on startup based on `portfolio.md`.

### 4. Main Canvas Layout & Content

- Give the SLM complete structural control over the canvas layout (single column, dual column, CSS grid, sidebars, etc.).
- Output MUST be pure semantic HTML tags + inline structure/layout styles—no executable JavaScript.
- **Streaming Pipeline:** Stream raw tokens -> Strip common SLM hallucination like Markdown code fences (` ```html `) -> Pass through `DOMPurify.sanitize()` -> Render

### 5. Static Footer

- Fixed footer displaying something alone: _"Content and layout dynamically generated via Your Browser's on-device AI. So be careful with navigating as it'll trigger a regenerating."_ With icons to github, to linkedin, and to `/public/portfolio.md` for users to view the raw content.