@cognigy/chat-components

中文文档
0.84.0发布于 2026/10/16TypeScriptESM + CJS构建来源已验证近 30 天下载 7011
原始使用文档
文档目录3 节
  1. Develop
  2. To test in local Webchat v3 build:
  3. Release

ESLint Accessibility

Chat Components

This repository contains reusable components Cognigy uses in various of their products in order to render chat-messages such as:

  • text messages
  • galleries
  • quick replies
  • buttons
  • images

and much more. We aim to use these components in various products such as:

  • Cognigy.AI - as part of our Interaction Panel
  • Cognigy Insights - as part of the Transcript Explorer
  • Cognigy Live Agent - in order to render the Chat history
  • Webchat v3 - our new Webchat Widget

Develop

npm run dev

npm run test:watch

To inspect progressive Markdown rendering, open the dev server's /#streaming-messages tab (usually http://localhost:5173/#streaming-messages). Choose an example or enter your own Markdown, then select Replay streaming. It sends eight-character chunks every 250 ms with Markdown and progressive rendering enabled; watch the message while it arrives and compare its finished output with the editor. The existing message examples appear below the replay controls. The former /#streaming-markdown-lab URL also opens this tab.

To test in local Webchat v3 build:

  1. In /chat-components run npm ci && npm pack
  2. In /Webchat folder run npm i with the correct relative path and file name, e.g. npm i ../chat-components/cognigy-chat-components-0.36.1.tgz

Release

npm version patch or npm version minor

It will bump the version in package.json, commit it and create a git tag.

Push the changes to the GitHub and create a PR.

If the bump fails the dom-compat "FIX_VERSION" guard test, the skip block in test/dom-compat.spec.tsx expects a different release number — see docs/accessibility.md.

After the PR is merged:

git push --tags

This will trigger the GitHub Action to create a release on GitHub and will publish the package to npm.

Both release.yml and publish.yml trigger on the tag push itself. Creating a GitHub release by hand does not publish to npm — if a publish run fails, re-run it against the existing tag instead:

gh workflow run publish.yml --ref <tag>

Dispatch against a tag ref (e.g. v1.2.3), never a branch. Publishing is guarded to refs/tags/v* and will skip on anything else.

版本与发布记录

@cognigy/chat-components 共发布 112 个版本,首次发布于 2023/10/26;过去 12 个月发布了 25 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.84.0latest2026/10/1624 天前
0.83.02026/10/011 个月前
0.82.02026/09/291 个月前
0.81.02026/09/111 个月前
0.80.02026/09/042 个月前
0.79.02026/08/212 个月前

关于 @cognigy/chat-components 的常见问题

@cognigy/chat-components 是什么?

[![Accessibility](https://github.com/Cognigy/chat-components/actions/workflows/a11y.yml/bad

如何安装 @cognigy/chat-components?

在项目目录运行 npm install @cognigy/chat-components,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(^19.x || ^18.3.0)、react-dom(^19.x || ^18.3.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@cognigy/chat-components 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@cognigy/chat-components 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@cognigy/chat-components 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.1.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@cognigy/chat-components 可以商用吗?

@cognigy/chat-components 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@cognigy/chat-components 的下载量有多少?

根据 npm 官方下载统计,@cognigy/chat-components 在 2026/10/11 – 2026/11/09 这 30 天内被下载 7,011 次,日均约 234 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@cognigy/chat-components 还在维护吗?

最新版本 0.84.0 发布于 2026/10/16(24 天前);至今共发布 112 个版本,其中过去 12 个月发布了 25 个;首次发布于 2023/10/26。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。