Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
HongwuQz opened this issue May 13, 2024 · 0 comments
Open

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

HongwuQz opened this issue May 13, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@HongwuQz
Copy link

HongwuQz commented May 13, 2024

🐛 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]
@ONLY-yours ONLY-yours added the bug Something isn't working label May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants