@tdesign-react/chat 1.1.0-alpha.7 → 1.1.0-alpha.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/CHANGELOG.md +14 -1
  2. package/README.md +76 -22
  3. package/es/_chunks/dep-e9dbff09.js +1247 -0
  4. package/es/_chunks/dep-e9dbff09.js.map +1 -0
  5. package/es/_chunks/dep-f691a67e.js +438 -0
  6. package/es/_chunks/dep-f691a67e.js.map +1 -0
  7. package/es/_chunks/dep-f8016301.js +169 -0
  8. package/es/_chunks/dep-f8016301.js.map +1 -0
  9. package/es/_util/reactify.js +1 -1
  10. package/es/_util/useDynamicStyle.js +1 -1
  11. package/es/attachments/index.js +1 -1
  12. package/es/chat-actionbar/index.js +1 -1
  13. package/es/chat-engine/components/activity/index.js +2 -2
  14. package/es/chat-engine/components/activity/registry.js +1 -1
  15. package/es/chat-engine/components/activity/render.js +2 -3
  16. package/es/chat-engine/components/activity/render.js.map +1 -1
  17. package/es/chat-engine/components/activity/types.d.ts +0 -3
  18. package/es/chat-engine/components/activity/types.js +1 -1
  19. package/es/chat-engine/components/index.js +4 -4
  20. package/es/chat-engine/components/json-render/catalog/atomic/button.js +1 -1
  21. package/es/chat-engine/components/json-render/catalog/atomic/card.js +1 -1
  22. package/es/chat-engine/components/json-render/catalog/atomic/input.js +4 -4
  23. package/es/chat-engine/components/json-render/catalog/atomic/layout.js +1 -1
  24. package/es/chat-engine/components/json-render/catalog/atomic/text.js +1 -1
  25. package/es/chat-engine/components/json-render/catalog/catalog-to-prompt.js +1 -1
  26. package/es/chat-engine/components/json-render/contexts/actions.js +2 -2
  27. package/es/chat-engine/components/json-render/contexts/data.js +2 -2
  28. package/es/chat-engine/components/json-render/contexts/index.js +2 -2
  29. package/es/chat-engine/components/json-render/contexts/store.js +1 -1
  30. package/es/chat-engine/components/json-render/contexts/tree.js +1 -1
  31. package/es/chat-engine/components/json-render/contexts/validation.js +2 -2
  32. package/es/chat-engine/components/json-render/contexts/visibility.js +2 -2
  33. package/es/chat-engine/components/json-render/index.js +4 -4
  34. package/es/chat-engine/components/json-render/registry/a2ui-binding.js +4 -4
  35. package/es/chat-engine/components/json-render/registry/a2ui-registry.js +4 -4
  36. package/es/chat-engine/components/json-render/registry/config.js +4 -4
  37. package/es/chat-engine/components/json-render/registry/index.js +4 -4
  38. package/es/chat-engine/components/json-render/renderer/A2UIJsonRenderActivityRenderer.js +3 -3
  39. package/es/chat-engine/components/json-render/renderer/JsonRenderActivityRenderer.js +3 -3
  40. package/es/chat-engine/components/json-render/renderer/JsonUIRenderer.js +2 -2
  41. package/es/chat-engine/components/json-render/renderer/_index.js +2 -2
  42. package/es/chat-engine/components/json-render/types.js +1 -1
  43. package/es/chat-engine/components/provider/agent-state.js +2 -2
  44. package/es/chat-engine/components/toolcall/index.js +2 -2
  45. package/es/chat-engine/components/toolcall/registry.js +1 -1
  46. package/es/chat-engine/components/toolcall/render.js +2 -2
  47. package/es/chat-engine/components/toolcall/render.js.map +1 -1
  48. package/es/chat-engine/components/toolcall/types.js +1 -1
  49. package/es/chat-engine/core/adapters/a2ui/index.js +1 -1
  50. package/es/chat-engine/core/adapters/a2ui/processor/A2uiMessageProcessor.js +1 -1
  51. package/es/chat-engine/core/adapters/a2ui/processor/ComponentTree.js +1 -1
  52. package/es/chat-engine/core/adapters/a2ui/processor/DataStore.js +1 -1
  53. package/es/chat-engine/core/adapters/a2ui/processor/PathResolver.js +1 -1
  54. package/es/chat-engine/core/adapters/a2ui/types/index.js +1 -1
  55. package/es/chat-engine/core/adapters/a2ui/types/types.js +1 -1
  56. package/es/chat-engine/core/adapters/a2ui/utils/binding.js +1 -1
  57. package/es/chat-engine/core/adapters/a2ui/utils/index.js +1 -1
  58. package/es/chat-engine/core/adapters/a2ui/utils/validation.js +1 -1
  59. package/es/chat-engine/core/adapters/agui/ActivityManager.js +1 -1
  60. package/es/chat-engine/core/adapters/agui/StateManager.js +1 -1
  61. package/es/chat-engine/core/adapters/agui/event-mapper.js +1 -1
  62. package/es/chat-engine/core/adapters/agui/index.js +11 -5
  63. package/es/chat-engine/core/adapters/agui/index.js.map +1 -1
  64. package/es/chat-engine/core/adapters/agui/types/events.d.ts +10 -10
  65. package/es/chat-engine/core/adapters/agui/types/events.js +1 -1
  66. package/es/chat-engine/core/adapters/agui/types/index.d.ts +22 -14
  67. package/es/chat-engine/core/adapters/agui/types/index.js +2 -2
  68. package/es/chat-engine/core/adapters/agui/types/index.js.map +1 -1
  69. package/es/chat-engine/core/adapters/agui/utils.js +1 -1
  70. package/es/chat-engine/core/adapters/index.js +1 -1
  71. package/es/chat-engine/core/adapters/json-render/SurfaceStateManager.js +1 -1
  72. package/es/chat-engine/core/adapters/json-render/a2ui-to-jsonrender.js +1 -1
  73. package/es/chat-engine/core/adapters/json-render/engine.js +1 -1
  74. package/es/chat-engine/core/adapters/json-render/index.js +1 -1
  75. package/es/chat-engine/core/adapters/json-render/types/a2ui.js +1 -1
  76. package/es/chat-engine/core/adapters/json-render/types/core.js +1 -1
  77. package/es/chat-engine/core/adapters/json-render/types/index.js +1 -1
  78. package/es/chat-engine/core/event-bus/ChatEventBus.js +1 -1
  79. package/es/chat-engine/core/event-bus/index.js +1 -1
  80. package/es/chat-engine/core/event-bus/types.js +1 -1
  81. package/es/chat-engine/core/index.js +2 -2
  82. package/es/chat-engine/core/processor/index.js +1 -1
  83. package/es/chat-engine/core/server/batch-client.js +1 -1
  84. package/es/chat-engine/core/server/connection-manager.js +1 -1
  85. package/es/chat-engine/core/server/errors.js +1 -1
  86. package/es/chat-engine/core/server/index.js +1 -1
  87. package/es/chat-engine/core/server/llm-service.js +1 -1
  88. package/es/chat-engine/core/server/sse-client.js +1 -1
  89. package/es/chat-engine/core/server/sse-parser.js +1 -1
  90. package/es/chat-engine/core/server/types.js +1 -1
  91. package/es/chat-engine/core/store/message.js +2 -2
  92. package/es/chat-engine/core/store/model.js +2 -2
  93. package/es/chat-engine/core/store/reactiveState.js +2 -2
  94. package/es/chat-engine/core/type.js +1 -1
  95. package/es/chat-engine/core/utils/eventEmitter.js +1 -1
  96. package/es/chat-engine/core/utils/immutable-patch.js +1 -1
  97. package/es/chat-engine/core/utils/index.js +1 -1
  98. package/es/chat-engine/core/utils/json-patch/helpers.js +1 -1
  99. package/es/chat-engine/core/utils/json-patch/index.js +1 -1
  100. package/es/chat-engine/core/utils/logger.js +1 -1
  101. package/es/chat-engine/core/utils/performance.js +1 -1
  102. package/es/chat-engine/hooks/index.js +2 -2
  103. package/es/chat-engine/hooks/useAgentActivity.js +1 -1
  104. package/es/chat-engine/hooks/useAgentActivity.js.map +1 -1
  105. package/es/chat-engine/hooks/useAgentState.js +2 -2
  106. package/es/chat-engine/hooks/useAgentToolcall.js +1 -1
  107. package/es/chat-engine/hooks/useChat.js +2 -2
  108. package/es/chat-engine/index.js +4 -4
  109. package/es/chat-filecard/index.js +1 -1
  110. package/es/chat-loading/index.js +1 -1
  111. package/es/chat-markdown/index.js +1 -1
  112. package/es/chat-message/index.js +1 -1
  113. package/es/chat-sender/index.js +1 -1
  114. package/es/chat-thinking/index.js +1 -1
  115. package/es/chatbot/index.js +1 -1
  116. package/es/index.js +4 -4
  117. package/es/style/index.js +1 -1
  118. package/package.json +6 -2
