1.0.4 • Published 7 months ago

google-realtime-typescript-chat v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

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

  1. Import the component and CSS:
import { RealtimeEmbed } from 'google-realtime-typescript';
import 'google-realtime-typescript/dist/output.css';
  1. 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

PropTypeRequiredDescription
apiKeystringYesYour Google API key
userEmailstringYesThe email of the current user
supabaseUrlstringYesYour Supabase project URL
supabaseKeystringYesYour Supabase project key
styleReact.CSSPropertiesNoCustom styles for the container
onError(error: Error) => voidNoError callback function

Features

  • Real-time chat interface
  • Minimizable chat window
  • Error handling
  • Custom styling support
  • TypeScript support
  • Tailwind CSS styling

Development

  1. Clone the repository
  2. Install dependencies:
    npm install
  3. Start development server:
    npm run dev
  4. 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.