@xyd-js/ask-ai
v0.0.0-build-8a0317f-20251214165542
Published
A modular AI chat component library with support for multiple frameworks and environments.
Downloads
992
Readme
@xyd-js/ask-ai
A modular AI chat component library with support for multiple frameworks and environments.
Installation
npm install @xyd-js/ask-aiUsage
Core Components
import { AskAI, AskAIMessage } from '@xyd-js/ask-ai';
// or explicitly
import { AskAI, AskAIMessage } from '@xyd-js/ask-ai/components';React Integration
import { AskAI, useAskAI } from '@xyd-js/ask-ai/react';Node.js Server
import { askPrompt } from '@xyd-js/ask-ai/node';Package Structure
This package provides four main entry points:
📦 Core Components (@xyd-js/ask-ai or @xyd-js/ask-ai/components)
Core Lit-based web components for the AI chat interface.
Exports:
AskAI- Main chat componentAskAIMessage- Individual message component
📦 React Integration (@xyd-js/ask-ai/react)
React wrapper components using @lit/react.
Exports:
AskAI- React component wrapperuseAskAI()- React hook for state management
📦 Node.js Server (@xyd-js/ask-ai/node)
Node.js server utilities for AI integration.
Exports:
askPrompt()- Server-side AI prompt handling
Development
Build
npm run buildDemo
The demo/ directory contains a working example using Vite.
# Run the demo
npm run dev:demo
# Build the demo
npm run build:demoArchitecture
- Components: Lit-based web components with CSS-in-JS styling
- Node: Server-side utilities for AI integration
- React: React wrappers using @lit/react for seamless integration
- Build: Single rollup-based build system with TypeScript support