package/CHANGELOG.md CHANGED
@@ -5,6 +5,19 @@ toc: false
5
5
  spline: explain
6
6
  ---
7
7
 
8
- ## 🌈 0.1.0-alpha.1 `2025-05-26`
8
+ ## 🌈 1.0.2 `2026-02-05`
9
+
10
+ ### 🚀 Features
11
+
12
+ - `ChatEngine`:
13
+ - 支持AG-UI Activity-Snapshot/Delta事件的适配,新增useAgentActivity注册hook,并增加示例 @carolin913 ([#4119](https://github.com/Tencent/tdesign-react/pull/4119))
14
+ - 增加在无 UI 场景下使用 ChatEngine 事件总线机制,并增加示例 @carolin913 ([#4119](https://github.com/Tencent/tdesign-react/pull/4119))
15
+ - ToolCallRender 增加错误边界处理 @carolin913 ([#4119](https://github.com/Tencent/tdesign-react/pull/4119))
16
+ - AG-UI协议下几个Delta事件,支持自动初始化接收无Snapshot情况下SSE Chunk流 @carolin913 ([#4119](https://github.com/Tencent/tdesign-react/pull/4119))
17
+ - Immutable JSON Patch 性能优化,并支持append操作用来追加字符串 @carolin913 ([#4119](https://github.com/Tencent/tdesign-react/pull/4119))
18
+ - `ChatMarkdown`: 大幅优化依赖CherryMarkdown造成的打包体积膨胀问题,**不再内置highlight代码块样式高亮**,需要业务自行引入配置 @LzhengH @carolin913 ([#4119](https://github.com/Tencent/tdesign-react/pull/4119))
19
+ - `ChatSender`: 支持readyToSend可以接管发送前校验 @LzhengH ([#4119](https://github.com/Tencent/tdesign-react/pull/4119))
20
+
21
+ ## 🌈 1.0.0 `2026-11-20`
9
22
 
10
23
  - Release 1st version
package/README.md CHANGED
@@ -23,54 +23,108 @@ TDesign AIGC Components for React Framework
23
23
 
24
24
  # 📦 Installation
25
25
 
26
- ```shell
27
- npm i @tdesign-react/chat
28
- ```
26
+ ```bash
27
+ # npm
28
+ npm install @tdesign-react/chat
29
29
 
30
- ```shell
30
+ # yarn
31
31
  yarn add @tdesign-react/chat
32
- ```
33
32
 
34
- ```shell
33
+ # pnpm
35
34
  pnpm add @tdesign-react/chat
36
35
  ```
37
36
 
38
- # 🔨 Usage
37
+ **依赖要求**: React >= 18.0.0
38
+
39
+ # 🔨 Quick Start
40
+
41
+ ## 一体化组件集成
42
+
43
+ 直接使用 `ChatBot` 组件,内置完整的 UI 结构和交互逻辑,适合快速集成标准聊天界面。
39
44
 
40
45
  ```tsx
41
46
  import React from 'react';
42
47
  import { ChatBot } from '@tdesign-react/chat';
43
48
  import '@tdesign-react/chat/es/style/index.js';
44
49
 
45
- function App() {
50
+ export default function App() {
46
51
  return (
47
- <div style={{ height: '600px' }}>
48
- <ChatBot
49
- chatServiceConfig={{
50
- endpoint: 'https://your-api-endpoint.com/chat',
51
- }}
52
- />
53
- </div>
52
+ <ChatBot
53
+ chatServiceConfig={{
54
+ endpoint: 'https://your-api-endpoint.com/chat',
55
+ stream: true,
56
+ }}
57
+ />
54
58
  );
55
59
  }
60
+ ```
61
+
62
+ ## 组合式开发
63
+
64
+ 通过 `useChat` Hook 自由组合 UI 组件,适合需要深度定制 UI 结构和交互逻辑的场景。
65
+
66
+ ```tsx
67
+ import React from 'react';
68
+ import { useChat, ChatList, ChatMessage, ChatSender } from '@tdesign-react/chat';
69
+ import '@tdesign-react/chat/es/style/index.js';
56
70
 
57
- ReactDOM.createRoot(document.getElementById('app')).render(<App />);
71
+ export default function CompositeChat() {
72
+ const { chatEngine, messages, status } = useChat({
73
+ chatServiceConfig: {
74
+ endpoint: 'https://your-api-endpoint.com/chat',
75
+ stream: true,
76
+ },
77
+ });
78
+
79
+ return (
80
+ <>
81
+ <ChatList>
82
+ {messages.map((message) => (
83
+ <ChatMessage key={message.id} message={message} />
84
+ ))}
85
+ </ChatList>
86
+ <ChatSender
87
+ loading={status === 'streaming'}
88
+ onSend={(e) => chatEngine.sendUserMessage({ prompt: e.detail.value })}
89
+ onStop={() => chatEngine.abortChat()}
90
+ />
91
+ </>
92
+ );
93
+ }
58
94
  ```
59
95
 
60
- # Browser Support
96
+ ## 协议配置
61
97
 
62
- | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt="IE / Edge" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br/> IE / Edge | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br/>Firefox | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br/>Chrome | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br/>Safari |
63
- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
64
- | Edge >=84 | Firefox >=83 | Chrome >=84 | Safari >=14.1 |
98
+ 支持**自定义协议**和**AG-UI 标准协议**两种模式:
65
99
 
66
- Read our [browser compatibility](https://github.com/Tencent/tdesign/wiki/Browser-Compatibility) for more details.
100
+ | 场景 | 推荐协议 |
101
+ | ------------------ | ---------- |
102
+ | 快速集成到现有服务 | 自定义协议 |
103
+ | 构建复杂 AI 应用 | AG-UI 协议 |
104
+ | 多工具调用场景 | AG-UI 协议 |
67
105
 
106
+ ```javascript
107
+ // 通过 onMessage 解析数据
108
+ const customConfig = {
109
+ endpoint: '/api/chat',
110
+ protocol: 'agui', // 开启 AG-UI 协议,自动解析标准事件
111
+ onMessage: (chunk) => chunk.data,
112
+ };
113
+
114
+ ```
115
+
116
+ 📖 [体验示例和完整文档](https://tdesign.tencent.com/react-chat/overview)
117
+
118
+ # Browser Support
119
+
120
+ | IE / Edge | Firefox | Chrome | Safari |
121
+ | --------- | ------------ | ----------- | ------------- |
122
+ | Edge >=84 | Firefox >=83 | Chrome >=84 | Safari >=14.1 |
68
123
 
69
124
  # Contributing
70
125
 
71
126
  Contributing is welcome. Read [guidelines for contributing](https://github.com/Tencent/tdesign-react/blob/develop/CONTRIBUTING.md) before submitting your [Pull Request](https://github.com/Tencent/tdesign-react/pulls).
72
127
 
73
-
74
128
  # Feedback
75
129
 
76
130
  Create your [Github issues](https://github.com/Tencent/tdesign-react/issues) or scan the QR code below to join our user groups