Context Budget Meter
Окно контекста по частям: системный промпт, документы, история, переполнение и что сократить. Pro · ИИ: чат и агенты › Токены и контекст
Установка
npx valyro-cli@latest login
npx valyro-cli@latest add context-budget-meter
npm install valyro-ui-pro
import 'valyro-ui-pro/styles.css';
import { ContextBudgetMeter } from 'valyro-ui-pro';
Пропсы
| Prop | Type | Default | |
|---|---|---|---|
segments * | ContextSegment[] | Parts of the prompt in the order they are sent: system, memory, documents, history, tool output. | |
limit * | number | The model's context window in tokens. | |
reserve | number | 0 | Tokens kept free for the answer. Default 0. |
warnAt | number | 0.85 | Share of the window that turns the meter amber. Default 0.85. |
onTrim | (segmentId: string, tokens: number) => void | Adds Trim buttons to the suggested cuts; called with the segment and how many tokens to cut. | |
variant | 'full' | 'compact' | 'full' | full (default) adds the legend, breakdown and trim plan; compact is the bar and one line. |
loading | boolean | false | Tokens are being counted: skeleton. |
error | ReactNode | Counting failed: shown instead of the meter. | |
title | ReactNode | Heading. Default: labels.title. | |
headingLevel | 2 | 3 | 4 | 5 | 3 | Level of the heading (default 3). |
locale | string | BCP 47 locale for numbers; defaults to the ThemeProvider's. | |
labels | Partial<Omit<ContextBudgetMeterLabels, 'statuses' | 'kinds'>> & { statuses?: Partial<Record<BudgetStatus, string>>; kinds?: Partial<Record<ContextSegmentKind, string>>; } | Overrides for the built-in English text; keys left out keep their defaults. |
Похожие компоненты
- Token Usage — Отображение затрат токенов
- AI Chat Window — Окно AI-чата
- Chat Message — Сообщения с потоковым выводом
- Message Branches — Версии сообщения и дерево веток диалога
- Streaming Text — Плавный вывод потока токенов
- Markdown Preview — Отображение Markdown
- Response Feedback — Оценка ответа и рубрика для асессоров
- Prompt Composer — Поле промпта с вложениями
- Inline Suggestion — Подсказка-автодополнение в поле ввода
- Model Selector — Выбор модели ИИ
- Model Comparison — Сравнение ответов нескольких моделей
- Prompt Library — Библиотека промптов с переменными
Назад: Token Usage · Далее: Prompt Editor · Весь раздел «ИИ: чат и агенты»