1.0.4 • Published 7 months ago
google-realtime-typescript-chat v1.0.4
Google Realtime Chatbot
A React component that provides a real-time chatbot interface powered by Google's AI models.
Installation
npm install google-realtime-typescript
# or
yarn add google-realtime-typescript
# or
pnpm add google-realtime-typescript
Requirements
- React 16.8+ (Hooks support)
- A Supabase account and project
- Google API credentials
Usage
- Import the component and CSS:
import { RealtimeEmbed } from 'google-realtime-typescript';
import 'google-realtime-typescript/dist/output.css';
- Use the component in your React application:
function App() {
return (
<RealtimeEmbed
apiKey="your-google-api-key"
userEmail="user@example.com"
supabaseUrl="your-supabase-url"
supabaseKey="your-supabase-key"
style={{ width: '400px', height: '600px' }}
onError={(error) => console.error('Chat error:', error)}
/>
);
}
Props
Prop | Type | Required | Description |
---|---|---|---|
apiKey | string | Yes | Your Google API key |
userEmail | string | Yes | The email of the current user |
supabaseUrl | string | Yes | Your Supabase project URL |
supabaseKey | string | Yes | Your Supabase project key |
style | React.CSSProperties | No | Custom styles for the container |
onError | (error: Error) => void | No | Error callback function |
Features
- Real-time chat interface
- Minimizable chat window
- Error handling
- Custom styling support
- TypeScript support
- Tailwind CSS styling
Development
- Clone the repository
- Install dependencies:
npm install
- Start development server:
npm run dev
- Run tests:
npm test
Building
npm run build
This will: 1. Compile TypeScript files 2. Generate type definitions 3. Build CSS
License
MIT
Contributing
Contributions are welcome! Please read our Contributing Guide for details.