examples/agent-example/README.md
A React + Tailwind CSS rich text editor with AI agent functionality powered by transformers.js. The AI runs entirely in the browser using WebAssembly — no server required.
Based on the website-toolbar example with added AI capabilities.
Uses two models running via @huggingface/transformers in a Web Worker with the WASM backend for broad compatibility, including Safari on iOS:
Models are loaded lazily on first use. Generated text streams directly into the editor as tokens arrive. Extracted entities are converted into color-coded decorator nodes with contextual links.
Note: SmolLM2-135M is a small language model. Results are best-effort and meant as a demonstration of browser-based AI integration with Lexical.
pnpm i && pnpm run dev