Alquimia Documentation
  • Welcome To Alquimia
  • Architecture
  • Operational Handler
  • Alquimia Runtime Helm Chart
  • UI SDK
    • Alquimia-AI Tools
      • Summary
      • getting-started
        • Getting Started with Alquimia Tools
    • Alquimia-AI UI
      • Summary
      • api-reference
        • API Types Reference
      • components
        • Atom Components
        • Molecules
        • Organism Components
        • Components Overview
      • examples
        • Examples
      • getting-started
        • Installation
      • styling
        • Styling Guide
        • Using Custom Themes with Tailwind CSS
    • Alquimia AI Widget
Powered by GitBook
On this page
  • Overview
  • How It Works
  • Integration
  • Development
  • Docker Deployment
  • Prerequisites
  • Docker Configuration
  • Environment Variables
  • Building and Running with Docker
  • Docker Health Checks
  • Volume Mounts
  • API Endpoints
  1. UI SDK

Alquimia AI Widget

PreviousUsing Custom Themes with Tailwind CSS

Last updated 3 months ago

A lightweight, embeddable chat widget that allows you to integrate the Alquimia AI assistant into any website. The widget appears as a floating button that expands into a full chat interface when clicked.

The widget repository is available at . Note that the widget must be deployed to a server before it can be consumed by a parent application using the script tag integration.

Overview

This widget application provides:

  • A floating chat button

  • Expandable chat interface

  • Seamless integration with Alquimia AI's assistant

  • Responsive design for all devices

  • Customizable appearance

How It Works

The widget implementation follows these key steps:

  1. When you include the widget script via /api/widget, it:

    • Creates an iframe element on your webpage

    • Positions it in the bottom-right corner

    • Loads the widget interface within the iframe for security and style isolation

  2. The widget consists of two main states:

    • A floating button (minimized state)

    • A full chat interface (expanded state)

Integration

To add the widget to your website, include the following script tag:

<script src="https://<app_url>/api/widget"></script>

The widget will automatically initialize and appear as a floating button in the bottom-right corner of your page.

Development

To run the development server:

npm run dev
# or
yarn dev
# or
pnpm dev

Docker Deployment

Prerequisites

  • Docker

  • Docker Compose

Docker Configuration

The application uses a multi-stage build process for optimal production deployment:

  1. Builder Stage: Compiles and builds the Next.js application

  2. Runner Stage: Creates a lightweight production image

Environment Variables

Create a .env file with the required variables:

NEXT_PUBLIC_DEFAULT_ASSISTANT_ID=
NEXT_PUBLIC_ASSISTANT_BASEURL=
ALQUIMIA_ASSISTANT_API_KEY=
NEXT_PUBLIC_APP_URL=
APP_ROOT=

Building and Running with Docker

  1. Build and start the container:

docker-compose up --build
  1. Run in detached mode:

docker-compose up -d
  1. Stop the container:

docker-compose down

Docker Health Checks

The service includes health checks that:

  • Monitor the application every 30 seconds

  • Timeout after 10 seconds

  • Allow 3 retries before marking unhealthy

Volume Mounts

The following directories are mounted as volumes:

  • ./public:/app/public: For static files

  • ./.next:/app/.next: For Next.js build output

API Endpoints

  • /api/widget: Serves the widget script that can be embedded in any website

Then open to view the widget demo page.

@Alquimia-ai/alquimia-widget
http://localhost:3000