A headless chat component for building AI-powered conversational interfaces. Use this to quickly implement agent-based chat functionality within React applications using CopilotKit hooks.
// Source: https://github.com/CopilotKit/CopilotKit.git | License: MIT | Copyright Atai Barkai
// Provided via justclaw.it.com; keep this notice with the code.
"use client";
/**
* The whole demo, in one screenful: two hooks turn a shadcn shell into a
* working chat. `useAgent` exposes the message log + run state for one
* agent; `useCopilotKit` runs it.
*/
import { useState } from "react";
import { useAgent, useCopilotKit } from "@copilotkit/react-core/v2";
import { Sparkles } from "lucide-react";
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from "@/components/ui/card";
import { ScrollArea } from "@/components/ui/scroll-area";
import { Separator } from "@/components/ui/separator";
import { AssistantBubble, UserBubble } from "./message-bubble";
imp
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key