跳转到内容
搜索文档

RtkChatComposerView

最后更新 查看 MarkdownAgent 设置

渲染聊天编辑器的组件

属性

属性 类型 是否必填 默认值 描述
canSendFiles boolean ✅ - 用户是否可以发送文件消息
canSendTextMessage boolean ✅ - 用户是否可以发送文本消息
iconPack IconPack1 ❌ defaultIconPack 图标包
inputTextPlaceholder string ✅ - 文本输入框占位字符
isEditing boolean ✅ - 将编辑器设置为编辑模式
maxLength number ✅ - 文本输入的最大长度
message string ✅ - 要预填的消息
quotedMessage string ✅ - 要显示的引用消息
rateLimits { period: number; maxInvocations: number; } ✅ - 速率限制
storageKey string ✅ - 在 localStorage 中存储消息的键名
t RtkI18n1 ❌ useLanguage() 语言

使用示例

基本用法

import { RtkChatComposerView } from '@cloudflare/realtimekit-react-ui';

function MyComponent() {
  return <RtkChatComposerView />;
}

带有属性

import { RtkChatComposerView } from '@cloudflare/realtimekit-react-ui';

function MyComponent() {
  return (
    <RtkChatComposerView
      canSendFiles={true}
      canSendTextMessage={true}
      inputTextPlaceholder="example"
    />
  );
}

这篇文档对您有帮助吗?