@opentiny/tiny-robot 0.4.0-alpha.11 → 0.4.0-alpha.13

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.
package/README_zh.md ADDED
@@ -0,0 +1,198 @@
1
+ # TinyRobot
2
+
3
+ <p align="center">
4
+ <a href="https://opentiny.design" target="_blank" rel="noopener noreferrer">
5
+ <img alt="OpenTiny Logo" src="logo.svg" height="100" style="max-width:100%;">
6
+ </a>
7
+ </p>
8
+
9
+ [![npm version](https://img.shields.io/npm/v/@opentiny/tiny-robot.svg)](https://www.npmjs.com/package/@opentiny/tiny-robot)
10
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
11
+
12
+ **TinyRobot** 是一个基于 Vue 3 构建的 AI 组件库,遵循 OpenTiny Design 设计体系。它提供了丰富的 AI 交互组件,帮助开发者快速构建企业级 AI 应用。
13
+
14
+ ## ✨ 特性
15
+
16
+ - 🤖 **丰富的 AI 组件**:包含聊天气泡、消息输入、会话管理等完整的 AI 交互组件
17
+ - 🎨 **OpenTiny Design**:遵循 OpenTiny Design 设计体系,提供一致的 UI/UX
18
+ - 🚀 **开箱即用**:几分钟内即可开始使用,配置简单
19
+ - 🎯 **TypeScript 支持**:完整的 TypeScript 支持,提供完整的类型定义
20
+ - 🌈 **主题定制**:灵活的主题系统,支持多种主题和自定义样式
21
+ - 📦 **Tree Shaking**:针对 Tree Shaking 优化,按需导入
22
+ - 🔄 **流式支持**:内置流式 AI 响应支持
23
+ - 💾 **存储策略**:灵活的存储策略(LocalStorage、IndexedDB、自定义)
24
+
25
+ [English](README.md) | 简体中文
26
+
27
+ [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/opentiny/tiny-robot)
28
+
29
+ ## 📦 包说明
30
+
31
+ TinyRobot 是一个 monorepo,包含以下包:
32
+
33
+ | 包 | 说明 | 版本 |
34
+ | ----------------------------------------------- | -------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
35
+ | [`@opentiny/tiny-robot`](./packages/components) | 核心组件库,包含所有 AI 交互组件 | [![npm](https://img.shields.io/npm/v/@opentiny/tiny-robot.svg)](https://www.npmjs.com/package/@opentiny/tiny-robot) |
36
+ | [`@opentiny/tiny-robot-kit`](./packages/kit) | 工具函数和 AI 客户端工具,用于模型交互 | [![npm](https://img.shields.io/npm/v/@opentiny/tiny-robot-kit.svg)](https://www.npmjs.com/package/@opentiny/tiny-robot-kit) |
37
+ | [`@opentiny/tiny-robot-svgs`](./packages/svgs) | SVG 图标库,包含所有组件所需的图标 | [![npm](https://img.shields.io/npm/v/@opentiny/tiny-robot-svgs.svg)](https://www.npmjs.com/package/@opentiny/tiny-robot-svgs) |
38
+
39
+ ## 🚀 快速开始
40
+
41
+ ### 环境要求
42
+
43
+ - Node.js >= 20.13.0
44
+ - Vue >= 3.2.0
45
+ - 包管理器:npm、yarn 或 pnpm
46
+
47
+ ### 安装
48
+
49
+ **核心包** — `@opentiny/tiny-robot` 是主包。
50
+
51
+ ```bash
52
+ # 使用 pnpm(推荐)
53
+ pnpm add @opentiny/tiny-robot
54
+
55
+ # 使用 npm
56
+ npm install @opentiny/tiny-robot
57
+
58
+ # 使用 yarn
59
+ yarn add @opentiny/tiny-robot
60
+ ```
61
+
62
+ **可选包**:
63
+
64
+ - `@opentiny/tiny-robot-kit` — 仅在需要 AI 模型请求或数据处理功能时使用。需要时添加:
65
+
66
+ ```bash
67
+ pnpm add @opentiny/tiny-robot-kit
68
+ ```
69
+
70
+ - `@opentiny/tiny-robot-svgs` — 可选。仅在需要单独使用 SVG 图标库或自定义图标时单独安装:
71
+
72
+ ```bash
73
+ pnpm add @opentiny/tiny-robot-svgs
74
+ ```
75
+
76
+ ### 基本用法
77
+
78
+ #### 1. 引入样式
79
+
80
+ 在 `main.js` 或 `main.ts` 中:
81
+
82
+ ```ts
83
+ import { createApp } from 'vue'
84
+ import App from './App.vue'
85
+ import '@opentiny/tiny-robot/dist/style.css'
86
+
87
+ const app = createApp(App)
88
+ app.mount('#app')
89
+ ```
90
+
91
+ #### 2. 使用组件
92
+
93
+ ```vue
94
+ <template>
95
+ <div class="chat-container">
96
+ <tr-bubble role="ai" content="Hello! I'm TinyRobot, an AI component library for Vue 3." placement="start" />
97
+ <tr-bubble role="user" content="That's great! How can I get started?" placement="end" />
98
+ </div>
99
+ </template>
100
+
101
+ <script setup>
102
+ import { TrBubble } from '@opentiny/tiny-robot'
103
+ </script>
104
+ ```
105
+
106
+ ## 📚 文档
107
+
108
+ - 📖 [完整文档](https://docs.opentiny.design/tiny-robot/) - 完整的 API 参考和指南
109
+ - 🎯 [快速开始指南](https://docs.opentiny.design/tiny-robot/guide/quick-start) - 几分钟内快速上手
110
+ - 🎨 [主题配置](https://docs.opentiny.design/tiny-robot/guide/theme-config) - 自定义主题
111
+ - 📝 [更新日志](https://docs.opentiny.design/tiny-robot/guide/update-log) - 版本历史
112
+ - 💡 [示例](https://docs.opentiny.design/tiny-robot/examples/assistant) - 完整的应用示例
113
+
114
+ ## 🏗️ 项目结构
115
+
116
+ ```text
117
+ tiny-robot/
118
+ ├── packages/
119
+ │ ├── components/ # 核心组件库
120
+ │ │ ├── src/
121
+ │ │ │ ├── bubble/ # 聊天气泡组件
122
+ │ │ │ ├── sender/ # 消息输入组件
123
+ │ │ │ ├── container/ # 容器组件
124
+ │ │ │ ├── history/ # 会话历史
125
+ │ │ │ ├── attachments/ # 文件附件
126
+ │ │ │ └── ... # 其他组件
127
+ │ │ └── package.json
128
+ │ ├── kit/ # 工具函数和 AI 工具
129
+ │ │ ├── src/
130
+ │ │ │ ├── providers/ # AI 提供商实现
131
+ │ │ │ ├── vue/ # Vue 组合式函数
132
+ │ │ │ │ ├── message/ # useMessage 组合式函数
133
+ │ │ │ │ └── conversation/ # useConversation 组合式函数
134
+ │ │ │ └── storage/ # 存储工具
135
+ │ │ └── package.json
136
+ │ ├── svgs/ # SVG 图标库
137
+ │ ├── playground/ # 开发演练场
138
+ │ └── test/ # 测试套件
139
+ ├── docs/ # 文档站点
140
+ │ ├── src/ # 文档源码
141
+ │ └── demos/ # 组件示例
142
+ ├── scripts/ # 构建和工具脚本
143
+ └── package.json
144
+ ```
145
+
146
+ ## 🛠️ 开发
147
+
148
+ ### 环境设置
149
+
150
+ ```bash
151
+ # 安装依赖
152
+ pnpm install
153
+
154
+ # 启动开发服务器(演练场 + 文档)
155
+ pnpm dev
156
+ ```
157
+
158
+ ### 开发流程
159
+
160
+ 1. **启动开发服务器**:
161
+ - 在项目根目录运行 `pnpm dev`
162
+ - 这将同时启动演练场和文档站点
163
+ - 修改 `packages/components/src/` 中的组件后,更改会自动反映在文档页面中
164
+
165
+ 2. **文档**:
166
+ - 文档源码:`docs/src/`
167
+ - 组件示例:`docs/demos/`
168
+
169
+ 3. **测试**:
170
+ - 运行 `pnpm test` 执行测试
171
+
172
+ ## 📄 许可证
173
+
174
+ MIT 许可证 - 查看 [LICENSE](./LICENSE) 文件了解详情。
175
+
176
+ ## 🤝 贡献
177
+
178
+ 欢迎贡献!请随时提交 Pull Request。
179
+
180
+ 1. Fork 本仓库
181
+ 2. 创建你的功能分支(`git checkout -b feature/AmazingFeature`)
182
+ 3. 提交你的更改(`git commit -m 'Add some AmazingFeature'`)
183
+ 4. 推送到分支(`git push origin feature/AmazingFeature`)
184
+ 5. 发起 Pull Request
185
+
186
+ ## 📞 支持
187
+
188
+ - 📖 [文档](https://docs.opentiny.design/tiny-robot/)
189
+ - 🐛 [问题追踪](https://github.com/opentiny/tiny-robot/issues)
190
+ - 💬 [讨论](https://github.com/opentiny/tiny-robot/discussions)
191
+
192
+ ## 🙏 致谢
193
+
194
+ 由 OpenTiny 团队用 ❤️ 构建。
195
+
196
+ ---
197
+
198
+ **注意**:本项目是 [OpenTiny](https://github.com/opentiny) 生态系统的一部分。
package/dist/index.d.ts CHANGED
@@ -4708,15 +4708,23 @@ export { }
4708
4708
  */
4709
4709
  declare module '@tiptap/core' {
4710
4710
  interface Commands<ReturnType> {
4711
- mention: {
4711
+ template: {
4712
4712
  /**
4713
- * 插入 mention 节点
4713
+ * 设置模板数据(批量)
4714
4714
  */
4715
- insertMention: (attrs: Partial<MentionAttrs>) => ReturnType;
4715
+ setTemplateData: (items: TemplateItem[]) => ReturnType;
4716
4716
  /**
4717
- * 删除 mention 节点
4717
+ * 插入模板块
4718
4718
  */
4719
- deleteMention: (id: string) => ReturnType;
4719
+ insertTemplate: (attrs: Partial<TemplateAttrs>) => ReturnType;
4720
+ /**
4721
+ * 聚焦到第一个模板块
4722
+ */
4723
+ focusFirstTemplate: () => ReturnType;
4724
+ /**
4725
+ * 插入选择器
4726
+ */
4727
+ insertTemplateSelect: (attrs: Partial<TemplateSelectAttrs>) => ReturnType;
4720
4728
  };
4721
4729
  }
4722
4730
  }
@@ -4729,23 +4737,15 @@ declare module '@tiptap/core' {
4729
4737
  */
4730
4738
  declare module '@tiptap/core' {
4731
4739
  interface Commands<ReturnType> {
4732
- template: {
4733
- /**
4734
- * 设置模板数据(批量)
4735
- */
4736
- setTemplateData: (items: TemplateItem[]) => ReturnType;
4737
- /**
4738
- * 插入模板块
4739
- */
4740
- insertTemplate: (attrs: Partial<TemplateAttrs>) => ReturnType;
4740
+ mention: {
4741
4741
  /**
4742
- * 聚焦到第一个模板块
4742
+ * 插入 mention 节点
4743
4743
  */
4744
- focusFirstTemplate: () => ReturnType;
4744
+ insertMention: (attrs: Partial<MentionAttrs>) => ReturnType;
4745
4745
  /**
4746
- * 插入选择器
4746
+ * 删除 mention 节点
4747
4747
  */
4748
- insertTemplateSelect: (attrs: Partial<TemplateSelectAttrs>) => ReturnType;
4748
+ deleteMention: (id: string) => ReturnType;
4749
4749
  };
4750
4750
  }
4751
4751
  }
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@opentiny/tiny-robot",
3
- "version": "0.4.0-alpha.11",
3
+ "version": "0.4.0-alpha.13",
4
4
  "license": "MIT",
5
5
  "description": "TinyRobot 是一个 AI 对话组件库,提供了丰富的 AI 交互组件,助力开发者快速构建企业级 AI 应用;同时也是一个智能助手,支持普通 AI 问答、也支持集成 MCP Server,让 AI 真正帮人“干活”。",
6
+ "homepage": "https://docs.opentiny.design/tiny-robot/",
6
7
  "repository": {
7
8
  "type": "git",
8
- "url": "git+https://github.com/opentiny/tiny-robot.git",
9
- "homepage": "https://docs.opentiny.design/tiny-robot/"
9
+ "url": "git+https://github.com/opentiny/tiny-robot.git"
10
10
  },
11
11
  "bugs": {
12
12
  "url": "https://github.com/opentiny/tiny-robot/issues"
@@ -37,7 +37,8 @@
37
37
  "module": "./dist/index.js",
38
38
  "sideEffects": false,
39
39
  "files": [
40
- "dist"
40
+ "dist",
41
+ "README*"
41
42
  ],
42
43
  "scripts": {
43
44
  "dev": "vue-tsc && vite build --watch",
@@ -51,7 +52,7 @@
51
52
  },
52
53
  "dependencies": {
53
54
  "@floating-ui/dom": "^1.6.0",
54
- "@opentiny/tiny-robot-svgs": "0.4.0-alpha.11",
55
+ "@opentiny/tiny-robot-svgs": "0.4.0-alpha.13",
55
56
  "@opentiny/vue": "^3.20.0",
56
57
  "@tiptap/core": "^3.11.0",
57
58
  "@tiptap/extension-character-count": "^3.11.0",
@@ -81,5 +82,5 @@
81
82
  "vue": "^3.3.11",
82
83
  "vue-tsc": "^2.2.8"
83
84
  },
84
- "gitHead": "b2a08019209d5d6966c3527fb1576ad903f984fa"
85
+ "gitHead": "5449411f35112a988894c54391de629842ee69aa"
85
86
  }