Prompt Composer
Поле промпта с вложениями. Pro · ИИ: чат и агенты › Промпт и модели
Установка
npx valyro-cli@latest login
npx valyro-cli@latest add prompt-composer
npm install valyro-ui-pro
import 'valyro-ui-pro/styles.css';
import { PromptComposer } from 'valyro-ui-pro';
Пропсы
| Prop | Type | Default | |
|---|---|---|---|
value | string | Controlled value; use with onValueChange. | |
defaultValue | string | '' | Initial value when uncontrolled. |
onValueChange | (value: string) => void | Called with the new value when it changes. | |
onSend | (message: PromptSubmission) => void | Enter (without Shift) or the send button. The composer clears itself afterwards. | |
loading | boolean | false | A reply is generating: Enter is ignored and the send button becomes Stop. |
onStop | () => void | Called by the Stop button while loading; without it Stop is disabled. | |
placeholder | string | 'Ask anything…' | Hint text in the empty message field. |
disabled | boolean | false | Blocks typing, attaching and sending. |
allowAttachments | boolean | true | Attach files with the paperclip, paste or drag-and-drop. Default true. |
accept | string | File types for the picker, paste and drop — same syntax as <input accept>. | |
defaultFiles | File[] | Files attached on the first render, e.g. a restored draft; later changes are ignored. | |
onReject | (files: File[], reason: PromptRejectReason) => void | Files that were picked, pasted or dropped but turned away; the composer also shows an inline message. | |
toolbar | ReactNode | Controls beside the attach button, e.g. a ModelSelector. | |
maxLength | number | Character limit; shows a counter. | |
hint | ReactNode | Small note next to the send button, e.g. a token estimate. | |
textareaRef | Ref<HTMLTextAreaElement> | Ref to the inner message <textarea>, e.g. to focus it from outside. | |
autoFocus | boolean | Focuses the message field on mount. | |
locale | string | BCP 47 locale for attachment sizes and the character counter; defaults to the ThemeProvider's. | |
labels | Partial<PromptComposerLabels> | Overrides for the built-in English text; keys left out keep their defaults. |
Похожие компоненты
- Inline Suggestion — Подсказка-автодополнение в поле ввода
- Model Selector — Выбор модели ИИ
- Model Comparison — Сравнение ответов нескольких моделей
- Prompt Library — Библиотека промптов с переменными
- AI Chat Window — Окно AI-чата
- Chat Message — Сообщения с потоковым выводом
- Message Branches — Версии сообщения и дерево веток диалога
- Streaming Text — Плавный вывод потока токенов
- Markdown Preview — Отображение Markdown
- Response Feedback — Оценка ответа и рубрика для асессоров
- Chain of Thought — Ход рассуждений модели
- Tool Call — Вызов инструмента с подтверждением
Назад: Response Feedback · Далее: Inline Suggestion · Весь раздел «ИИ: чат и агенты»