ui-embed

maneeshanif's avatarfrom maneeshanif

Embed the chatbot UI inside Docusaurus and connect it to the FastAPI RAG backend. Use when building chat components, handling streaming responses, or integrating chat widgets into MDX pages.

⭐0stars🔀0forks📁View on GitHub🕐Updated Dec 7, 2025

When & Why to Use This Skill

The UI Embed skill for Claude streamlines the process of building and integrating a responsive chatbot interface within Docusaurus documentation sites. By bridging React-based frontend components with a FastAPI RAG (Retrieval-Augmented Generation) backend, it enables developers to implement advanced features like real-time streaming responses, context-aware 'selected-text' querying, and seamless MDX-based widget embedding to enhance user interactivity and self-service support.

Use Cases

  • Case 1: Deploying a RAG-powered AI assistant within technical documentation to help users find answers across complex knowledge bases.
  • Case 2: Implementing a 'Chat with Selection' feature that allows users to highlight specific documentation text and receive instant, grounded AI explanations.
  • Case 3: Embedding interactive AI chat widgets directly into MDX-based tutorials to provide real-time, step-by-step coding guidance and troubleshooting.
nameui-embed
descriptionEmbed the chatbot UI inside Docusaurus and connect it to the FastAPI RAG backend. Use when building chat components, handling streaming responses, or integrating chat widgets into MDX pages.

UI Embed Skill

Instructions

  1. Build component

    • Create React chat panel (ChatbotPanel.tsx) with:
      • Message list
      • Input field
      • Mode toggle (RAG vs Selected Text)
      • Source list display
    • Handle streaming responses (EventSource/fetch reader)
    • Include loading and error UI states
  2. API client

    • Create fetch helpers for /query and /query/selected
    • Include page metadata (module/week/title) for logging
    • Debounce/trim inputs; enforce max length
  3. Integration

    • Add to src/theme/Layout or dedicated Chat page
    • Optionally show floating button
    • Provide MDX shortcode to drop chat in specific chapters
  4. UX and accessibility

    • Basic console logging for failures
    • Friendly fallback messages
    • Focus management, keyboard submit
    • Readable contrast

Examples

// ChatbotPanel.tsx
import React, { useState } from 'react';

export function ChatbotPanel({ apiUrl }: { apiUrl: string }) {
  const [messages, setMessages] = useState([]);
  const [input, setInput] = useState('');
  const [mode, setMode] = useState<'rag' | 'selected'>('rag');
  
  // ... implementation
}
{/* In any MDX page */}
import { ChatbotPanel } from '@site/src/components/ChatbotPanel';

<ChatbotPanel apiUrl={process.env.API_URL} />

Definition of Done

  • Widget renders in Docusaurus dev build; can query backend
  • Selected-text path sends provided text and returns grounded answer
  • Error/loading states visible; minimal styling but responsive
  • Integration steps documented for future pages