Agent Chat
inferencesh/agentFreeBlock
Full-featured AI agent chat with state management, tools, and widgets.
Live preview
live · rendered by the registry
Rendered by inferencesh on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://ui.inference.sh/r/agent.jsonSource
1/**2 * Agent - Pre-composed Chat Component3 *4 * Ready-to-use chat UI built from primitives.5 * Uses @inferencesh/sdk/agent for state management.6 */78import React, { memo, useMemo } from 'react';9import { cn } from '@/lib/utils';10import { Bot } from 'lucide-react';11import { Button } from '@/components/ui/button';12import {13 Inference,14 ChatMessageStatusReady,15 ChatMessageStatusFailed,16 ChatMessageStatusCancelled,17 ChatMessageRoleUser,18 ChatMessageRoleAssistant,19 ChatMessageContentTypeReasoning,20 ChatMessageContentTypeText,21 type ChatMessageDTO,22} from '@inferencesh/sdk';23import {24 AgentChatProvider,25 useAgentChat,26 useAgentActions,27 isAdHocConfig,28 type AgentOptions,29} from '@inferencesh/sdk/agent';30import { ChatContainer } from '@/components/infsh/agent/chat-container';31import { VirtualizedChatMessages } from '@/registry/blocks/chat/components/virtualized-chat-messages';32import { ChatInput } from '@/components/infsh/agent/chat-input';33import { MessageBubble } from '@/components/infsh/agent/message-bubble';34import { MessageContent } from '@/components/infsh/agent/message-content';35import { MessageReasoning } from '@/components/infsh/agent/message-reasoning';36import { MessageStatusIndicator } from '@/components/infsh/agent/message-status-indicator';37import { ToolInvocations } from '@/components/infsh/agent/tool-invocations';3839// Component props40interface AgentProps {41 proxyUrl?: string;42 apiKey?: string;43 baseUrl?: string;44 config: AgentOptions;45 name?: string;46 chatId?: string;47 className?: string;48 compact?: boolean;49 allowFiles?: boolean;50 allowImages?: boolean;51 onChatCreated?: (chatId: string) => void;52 description?: string;53 examplePrompts?: string[];54}5556// Check if message status is terminal (generation complete)57function isTerminalStatus(status: string | undefined): boolean {58 return status === ChatMessageStatusReady ||59 status === ChatMessageStatusFailed ||60 status === ChatMessageStatusCancelled;61}6263// =============================================================================64// Helper functions65// =============================================================================6667function getTextContent(message: ChatMessageDTO): string {68 const textContent = message.content.find((c) => c.type === ChatMessageContentTypeText);69 return textContent?.text ?? '';70}7172function getReasoningContent(message: ChatMessageDTO): string | undefined {73// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from inferencesh
All 14 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Chat UI Primitiveschat | inferencesh | Blocks | Free | 1 dep · 15 files | |
| Code Blockcode-block | inferencesh | Blocks | Free | no deps · 7 files | |
| Markdown Renderer (legacy)markdown | inferencesh | Blocks | Free | 2 deps · 2 files | |
| pretext-mdpretext-md | inferencesh | Blocks | Free | 4 deps · 10 files | |
| Sidebar Lightsidebar-light | inferencesh | Blocks | Free | no deps | |
| Stepssteps | inferencesh | Blocks | Free | no deps · 2 files | |
| Table of Contentstable-of-contents | inferencesh | Blocks | Free | no deps | |
| Tasktask | inferencesh | Blocks | Free | 1 dep · 9 files |
