For AI agents: the complete documentation index is available at /next/zh/llms.txt, the full documentation bundle is available at /next/zh/llms-full.txt, and this page is available as Markdown at /next/zh/api/genui/openui/chat/functions/createOpenUiChatLibrary.md.
Lynx
  • 简体中文
  • 函数: createOpenUiChatLibrary()

    createOpenUiChatLibrary(): Library

    创建以 Card 为根的 OpenUI Chat 响应组件库。 只创建一次,并在后续渲染中向 OpenUiRenderer 传入同一实例。

    返回

    Library

    备注

    此工厂注册整套 Chat 组件并引入其样式。 若只需引入所选组件及其样式,请从 @lynx-js/genui/openui/chat/<Component> 逐个导入组件,再使用 @lynx-js/genui/openui/explicit 中的 createOpenUiLibrary 组装组件库。

    示例

    const library = createOpenUiChatLibrary();
    <OpenUiRenderer library={library} response={'root = Card([TextContent("Hello")])'} />;
    除非另有说明,本项目采用知识共享署名 4.0 国际许可协议进行许可,代码示例采用 Apache License 2.0 许可协议进行许可。