{
+ onSubmit(inputValue);
+ setInputValue('');
+ }}
+ onChange={setInputValue}
+ onCancel={() => {
+ abortControllerRef.current?.abort();
+ }}
+ loading={loading}
+ className={styles.sender}
+ actions={(_, info) => {
+ const { SendButton, LoadingButton } = info.components;
+ return (
+
+ {loading ? : }
+
+ );
+ }}
+ placeholder={t.askMeAnything}
+ />
+ >
+ );
+
+ useEffect(() => {
+ // history mock
+ if (messages?.length) {
+ setMessageHistory((prev) => ({
+ ...prev,
+ [curConversation]: messages,
+ }));
+ }
+ }, [messages]);
+
+ // ==================== Render =================
+ return (
+
+ {chatSider}
+
+
+ {chatList}
+ {chatSender}
+
+
+ );
+};
+
+export default Independent;
diff --git a/docs/playground/agent-tbox.zh-CN.md b/docs/playground/agent-tbox.zh-CN.md
new file mode 100644
index 000000000..28dc16561
--- /dev/null
+++ b/docs/playground/agent-tbox.zh-CN.md
@@ -0,0 +1,10 @@
+---
+group:
+ title: 智能体样板间
+ order: 1
+title: 百宝箱
+description: 百宝箱 X 智能体
+order: 0
+---
+
+
diff --git a/docs/playground/copilot.en-US.md b/docs/playground/copilot.en-US.md
index eb601e744..485dd9f51 100644
--- a/docs/playground/copilot.en-US.md
+++ b/docs/playground/copilot.en-US.md
@@ -1,7 +1,7 @@
---
group:
- title: Sample
- order: 1
+ title: Model Sample
+ order: 0
title: Copilot
description: A sample room in copilot mode
order: 1
diff --git a/docs/playground/copilot.zh-CN.md b/docs/playground/copilot.zh-CN.md
index f775996f9..851c4ebec 100644
--- a/docs/playground/copilot.zh-CN.md
+++ b/docs/playground/copilot.zh-CN.md
@@ -1,6 +1,6 @@
---
group:
- title: 样板间
+ title: 模型样板间
order: 0
title: 助手式
order: 1
diff --git a/docs/playground/independent.en-US.md b/docs/playground/independent.en-US.md
index 881e22617..7da9f58ec 100644
--- a/docs/playground/independent.en-US.md
+++ b/docs/playground/independent.en-US.md
@@ -1,6 +1,6 @@
---
group:
- title: Sample
+ title: Model Sample
order: 0
title: Independent
description: Natural language is dominant.
diff --git a/docs/playground/independent.zh-CN.md b/docs/playground/independent.zh-CN.md
index 64b7d8375..2ece85b85 100644
--- a/docs/playground/independent.zh-CN.md
+++ b/docs/playground/independent.zh-CN.md
@@ -1,6 +1,6 @@
---
group:
- title: 样板间
+ title: 模型样板间
order: 0
title: 独立式
order: 0
diff --git a/docs/react/agent-use-tbox.en-US.md b/docs/react/agent-use-tbox.en-US.md
new file mode 100644
index 000000000..2e9df3871
--- /dev/null
+++ b/docs/react/agent-use-tbox.en-US.md
@@ -0,0 +1,62 @@
+---
+group:
+ order: 2
+ title: Agent Integration
+title: Tbox
+order: 1
+tag: Updated
+---
+
+This guide will introduce how to integrate the agent service provided by Tbox into an application built with Ant Design X.
+
+## Documentation
+
+- Tbox Open platform - [https://alipaytbox.yuque.com/sxs0ba/doc/tbox_open_overview](https://alipaytbox.yuque.com/sxs0ba/doc/tbox_open_overview)
+- Tbox Open Token - [https://alipaytbox.yuque.com/sxs0ba/doc/tbox_open_token](https://alipaytbox.yuque.com/sxs0ba/doc/tbox_open_token)
+- OpenAPI - [https://alipaytbox.yuque.com/sxs0ba/doc/tbox_openapi_overview](https://alipaytbox.yuque.com/sxs0ba/doc/tbox_openapi_overview)
+
+## Use Open API
+
+```tsx
+import { TboxClient } from 'tbox-nodejs-sdk';
+import { useXAgent, useXChat, Sender, Bubble } from '@ant-design/x';
+
+const tboxClient = new TboxClient({
+ httpClientConfig: {
+ authorization: 'TBox-Token-xxx', // 替换真实 token
+ },
+});
+
+const ChatDemo = () => {
+ const [agent] = useXAgent({
+ request: async ({ message }, { onUpdate, onSuccess }) => {
+ const stream = tboxClient.chat({
+ appId: '2025*****xxx', // 替换真实 AppID
+ query: message,
+ userId: '用户唯一标识',
+ });
+
+ let content = '';
+ stream.on('data', (data) => {
+ content += JSON.stringify(data);
+ onUpdate(content);
+ });
+ stream.on('end', () => onSuccess(content));
+ },
+ });
+
+ const { onRequest, messages } = useXChat({ agent });
+
+ return (
+
+ ({
+ key: msg.id,
+ content: msg.message,
+ }))}
+ />
+
+
+ );
+};
+```
diff --git a/docs/react/agent-use-tbox.zh-CN.md b/docs/react/agent-use-tbox.zh-CN.md
new file mode 100644
index 000000000..866864b1a
--- /dev/null
+++ b/docs/react/agent-use-tbox.zh-CN.md
@@ -0,0 +1,62 @@
+---
+group:
+ order: 2
+ title: 智能体接入
+title: 百宝箱
+order: 1
+tag: Updated
+---
+
+这篇指南将介绍如何在使用 Ant Design X 搭建的应用中接入百宝箱智能体服务。
+
+## 相关文档
+
+- 百宝箱开放平台概述 - [https://alipaytbox.yuque.com/sxs0ba/doc/tbox_open_overview](https://alipaytbox.yuque.com/sxs0ba/doc/tbox_open_overview)
+- 授权管理 - [https://alipaytbox.yuque.com/sxs0ba/doc/tbox_open_token](https://alipaytbox.yuque.com/sxs0ba/doc/tbox_open_token)
+- OpenAPI - [https://alipaytbox.yuque.com/sxs0ba/doc/tbox_openapi_overview](https://alipaytbox.yuque.com/sxs0ba/doc/tbox_openapi_overview)
+
+## 使用 Open API
+
+```tsx
+import { TboxClient } from 'tbox-nodejs-sdk';
+import { useXAgent, useXChat, Sender, Bubble } from '@ant-design/x';
+
+const tboxClient = new TboxClient({
+ httpClientConfig: {
+ authorization: 'TBox-Token-xxx', // 替换真实 token
+ },
+});
+
+const ChatDemo = () => {
+ const [agent] = useXAgent({
+ request: async ({ message }, { onUpdate, onSuccess }) => {
+ const stream = tboxClient.chat({
+ appId: '2025*****xxx', // 替换真实 AppID
+ query: message,
+ userId: '用户唯一标识',
+ });
+
+ let content = '';
+ stream.on('data', (data) => {
+ content += JSON.stringify(data);
+ onUpdate(content);
+ });
+ stream.on('end', () => onSuccess(content));
+ },
+ });
+
+ const { onRequest, messages } = useXChat({ agent });
+
+ return (
+
+ ({
+ key: msg.id,
+ content: msg.message,
+ }))}
+ />
+
+
+ );
+};
+```
diff --git a/docs/react/contributing.en-US.md b/docs/react/contributing.en-US.md
index b166b57da..b6071db2c 100644
--- a/docs/react/contributing.en-US.md
+++ b/docs/react/contributing.en-US.md
@@ -1,6 +1,7 @@
---
group:
title: Other
+ order: 4
order: 1
title: Contributing
---
diff --git a/docs/react/contributing.zh-CN.md b/docs/react/contributing.zh-CN.md
index d67104228..f98da3b26 100644
--- a/docs/react/contributing.zh-CN.md
+++ b/docs/react/contributing.zh-CN.md
@@ -1,6 +1,7 @@
---
group:
title: 其他
+ order: 4
order: 1
title: 贡献指南
---
diff --git a/docs/react/dangerously-api-key.en-US.md b/docs/react/dangerously-api-key.en-US.md
index 75bd0ee1f..34584fef2 100644
--- a/docs/react/dangerously-api-key.en-US.md
+++ b/docs/react/dangerously-api-key.en-US.md
@@ -1,6 +1,7 @@
---
group:
title: Other
+ order: 4
order: 2
title: dangerouslyApiKey Explanation
---
diff --git a/docs/react/dangerously-api-key.zh-CN.md b/docs/react/dangerously-api-key.zh-CN.md
index 914aa39a8..2ee46dc34 100644
--- a/docs/react/dangerously-api-key.zh-CN.md
+++ b/docs/react/dangerously-api-key.zh-CN.md
@@ -1,12 +1,13 @@
---
group:
title: 其他
+ order: 4
order: 2
title: dangerouslyApiKey 说明
tag: New
---
-:::warning
+:::warning
请认真阅读,这很重要 !!! 我们在 `useXAgent` 、 `XRequest` 里提供了 `dangerouslyApiKey` 这里对其做一个详细的说明。
:::
diff --git a/docs/react/faq.en-US.md b/docs/react/faq.en-US.md
index 78b7fee56..4eea745ea 100644
--- a/docs/react/faq.en-US.md
+++ b/docs/react/faq.en-US.md
@@ -1,6 +1,7 @@
---
group:
title: Other
+ order: 4
order: 2
title: FAQ
---
diff --git a/docs/react/faq.zh-CN.md b/docs/react/faq.zh-CN.md
index 2869d71b7..873f76810 100644
--- a/docs/react/faq.zh-CN.md
+++ b/docs/react/faq.zh-CN.md
@@ -1,6 +1,7 @@
---
group:
title: 其他
+ order: 4
order: 2
title: FAQ
---
diff --git a/docs/react/model-use-openai.en-US.md b/docs/react/model-use-openai.en-US.md
index ad29bc8b5..833f8ea23 100644
--- a/docs/react/model-use-openai.en-US.md
+++ b/docs/react/model-use-openai.en-US.md
@@ -1,9 +1,9 @@
---
group:
title: Model Integration
+ order: 1
title: OpenAI
order: 0
-tag: Updated
---
This guide will explain how to integrate OpenAI's model service into an application built using Ant Design X.
diff --git a/docs/react/model-use-openai.zh-CN.md b/docs/react/model-use-openai.zh-CN.md
index d1e73c718..a9bd8ee90 100644
--- a/docs/react/model-use-openai.zh-CN.md
+++ b/docs/react/model-use-openai.zh-CN.md
@@ -1,9 +1,9 @@
---
group:
title: 模型接入
+ order: 1
title: OpenAI
order: 0
-tag: Updated
---
这篇指南将介绍如何在使用 Ant Design X 搭建的应用中接入 OpenAI 提供的模型服务。
diff --git a/docs/react/model-use-other.en-US.md b/docs/react/model-use-other.en-US.md
index 1e8f202c8..5c07f51ea 100644
--- a/docs/react/model-use-other.en-US.md
+++ b/docs/react/model-use-other.en-US.md
@@ -1,6 +1,7 @@
---
group:
title: Model Integration
+ order: 1
title: Others
order: 2
---
@@ -17,9 +18,8 @@ To address this, **X** provides tools to help developers resolve protocol compat
import { XStream } from '@ant-design/x';
async function request() {
- const response =
- await fetch();
- // ...
+ const response = await fetch();
+ // ...
// .....
for await (const chunk of XStream({
diff --git a/docs/react/model-use-other.zh-CN.md b/docs/react/model-use-other.zh-CN.md
index e6d8f8d4a..6c873ec43 100644
--- a/docs/react/model-use-other.zh-CN.md
+++ b/docs/react/model-use-other.zh-CN.md
@@ -1,6 +1,7 @@
---
group:
title: 模型接入
+ order: 1
title: 其他
order: 2
---
@@ -17,9 +18,8 @@ order: 2
import { XStream } from '@ant-design/x';
async function request() {
- const response =
- await fetch();
- // ...
+ const response = await fetch();
+ // ...
// .....
for await (const chunk of XStream({
diff --git a/docs/react/model-use-qwen.en-US.md b/docs/react/model-use-qwen.en-US.md
index 573e80f5e..2204ec51e 100644
--- a/docs/react/model-use-qwen.en-US.md
+++ b/docs/react/model-use-qwen.en-US.md
@@ -1,9 +1,9 @@
---
group:
title: Model Integration
+ order: 1
title: Qwen
order: 1
-tag: Updated
---
This guide will introduce how to integrate the model service provided by Qwen into an application built with Ant Design X.
diff --git a/docs/react/model-use-qwen.zh-CN.md b/docs/react/model-use-qwen.zh-CN.md
index d61be9d33..3de130bdd 100644
--- a/docs/react/model-use-qwen.zh-CN.md
+++ b/docs/react/model-use-qwen.zh-CN.md
@@ -1,9 +1,9 @@
---
group:
title: 模型接入
+ order: 1
title: 通义千问
order: 1
-tag: Updated
---
这篇指南将介绍如何在使用 Ant Design X 搭建的应用中接入 Qwen 提供的模型服务。
diff --git a/docs/react/use-with-create-react-app.en-US.md b/docs/react/use-with-create-react-app.en-US.md
index a84a659f0..0e0e7914c 100644
--- a/docs/react/use-with-create-react-app.en-US.md
+++ b/docs/react/use-with-create-react-app.en-US.md
@@ -1,6 +1,7 @@
---
group:
title: Basic Usage
+ order: 3
order: 1
title: Usage with create-react-app
---
diff --git a/docs/react/use-with-create-react-app.zh-CN.md b/docs/react/use-with-create-react-app.zh-CN.md
index f5d175ca8..4e4a3214e 100644
--- a/docs/react/use-with-create-react-app.zh-CN.md
+++ b/docs/react/use-with-create-react-app.zh-CN.md
@@ -1,6 +1,7 @@
---
group:
title: 如何使用
+ order: 3
order: 1
title: 在 create-react-app 中使用
---
diff --git a/docs/react/use-with-next.en-US.md b/docs/react/use-with-next.en-US.md
index c49a6941d..3d0853380 100644
--- a/docs/react/use-with-next.en-US.md
+++ b/docs/react/use-with-next.en-US.md
@@ -1,6 +1,7 @@
---
group:
title: Basic Usage
+ order: 3
order: 3
title: Usage with Next.js
---
diff --git a/docs/react/use-with-next.zh-CN.md b/docs/react/use-with-next.zh-CN.md
index 0787a8ef6..d1b91d461 100644
--- a/docs/react/use-with-next.zh-CN.md
+++ b/docs/react/use-with-next.zh-CN.md
@@ -1,6 +1,7 @@
---
group:
title: 如何使用
+ order: 3
order: 3
title: 在 Next.js 中使用
---
diff --git a/docs/react/use-with-rsbuild.en-US.md b/docs/react/use-with-rsbuild.en-US.md
index 496d56a1c..8365df3c6 100644
--- a/docs/react/use-with-rsbuild.en-US.md
+++ b/docs/react/use-with-rsbuild.en-US.md
@@ -1,6 +1,7 @@
---
group:
title: Basic Usage
+ order: 3
order: 5
title: Usage with Rsbuild
---
diff --git a/docs/react/use-with-rsbuild.zh-CN.md b/docs/react/use-with-rsbuild.zh-CN.md
index 895f2f859..e7cf5f998 100644
--- a/docs/react/use-with-rsbuild.zh-CN.md
+++ b/docs/react/use-with-rsbuild.zh-CN.md
@@ -1,6 +1,7 @@
---
group:
title: 如何使用
+ order: 3
order: 5
title: 在 Rsbuild 中使用
---
diff --git a/docs/react/use-with-umi.en-US.md b/docs/react/use-with-umi.en-US.md
index d1db7ffe5..01b501f8e 100644
--- a/docs/react/use-with-umi.en-US.md
+++ b/docs/react/use-with-umi.en-US.md
@@ -1,6 +1,7 @@
---
group:
title: Basic Usage
+ order: 3
order: 4
title: Usage with Umi
---
diff --git a/docs/react/use-with-umi.zh-CN.md b/docs/react/use-with-umi.zh-CN.md
index 7b838cde2..cebf006d0 100644
--- a/docs/react/use-with-umi.zh-CN.md
+++ b/docs/react/use-with-umi.zh-CN.md
@@ -1,6 +1,7 @@
---
group:
title: 如何使用
+ order: 3
order: 4
title: 在 Umi 中使用
---
diff --git a/docs/react/use-with-vite.en-US.md b/docs/react/use-with-vite.en-US.md
index 0eea85450..bae35e533 100644
--- a/docs/react/use-with-vite.en-US.md
+++ b/docs/react/use-with-vite.en-US.md
@@ -1,6 +1,7 @@
---
group:
title: Basic Usage
+ order: 3
order: 2
title: Usage with Vite
---
diff --git a/docs/react/use-with-vite.zh-CN.md b/docs/react/use-with-vite.zh-CN.md
index edeac4af8..f24cc2d4b 100644
--- a/docs/react/use-with-vite.zh-CN.md
+++ b/docs/react/use-with-vite.zh-CN.md
@@ -1,6 +1,7 @@
---
group:
title: 如何使用
+ order: 3
order: 2
title: 在 Vite 中使用
---
diff --git a/package.json b/package.json
index 5ef8ec908..37ae820f4 100644
--- a/package.json
+++ b/package.json
@@ -88,7 +88,8 @@
"@babel/runtime": "^7.25.6",
"classnames": "^2.5.1",
"rc-motion": "^2.9.2",
- "rc-util": "^5.43.0"
+ "rc-util": "^5.43.0",
+ "tbox-nodejs-sdk": "^0.0.13"
},
"devDependencies": {
"@ant-design/tools": "^19.0.2",