Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@waii-ai/widgets

Package Overview
Dependencies
Maintainers
0
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@waii-ai/widgets

Widgets for Waii, the worlds most powerful text-to-sql API.

  • 1.27.4
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
8
decreased by-57.89%
Maintainers
0
Weekly downloads
 
Created
Source

Waii Widgets

A collection of React UI components featuring the WaiiChat widget, which provides embedded chat functionality powered by Waii's text-to-SQL API.

Features

  • 🚀 Easy to integrate with multiple implementation options
  • 💅 Customizable themes and styling
  • 📱 Mobile-responsive
  • 🔒 TypeScript support
  • ⚡ Lightweight
  • 🎯 Three integration methods: React Component, Standalone Script, or iFrame Embed

Installation

# Using npm
npm install @waii-ai/widgets

# Using yarn
yarn add @waii-ai/widgets

# Using pnpm
pnpm add @waii-ai/widgets

Integration Methods

1. React Component

import { WaiiChat } from '@waii-ai/widgets';

function App() {
  return (
    <WaiiChat 
      apiKey="your-api-key"
      databaseKey="your-database-key"
      theme="light"
      handleChatResponse={(response) => {
        console.log('Chat response:', response);
      }}
    />
  );
}

2. Standalone Script

<script src="https://unpkg.com/@waii-ai/widgets/dist/waii-widgets.js"></script>

<div id="waii-chat"></div>
<script>
  WaiiWidgets.WaiiChatLoader.init({
    containerId: 'waii-chat',
    apiKey: 'your-api-key',
    databaseKey: 'your-database-key',
    theme: 'light',
    onMessage: (message) => console.log('New message:', message)
  });
</script>

3. iFrame Embed

<script src="https://unpkg.com/@waii-ai/widgets/dist/embed.js"></script>

<div id="chat-container"></div>
<script>
  const chatWidget = new WaiiWidgets.WaiiChatEmbed('#chat-container', {
    apiKey: 'your-api-key',
    databaseKey: 'your-database-key',
    theme: 'light',
    onChatResponse: (response) => {
      console.log('Chat response:', response);
    }
  });
</script>

Configuration Options

Core Properties

PropertyTypeRequiredDescription
apiKeystringYesYour Waii API key
databaseKeystringYesYour database connection string
apiUrlstringNoCustom API endpoint (if different from default)
theme'light' | 'dark'NoWidget theme (default: 'light')

Styling Options

PropertyTypeDescription
classNamestringCSS class for the container
styleReact.CSSPropertiesInline styles for the container
contentStyleReact.CSSPropertiesStyles for the content area
messageListStyleReact.CSSPropertiesStyles for the message list
inputStyleReact.CSSPropertiesStyles for the input area

Branding Options

PropertyTypeDescription
botNamestringCustom name for the chat bot
botAvatarUrlstringCustom avatar URL for the bot

AI Configuration

PropertyTypeDescription
useFewShotLearningbooleanEnable few-shot learning
useReflectionbooleanEnable reflection capabilities
useStrictHallucinationCheckbooleanEnable strict hallucination checking
modelstringSpecify the AI model to use

Callback Functions

PropertyTypeDescription
handleChatResponse(response: any) => voidCalled when a chat response is received
handleReset() => voidCalled when the chat is reset
handleEditChatFunctionCalled when a chat message is edited
onQueryProcessed() => voidCalled when a query is processed

State Management

PropertyTypeDescription
chatHistoryListany[]Pre-populate chat with history
selectedDBConnectoranySet the selected database connector
chatQueryEditedstring | nullPre-set edited query
chatAskEditedstring | nullPre-set edited question

Development

# Install dependencies
npm install

# Build for production
npm run build

# Run tests
npm run test

Support

For issues and feature requests, please contact Waii support.

Keywords

FAQs

Package last updated on 21 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc