ant-design / pro-chat

🤖 Components Library for Quickly Building LLM Chat Interfaces.

Home Page:https://pro-chat.antdigital.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

🐛[BUG]ProChatChatReference的pushChat类型属性缺失

HongwuQz opened this issue · comments

🐛 bug 描述

使用ProChatChatReference中的pushChat实际可以添加extra属性用于复杂业务,但参数类型被限制为了只有id、content、role属性的object

🏞 期望结果

更正为ChatMessage类型校验

💻 复现代码

export default Chat(props => {
  const chatRef = useRef<ProChatInstance>();
  
  useEffect(()=> {
    chatRef.current.pushChat({
      id: randomString,
      content: "need change typescript",
      role: "user",
      // 这里会报类型错误缺少extra属性
      extra: {
        something: "useful"
      }
    })
  }, [])

  return (
  <ProChat
    ref={chatRef}
    ....
  />
  )
})

© 版本信息

  • @ant-design/pro-chat 版本: [e.g. 1.0.0]
  • 浏览器环境
  • 开发环境 [e.g. mac OS]