Компоненты
- 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 Context
Счётчик использования контекстного окна — иконка-индикатор + popover с разбивкой.
import {
ChatContext,
ChatContextPopup,
ChatContextTrigger,
} from "@/components/ui/chat-context";
export default function Particle() {
return (
<div className="flex w-full items-center justify-center p-8">
<ChatContext
breakdown={[
{ label: "System prompt", value: 1_240 },
{ label: "Conversation", value: 41_080 },
{ label: "Attached documents", value: 6_120 },
]}
max={200_000}
modelId="claude-opus-4-7"
used={48_440}
>
<ChatContextTrigger />
<ChatContextPopup />
</ChatContext>
</div>
);
}
Installation
pnpm dlx shadcn@latest add @jenny/chat-context
Usage
import {
ChatContext,
ChatContextPopup,
ChatContextTrigger,
} from "@/components/ui/chat-context";
<ChatContext
used={48_320}
max={200_000}
modelId="claude-opus-4-7"
breakdown={[
{ label: "System", value: 1_200 },
{ label: "Conversation", value: 41_000 },
{ label: "Documents", value: 6_120 },
]}
>
<ChatContextTrigger />
<ChatContextPopup />
</ChatContext>API
| Prop | Описание |
|---|---|
used | Токенов израсходовано. |
max | Максимальный контекст модели. |
modelId | Опционально, показывается в popover. |
breakdown | Опциональный массив { label, value } — построчная разбивка в popover. |
Триггер и popup — обычные PopoverTrigger / PopoverPopup, кастомизируются как любые popover-компоненты Jenny.
Само значение used / max ты считаешь сам (например, через tokenlens или LanguageModelUsage из AI SDK). Компонент агностичен к источнику — он только рендерит.
On This Page