Package Exports
- @openchatwidget/sdk
- @openchatwidget/sdk/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@openchatwidget/sdk) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
OpenChatWidget
OpenChatWidget is a minimal, open-source React chat widget for any website. It intentionally ships only the client widget:
- floating bottom-right widget UI
- AI SDK chat streaming client
Live chat, Convex, dashboard, and backend hosting are intentionally excluded.
Install the widget
cd /Users/matt8p/Desktop/openchatwidget/sdk
npm installUse the component (React)
import { OpenChatWidget } from "openchatwidget";
export default function App() {
return <OpenChatWidget url={"http://localhost:3001/api/chat"} />;
}url is the only configurable React prop and should point to your exact chat endpoint.
Example backend and app
A Vite + Express example app lives in:
/Users/matt8p/Desktop/openchatwidget/examples/vite-express-app
It includes:
- Vite landing page with
OpenChatWidget - Express
POST /api/chatendpoint - AI SDK streaming response from the backend endpoint
Backend helpers
The package also re-exports the backend helpers used by the example server, so a simple OpenAI-backed server can import from openchatwidget directly:
import {
convertToModelMessages,
createOpenAI,
streamText,
type UIMessage,
} from "openchatwidget";Build
npm run buildThis outputs:
dist/index.js(widget bundle)