Компоненты
- Accordion
- Alert
- Alert Dialog
- Autocomplete
- Avatar
- Badge
- Breadcrumb
- Button
- Calendar
- Card
- Checkbox
- Checkbox Group
- Collapsible
- Combobox
- Command
- Date Picker
- Dialog
- DrawerNew
- Empty
- Field
- Fieldset
- Form
- Frame
- Group
- Input
- Input Group
- Kbd
- Label
- Menu
- Meter
- Number Field
- OTP FieldNew
- Pagination
- Popover
- Preview Card
- Progress
- Radio Group
- Scroll Area
- Select
- Separator
- Sheet
- Skeleton
- Slider
- Spinner
- Switch
- Table
- Tabs
- Textarea
- Toast
- Toggle
- Toggle Group
- Toolbar
- Tooltip
AI Components
- AI Components
- Chat Conversation
- Chat Message
- Chat Response
- Chat Suggestion
- Chat Prompt Input
- Chat Attachments
- Chat Code Block
- Chat Image
- Chat Inline Citation
- Chat Reasoning
- Chat Sources
- Chat Actions
- Chat Context
- Chat Loader
- Chat Task
- Chat Tool
- Chat Web Preview
- Chat Snippet
- Chat Terminal
- Chat Stack Trace
- Chat Test Results
- Chat File Tree
- Chat Environment Variables
- Chat Audio Player
- Chat Transcription
- Chat Speech Input
- Chat Mic Selector
- Chat Voice Selector
- Chat Agent
- Chat Persona
- Chat Connection
- Chat Queue
- Chat Checkpoint
- Chat Confirmation
- Chat Artifact
- Chat JSX Preview
- Chat Schema Display
- Chat Package Info
- Chat Commit
- Chat Plan
- Chat Panel
- Chat Open In Chat
- Chat Sandbox
- Chat Model Selector
- Chat Canvas
- Chat Node
- Chat Edge
Resources
Chat Agent
Карточка identity агента — имя, модель, инструкции, tools, output schema.
Research assistantclaude-opus-4-7
Instructions
You are a research assistant. Always cite sources, prefer primary documentation, and call
read_file before answering questions about the codebase.Tools (3)
Output Schema
output.ts
type ResearchOutput = { summary: string; sources: Array<{ title: string; url: string }>;};import {
ChatAgent,
ChatAgentContent,
ChatAgentHeader,
ChatAgentInstructions,
ChatAgentOutput,
type ChatAgentTool,
ChatAgentTools,
} from "@/components/ui/chat-agent";
const tools: ChatAgentTool[] = [
{
name: "web_search",
description: "Search the web for fresh information.",
inputSchema: {
type: "object",
properties: {
query: { type: "string" },
limit: { type: "number", default: 5 },
},
required: ["query"],
},
},
{
name: "read_file",
description: "Read contents of a file in the workspace.",
inputSchema: {
type: "object",
properties: { path: { type: "string" } },
required: ["path"],
},
},
{
name: "run_shell",
description: "Execute a shell command in the project root.",
},
];
const outputSchema = `type ResearchOutput = {
summary: string;
sources: Array<{ title: string; url: string }>;
};`;
export default function Particle() {
return (
<div className="w-full max-w-2xl p-4">
<ChatAgent>
<ChatAgentHeader name="Research assistant" model="claude-opus-4-7" />
<ChatAgentContent>
<ChatAgentInstructions>
You are a research assistant. Always cite sources, prefer primary
documentation, and call <code>read_file</code> before answering
questions about the codebase.
</ChatAgentInstructions>
<ChatAgentTools tools={tools} />
<ChatAgentOutput schema={outputSchema} />
</ChatAgentContent>
</ChatAgent>
</div>
);
}
Installation
pnpm dlx shadcn@latest add @jenny/chat-agent
Usage
import {
ChatAgent,
ChatAgentContent,
ChatAgentHeader,
ChatAgentInstructions,
ChatAgentOutput,
ChatAgentTools,
type ChatAgentTool,
} from "@/components/ui/chat-agent";
const tools: ChatAgentTool[] = [
{
name: "web_search",
description: "Search the web for fresh information.",
inputSchema: {
type: "object",
properties: {
query: { type: "string" },
limit: { type: "number", default: 5 },
},
required: ["query"],
},
},
];
<ChatAgent>
<ChatAgentHeader name="Research assistant" model="claude-opus-4-7" />
<ChatAgentContent>
<ChatAgentInstructions>
You are a research assistant. Always cite sources.
</ChatAgentInstructions>
<ChatAgentTools tools={tools} />
<ChatAgentOutput schema={`type Output = { summary: string; sources: string[] }`} />
</ChatAgentContent>
</ChatAgent>API
| Component | Описание |
|---|---|
ChatAgent | Корневой контейнер. |
ChatAgentHeader | Заголовок: иконка, имя, badge модели, slot actions для меню/статуса. |
ChatAgentContent | Вертикальный stack полей. |
ChatAgentInstructions | Блок «Instructions» — system prompt. |
ChatAgentTools | Аккордеон с tools, каждый разворачивается в JSON schema под shiki. |
ChatAgentOutput | Output schema — TypeScript или JSON. |
On This Page