ant-design / pro-chat

🤖 Components Library for Quickly Building LLM Chat Interfaces.
https://pro-chat.antdigital.dev
MIT License
725 stars 92 forks source link

🧐[问题] properties of null (reading 'useContext') #194

Open hello-yajing opened 6 months ago

hello-yajing commented 6 months ago

🧐 问题描述

自定义Actions中的按钮引入antd的Button/图标,会报错: image

💻 示例代码

` <div style={{ height: 500, backgroundColor: "#f5f5f5" }}> <ProChat helloMessage={ '欢迎使用 ProChat ,我是你的专属机器人,这是我们的 Github:ProChat' } actions={{ render: (defaultDoms) => { return [

          ,
          ...defaultDoms,
        ];
      },
      flexConfig: {
        gap: 24,
        direction: 'horizontal',
        justify: 'space-between',
      },
    }}
    request={async (messages) => {
      const mockedData: string = `这是一段模拟的流式字符串数据。本次会话传入了${messages.length}条消息`;

      const mockResponse = new MockResponse(mockedData);

      return mockResponse.getResponse();
    }}
  />
</div>

`

🚑 其他信息

版本信息: ` { "private": true, "author": "yj ********@qq.com", "scripts": { "dev": "umi dev", "build": "umi build", "postinstall": "umi setup", "setup": "umi setup", "start": "npm run dev" }, "dependencies": { "@ant-design/pro-chat": "^1.12.2", "antd": "^5.16.1", "antd-style": "^3.6.2", "umi": "^4.1.9" }, "devDependencies": { "@types/react": "^18.0.33", "@types/react-dom": "^18.0.11", "typescript": "^5.0.3" } }

`

hello-yajing commented 6 months ago

image 代码重新发一下

ONLY-yours commented 6 months ago

感觉错误不在这里,我这边一切良好。

antd/icons 需要你手动安装下,我看你的 packagejson 并没有指定,可以试试指定下

hello-yajing commented 6 months ago

感觉错误不在这里,我这边一切良好。

antd/icons 需要你手动安装下,我看你的 packagejson 并没有指定,可以试试指定下

手动安装了,还是报错;换成了“lucide-react”能解决问题

hello-yajing commented 6 months ago

image

ONLY-yours commented 6 months ago

有点奇怪,我这个issue先放着,如果我这边能复现到问题,我在这里继续推进。

hello-yajing commented 6 months ago

有点奇怪,我这个issue先放着,如果我这边能复现到问题,我在这里继续推进。

好嘞,非常感谢~