@opentiny/vue-docs 3.28.0 → 3.30.0

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 (287) hide show
  1. package/demos/apis/action-menu.js +22 -0
  2. package/demos/apis/alert.js +19 -22
  3. package/demos/apis/button-group.js +15 -0
  4. package/demos/apis/calendar-view.js +5 -5
  5. package/demos/apis/cascader-view.js +5 -5
  6. package/demos/apis/dialog-box.js +39 -38
  7. package/demos/apis/drawer.js +31 -0
  8. package/demos/apis/dropdown.js +39 -1
  9. package/demos/apis/filter-panel.js +21 -1
  10. package/demos/apis/fluent-editor.js +30 -0
  11. package/demos/apis/form.js +11 -0
  12. package/demos/apis/fullscreen.js +10 -11
  13. package/demos/apis/grid.js +131 -16
  14. package/demos/apis/guide.js +14 -0
  15. package/demos/apis/link.js +11 -0
  16. package/demos/apis/message.js +48 -22
  17. package/demos/apis/modal.js +34 -31
  18. package/demos/apis/notify.js +13 -13
  19. package/demos/apis/rate.js +15 -0
  20. package/demos/apis/search-box.js +343 -0
  21. package/demos/apis/select.js +14 -2
  22. package/demos/apis/tag-input.js +182 -0
  23. package/demos/apis/tree.js +23 -23
  24. package/demos/mobile-first/app/button-group/display-mode.vue +31 -0
  25. package/demos/mobile-first/app/button-group/webdoc/button-group.js +13 -0
  26. package/demos/mobile-first/app/calendar-view/webdoc/calendar-view.js +5 -4
  27. package/demos/mobile-first/app/modal/webdoc/modal.js +2 -1
  28. package/demos/pc/app/alert/center.spec.ts +8 -0
  29. package/demos/pc/app/alert/custom-close.spec.ts +39 -9
  30. package/demos/pc/app/alert/icon.spec.ts +18 -7
  31. package/demos/pc/app/alert/show-icon.spec.ts +1 -1
  32. package/demos/pc/app/anchor/webdoc/anchor.js +1 -0
  33. package/demos/pc/app/base-select/copy-multi.spec.ts +1 -1
  34. package/demos/pc/app/button-group/display-mode-composition-api.vue +23 -0
  35. package/demos/pc/app/button-group/display-mode.spec.ts +0 -0
  36. package/demos/pc/app/button-group/display-mode.vue +31 -0
  37. package/demos/pc/app/button-group/sup-composition-api.vue +1 -0
  38. package/demos/pc/app/button-group/sup.vue +1 -0
  39. package/demos/pc/app/button-group/webdoc/button-group.js +14 -0
  40. package/demos/pc/app/calendar-view/calendar-event.spec.ts +1 -1
  41. package/demos/pc/app/calendar-view/custom-day-bg-color.vue +10 -0
  42. package/demos/pc/app/calendar-view/webdoc/calendar-view.js +4 -4
  43. package/demos/pc/app/cascader/filter-mode-composition-api.vue +2 -2
  44. package/demos/pc/app/checkbox/checked-composition-api.vue +3 -3
  45. package/demos/pc/app/checkbox/checked.vue +3 -3
  46. package/demos/pc/app/date-picker/align.spec.ts +10 -13
  47. package/demos/pc/app/date-picker/clear.spec.ts +3 -3
  48. package/demos/pc/app/date-picker/default-value.spec.ts +4 -4
  49. package/demos/pc/app/date-picker/events.spec.ts +2 -2
  50. package/demos/pc/app/date-picker/format.spec.ts +3 -3
  51. package/demos/pc/app/date-picker/now.spec.ts +4 -4
  52. package/demos/pc/app/date-picker/shortcuts.spec.ts +1 -1
  53. package/demos/pc/app/date-picker/slot.spec.ts +5 -5
  54. package/demos/pc/app/dialog-box/basic-usage.spec.ts +5 -5
  55. package/demos/pc/app/dialog-box/form-in-dialog.spec.ts +1 -2
  56. package/demos/pc/app/drawer/basic-usage.spec.ts +4 -3
  57. package/demos/pc/app/drawer/close-on-press-escape.spec.ts +4 -2
  58. package/demos/pc/app/drawer/placement.spec.ts +4 -4
  59. package/demos/pc/app/drawer/show-header.spec.ts +3 -2
  60. package/demos/pc/app/drawer/webdoc/drawer.js +3 -2
  61. package/demos/pc/app/dropdown/show-icon-composition-api.vue +1 -1
  62. package/demos/pc/app/dropdown/show-icon.vue +1 -1
  63. package/demos/pc/app/dropdown/tip-composition-api.vue +5 -2
  64. package/demos/pc/app/dropdown/tip.vue +5 -2
  65. package/demos/pc/app/dropdown/webdoc/dropdown.js +2 -2
  66. package/demos/pc/app/filter-panel/size-composition-api.vue +58 -0
  67. package/demos/pc/app/filter-panel/size.spec.ts +23 -0
  68. package/demos/pc/app/filter-panel/size.vue +68 -0
  69. package/demos/pc/app/filter-panel/webdoc/filter-panel.js +13 -0
  70. package/demos/pc/app/flowchart/basic-usage-composition-api.vue +10 -260
  71. package/demos/pc/app/flowchart/basic-usage.spec.ts +2 -1
  72. package/demos/pc/app/flowchart/basic-usage.vue +4 -249
  73. package/demos/pc/app/flowchart/slots-composition-api.vue +182 -0
  74. package/demos/pc/app/flowchart/slots.spec.ts +24 -0
  75. package/demos/pc/app/flowchart/slots.vue +193 -0
  76. package/demos/pc/app/flowchart/webdoc/flowchart.js +14 -2
  77. package/demos/pc/app/form/basic-usage.spec.ts +6 -4
  78. package/demos/pc/app/form/custom-validation-string-length-composition-api.vue +38 -0
  79. package/demos/pc/app/form/custom-validation-string-length.spec.ts +18 -0
  80. package/demos/pc/app/form/custom-validation-string-length.vue +28 -13
  81. package/demos/pc/app/form/group-form-composition-api.vue +2 -2
  82. package/demos/pc/app/form/group-form.vue +2 -2
  83. package/demos/pc/app/grid/filter/advanced-filter-composition-api.vue +1 -1
  84. package/demos/pc/app/grid/filter/advanced-filter.spec.js +1 -0
  85. package/demos/pc/app/grid/filter/advanced-filter.vue +1 -1
  86. package/demos/pc/app/grid/filter/custom-filter-composition-api.vue +46 -23
  87. package/demos/pc/app/grid/filter/custom-filter.spec.js +1 -1
  88. package/demos/pc/app/grid/filter/custom-filter.vue +47 -24
  89. package/demos/pc/app/grid/filter/default-filter-composition-api.vue +5 -1
  90. package/demos/pc/app/grid/filter/default-filter.spec.ts +1 -0
  91. package/demos/pc/app/grid/filter/default-filter.vue +4 -1
  92. package/demos/pc/app/grid/filter/filter-label-value-composition-api.vue +71 -0
  93. package/demos/pc/app/grid/filter/filter-label-value.spec.ts +27 -0
  94. package/demos/pc/app/grid/filter/filter-label-value.vue +78 -0
  95. package/demos/pc/app/grid/filter/input-filter-custom-component-composition-api.vue +116 -0
  96. package/demos/pc/app/grid/filter/input-filter-custom-component.spec.ts +20 -0
  97. package/demos/pc/app/grid/filter/input-filter-custom-component.vue +126 -0
  98. package/demos/pc/app/grid/filter/layout-order-filter-composition-api.vue +114 -0
  99. package/demos/pc/app/grid/filter/layout-order-filter.spec.ts +31 -0
  100. package/demos/pc/app/grid/filter/layout-order-filter.vue +123 -0
  101. package/demos/pc/app/grid/toolbar/custom-toolbar.spec.js +1 -1
  102. package/demos/pc/app/grid/webdoc/grid-filter.js +89 -40
  103. package/demos/pc/app/guide/show-close-composition-api.vue +77 -0
  104. package/demos/pc/app/guide/show-close.spec.ts +37 -0
  105. package/demos/pc/app/guide/show-close.vue +84 -0
  106. package/demos/pc/app/guide/webdoc/guide.js +12 -0
  107. package/demos/pc/app/icon/advance-icons.js +108 -2
  108. package/demos/pc/app/icon/advance-usage-composition-api.vue +26 -1
  109. package/demos/pc/app/icon/advance-usage.vue +27 -1
  110. package/demos/pc/app/icon/webdoc/icon.js +5 -3
  111. package/demos/pc/app/input/resize.spec.ts +2 -2
  112. package/demos/pc/app/link/custom-icon-composition-api.vue +1 -1
  113. package/demos/pc/app/link/custom-icon.vue +1 -1
  114. package/demos/pc/app/link/target-composition-api.vue +24 -0
  115. package/demos/pc/app/link/target.spec.ts +41 -0
  116. package/demos/pc/app/link/target.vue +30 -0
  117. package/demos/pc/app/link/webdoc/link.js +14 -0
  118. package/demos/pc/app/message/basic-usage-composition-api.vue +48 -0
  119. package/demos/pc/app/message/basic-usage.spec.ts +27 -0
  120. package/demos/pc/app/message/basic-usage.vue +50 -0
  121. package/demos/pc/app/message/message-close-composition-api.vue +25 -0
  122. package/demos/pc/app/message/message-close.spec.ts +9 -0
  123. package/demos/pc/app/message/message-close.vue +32 -0
  124. package/demos/pc/app/message/message-duration-composition-api.vue +25 -0
  125. package/demos/pc/app/message/message-duration.spec.ts +9 -0
  126. package/demos/pc/app/message/message-duration.vue +32 -0
  127. package/demos/pc/app/message/prevent-duplicate-composition-api.vue +25 -0
  128. package/demos/pc/app/message/prevent-duplicate.spec.ts +9 -0
  129. package/demos/pc/app/message/prevent-duplicate.vue +32 -0
  130. package/demos/pc/app/message/webdoc/message.cn.md +7 -0
  131. package/demos/pc/app/message/webdoc/message.en.md +7 -0
  132. package/demos/pc/app/message/webdoc/message.js +56 -0
  133. package/demos/pc/app/modal/basic-usage.spec.ts +3 -3
  134. package/demos/pc/app/modal/modal-footer-composition-api.vue +3 -3
  135. package/demos/pc/app/modal/modal-footer.spec.ts +9 -4
  136. package/demos/pc/app/modal/modal-footer.vue +3 -3
  137. package/demos/pc/app/modal/modal-header.spec.ts +2 -2
  138. package/demos/pc/app/modal/modal-size.spec.ts +2 -2
  139. package/demos/pc/app/modal/status.spec.ts +22 -15
  140. package/demos/pc/app/nav-menu/overflow.spec.ts +1 -1
  141. package/demos/pc/app/popconfirm/custom-class.spec.ts +0 -1
  142. package/demos/pc/app/popconfirm/slot-message.spec.ts +10 -2
  143. package/demos/pc/app/popconfirm/trigger.spec.ts +16 -12
  144. package/demos/pc/app/popover/basic-usage.spec.js +3 -8
  145. package/demos/pc/app/popover/custom-popper.spec.js +2 -2
  146. package/demos/pc/app/popover/delay.spec.js +2 -2
  147. package/demos/pc/app/popover/disabled.spec.js +2 -2
  148. package/demos/pc/app/popover/events.spec.js +1 -1
  149. package/demos/pc/app/popover/ignore-boundaries.spec.js +2 -3
  150. package/demos/pc/app/popover/offset.spec.js +17 -31
  151. package/demos/pc/app/radio/dynamic-disable-composition-api.vue +3 -3
  152. package/demos/pc/app/radio/dynamic-disable.vue +2 -2
  153. package/demos/pc/app/rate/clearable-composition-api.vue +20 -0
  154. package/demos/pc/app/rate/clearable.spec.js +74 -0
  155. package/demos/pc/app/rate/clearable.vue +28 -0
  156. package/demos/pc/app/rate/webdoc/rate.js +12 -0
  157. package/demos/pc/app/search/events.spec.ts +1 -1
  158. package/demos/pc/app/search-box/append-to-body-composition-api.vue +300 -0
  159. package/demos/pc/app/search-box/append-to-body.vue +308 -0
  160. package/demos/pc/app/search-box/auto-match-composition-api.vue +162 -0
  161. package/demos/pc/app/search-box/auto-match.vue +170 -0
  162. package/demos/pc/app/search-box/basic-usage-composition-api.vue +269 -0
  163. package/demos/pc/app/search-box/basic-usage.vue +277 -0
  164. package/demos/pc/app/search-box/custom-panel-composition-api.vue +63 -0
  165. package/demos/pc/app/search-box/custom-panel.vue +72 -0
  166. package/demos/pc/app/search-box/default-field-composition-api.vue +163 -0
  167. package/demos/pc/app/search-box/default-field.vue +171 -0
  168. package/demos/pc/app/search-box/editable-composition-api.vue +311 -0
  169. package/demos/pc/app/search-box/editable.vue +320 -0
  170. package/demos/pc/app/search-box/empty-placeholder-composition-api.vue +162 -0
  171. package/demos/pc/app/search-box/empty-placeholder.vue +170 -0
  172. package/demos/pc/app/search-box/events-composition-api.vue +169 -0
  173. package/demos/pc/app/search-box/events.vue +173 -0
  174. package/demos/pc/app/search-box/group-key-composition-api.vue +257 -0
  175. package/demos/pc/app/search-box/group-key.vue +266 -0
  176. package/demos/pc/app/search-box/help-composition-api.vue +166 -0
  177. package/demos/pc/app/search-box/help.vue +175 -0
  178. package/demos/pc/app/search-box/id-map-key-composition-api.vue +131 -0
  179. package/demos/pc/app/search-box/id-map-key.vue +140 -0
  180. package/demos/pc/app/search-box/item-placeholder-composition-api.vue +119 -0
  181. package/demos/pc/app/search-box/item-placeholder.vue +127 -0
  182. package/demos/pc/app/search-box/max-length-composition-api.vue +29 -0
  183. package/demos/pc/app/search-box/max-length.vue +38 -0
  184. package/demos/pc/app/search-box/max-time-length-composition-api.vue +53 -0
  185. package/demos/pc/app/search-box/max-time-length.vue +62 -0
  186. package/demos/pc/app/search-box/merge-tag-composition-api.vue +59 -0
  187. package/demos/pc/app/search-box/merge-tag.vue +68 -0
  188. package/demos/pc/app/search-box/panel-max-height-composition-api.vue +162 -0
  189. package/demos/pc/app/search-box/panel-max-height.vue +170 -0
  190. package/demos/pc/app/search-box/potential-match-composition-api.vue +193 -0
  191. package/demos/pc/app/search-box/potential-match.vue +201 -0
  192. package/demos/pc/app/search-box/settings-composition-api.vue +163 -0
  193. package/demos/pc/app/search-box/settings.vue +171 -0
  194. package/demos/pc/app/search-box/size-composition-api.vue +162 -0
  195. package/demos/pc/app/search-box/size.vue +170 -0
  196. package/demos/pc/app/search-box/split-input-value-composition-api.vue +162 -0
  197. package/demos/pc/app/search-box/split-input-value.vue +170 -0
  198. package/demos/pc/app/search-box/suffix-icon-composition-api.vue +209 -0
  199. package/demos/pc/app/search-box/suffix-icon.vue +219 -0
  200. package/demos/pc/app/search-box/v-model-composition-api.vue +174 -0
  201. package/demos/pc/app/search-box/v-model.vue +182 -0
  202. package/demos/pc/app/search-box/webdoc/search-box.cn.md +7 -0
  203. package/demos/pc/app/search-box/webdoc/search-box.en.md +7 -0
  204. package/demos/pc/app/search-box/webdoc/search-box.js +257 -0
  205. package/demos/pc/app/select/copy-multi.spec.ts +1 -1
  206. package/demos/pc/app/select-wrapper/copy-multi.spec.ts +2 -1
  207. package/demos/pc/app/tabs/basic-usage.spec.ts +2 -2
  208. package/demos/pc/app/tabs/more-show-all.spec.ts +2 -1
  209. package/demos/pc/app/tabs/tabs-events-close-composition-api.vue +8 -2
  210. package/demos/pc/app/tabs/tabs-events-close.vue +8 -2
  211. package/demos/pc/app/tabs/tooltip-composition-api.vue +1 -1
  212. package/demos/pc/app/tag/basic-usage.spec.ts +1 -1
  213. package/demos/pc/app/tag/color-border.spec.ts +2 -2
  214. package/demos/pc/app/tag/max-width.spec.ts +1 -1
  215. package/demos/pc/app/tag/size.spec.ts +3 -3
  216. package/demos/pc/app/tag/slot-default.spec.ts +3 -3
  217. package/demos/pc/app/tag-group/basic-usage.spec.js +5 -5
  218. package/demos/pc/app/tag-group/tag-group-effect.spec.js +10 -10
  219. package/demos/pc/app/tag-group/tag-group-event.spec.js +1 -1
  220. package/demos/pc/app/tag-input/basic-usage-composition-api.vue +29 -0
  221. package/demos/pc/app/tag-input/basic-usage.spec.ts +0 -0
  222. package/demos/pc/app/tag-input/basic-usage.vue +38 -0
  223. package/demos/pc/app/tag-input/clearable-tag-composition-api.vue +20 -0
  224. package/demos/pc/app/tag-input/clearable-tag.vue +27 -0
  225. package/demos/pc/app/tag-input/collapsed-tag-composition-api.vue +20 -0
  226. package/demos/pc/app/tag-input/collapsed-tag.vue +28 -0
  227. package/demos/pc/app/tag-input/disabled-readonly-composition-api.vue +20 -0
  228. package/demos/pc/app/tag-input/disabled-readonly.vue +29 -0
  229. package/demos/pc/app/tag-input/draggable-tag-composition-api.vue +12 -0
  230. package/demos/pc/app/tag-input/draggable-tag.spec.ts +0 -0
  231. package/demos/pc/app/tag-input/draggable-tag.vue +20 -0
  232. package/demos/pc/app/tag-input/max-composition-api.vue +20 -0
  233. package/demos/pc/app/tag-input/max.vue +28 -0
  234. package/demos/pc/app/tag-input/prefix-suffix-composition-api.vue +26 -0
  235. package/demos/pc/app/tag-input/prefix-suffix.vue +34 -0
  236. package/demos/pc/app/tag-input/separator-tag-composition-api.vue +20 -0
  237. package/demos/pc/app/tag-input/separator-tag.vue +28 -0
  238. package/demos/pc/app/tag-input/webdoc/tag-input.cn.md +7 -0
  239. package/demos/pc/app/tag-input/webdoc/tag-input.en.md +7 -0
  240. package/demos/pc/app/tag-input/webdoc/tag-input.js +107 -0
  241. package/demos/pc/app/time-picker/basic-usage.spec.ts +5 -4
  242. package/demos/pc/app/time-picker/clearable.spec.ts +5 -4
  243. package/demos/pc/app/time-picker/default-value.spec.ts +2 -2
  244. package/demos/pc/app/time-picker/disabled.spec.ts +4 -3
  245. package/demos/pc/app/time-picker/format.spec.ts +8 -11
  246. package/demos/pc/app/time-picker/is-range.spec.ts +4 -3
  247. package/demos/pc/app/time-picker/name.spec.ts +1 -1
  248. package/demos/pc/app/time-picker/placeholder.spec.ts +3 -3
  249. package/demos/pc/app/time-picker/popper-class.spec.ts +1 -1
  250. package/demos/pc/app/time-picker/size.spec.ts +2 -1
  251. package/demos/pc/app/time-select/basic-usage.spec.ts +1 -1
  252. package/demos/pc/app/time-select/clear-icon.spec.ts +1 -2
  253. package/demos/pc/app/time-select/focus.spec.ts +1 -1
  254. package/demos/pc/app/time-select/picker-options.spec.ts +2 -1
  255. package/demos/pc/app/time-select/range-placeholder.spec.ts +2 -2
  256. package/demos/pc/app/time-select/size-medium.spec.ts +3 -3
  257. package/demos/pc/app/tooltip/delay.spec.js +7 -9
  258. package/demos/pc/app/tooltip/offset.spec.js +0 -2
  259. package/demos/pc/app/tooltip/popper-options.spec.js +2 -1
  260. package/demos/pc/app/user-head/color-composition-api.vue +2 -1
  261. package/demos/pc/menus.js +6 -4
  262. package/demos/pc/webdoc/changelog-en.md +370 -176
  263. package/demos/pc/webdoc/changelog.md +177 -219
  264. package/demos/pc/webdoc/develop-demo-en.md +13 -13
  265. package/demos/pc/webdoc/import-components.md +1 -1
  266. package/demos/pc/webdoc/introduce.md +2 -0
  267. package/demos/pc/webdoc/skills-en.md +107 -0
  268. package/demos/pc/webdoc/skills.md +107 -0
  269. package/demos/pc/webdoc/theme-en.md +82 -79
  270. package/demos/pc/webdoc/v3.28.0-release-article.md +943 -0
  271. package/demos/saas/menus.js +1 -0
  272. package/package.json +21 -20
  273. package/playground/App.vue +12 -6
  274. package/playground/shims/vue-search-box.mjs +154 -0
  275. package/public/static/css/mobile-dark-theme.css +1 -0
  276. package/src/i18n/index.js +1 -2
  277. package/src/main.js +8 -5
  278. package/src/style.css +5 -0
  279. package/src/views/components-doc/common.vue +0 -25
  280. package/src/views/components-doc/mobile.vue +49 -2
  281. package/vite.config.ts +3 -2
  282. package/vite.extend.ts +65 -0
  283. package/demos/pc/app/grid/webdoc/grid-ai-agent.js +0 -23
  284. package/demos/pc/webdoc/mcp-en.md +0 -101
  285. package/demos/pc/webdoc/mcp.md +0 -101
  286. package/src/components/mcp-docs.vue +0 -33
  287. package/src/composable/useTinyRemoter.ts +0 -176
@@ -1,101 +0,0 @@
1
- # TinyVue Intelligent Component Access Guide
2
-
3
- TinyVue's intelligent components provide a complete intelligent solution, allowing your application to have AI conversation, voice interaction, and other capabilities. This guide will walk you through how to integrate TinyVue's intelligent components into your project.
4
-
5
- ## Install dependencies
6
-
7
- First, you need to install the following core dependency packages:
8
-
9
- ```bash
10
- npm install @opentiny/tiny-vue-mcp @opentiny/next-vue @opentiny/vue-common @opentiny/vue
11
- ```
12
-
13
- ## Access steps
14
-
15
- ### 1. Initialize MCP Configuration
16
-
17
- Initialize MCP configuration in the application entry file (e.g., `main.js`):
18
-
19
- ```js
20
- import { registerMcpConfig } from '@opentiny/vue-common'
21
- import { createMcpTools, getTinyVueMcpConfig } from '@opentiny/tiny-vue-mcp'
22
-
23
- // Register TinyVue component MCP configuration
24
- registerMcpConfig(getTinyVueMcpConfig(), createMcpTools)
25
- ```
26
-
27
- ### 2. Create NextClient Proxy Client
28
-
29
- Create a NextClient proxy client in `App.vue` to establish real-time communication:
30
-
31
- ```html
32
- <script setup lang="ts">
33
- import { useNextClient } from '@opentiny/next-vue'
34
-
35
- const { sessionId } = useNextClient({
36
- clientInfo: {
37
- name: 'your-app-name', // Application name
38
- version: '1.0.0', // Application version
39
- sessionId: 'your-session-id' // Optional, will be passed in by the backend if not provided; for debugging, you can use crypto.randomUUID() to generate a fixed one
40
- },
41
- proxyOptions: {
42
- url: 'your-sse-url', // SSE service address
43
- token: 'your-token' // Authentication token
44
- }
45
- })
46
- </script>
47
-
48
- <template>
49
- <div>
50
- <h1>NextClient Proxy Client</h1>
51
- <p>Session ID: {{ sessionId }}</p>
52
- </div>
53
- </template>
54
- ```
55
-
56
- ### 3. MCP Component Configuration
57
-
58
- When using
59
-
60
- ```html
61
- <script setup lang="ts">
62
- import { useNextServer } from '@opentiny/next-vue'
63
-
64
- const { server } = useNextServer({
65
- serverInfo: { name: 'your-server-name', version: '1.0.0' }
66
- })
67
- </script>
68
-
69
- <template>
70
- <tiny-grid
71
- :tiny_mcp_config="{
72
- server,
73
- business: {
74
- id: 'your-business-id',
75
- description: 'Business description'
76
- }
77
- }"
78
- >
79
- <!-- Table content -->
80
- </tiny-grid>
81
- </template>
82
- ```
83
-
84
- ## Notes
85
-
86
- 1. Ensure that the server supports SSE (Server-Sent Events) connections
87
- 2. It is recommended to use HTTPS in production environments
88
- 3. CORS needs to be correctly configured to support cross-origin requests
89
-
90
- ## Common issues
91
-
92
- 1. Session connection failed
93
-
94
- - Check if the SSE service address is correct
95
- - Confirm that the network connection is normal
96
- - Verify that the authentication information is valid
97
-
98
- 2. AI conversation response is not available
99
- - Check if the session is established normally
100
- - Confirm that the prompt item configuration is correct
101
- - Check if there are errors in the network request
@@ -1,101 +0,0 @@
1
- # TinyVue 智能化组件接入指南
2
-
3
- TinyVue 的智能化组件提供了一套完整的智能化解决方案,让您的应用具备 AI 对话、语音交互等能力。本文将指导您如何在项目中接入 TinyVue 的智能化组件。
4
-
5
- ## 安装依赖
6
-
7
- 首先需要安装以下核心依赖包:
8
-
9
- ```bash
10
- npm install @opentiny/tiny-vue-mcp @opentiny/next-vue @opentiny/vue-common @opentiny/vue
11
- ```
12
-
13
- ## 接入步骤
14
-
15
- ### 1. 初始化 MCP 配置
16
-
17
- 在应用入口文件(如 `main.js`)中初始化 MCP 配置:
18
-
19
- ```js
20
- import { registerMcpConfig } from '@opentiny/vue-common'
21
- import { createMcpTools, getTinyVueMcpConfig } from '@opentiny/tiny-vue-mcp'
22
-
23
- // 注册 TinyVue 组件 MCP 配置
24
- registerMcpConfig(getTinyVueMcpConfig(), createMcpTools)
25
- ```
26
-
27
- ### 2. 创建 NextClient 代理客户端
28
-
29
- 在 `App.vue` 中创建 NextClient 代理客户端,用于建立实时通信:
30
-
31
- ```html
32
- <script setup lang="ts">
33
- import { useNextClient } from '@opentiny/next-vue'
34
-
35
- const { sessionId } = useNextClient({
36
- clientInfo: {
37
- name: 'your-app-name', // 应用名称
38
- version: '1.0.0', // 应用版本
39
- sessionId: 'your-session-id' // 可选,不传由后台自动生成。调试时可使用 crypto.randomUUID() 生成固定值
40
- },
41
- proxyOptions: {
42
- url: 'your-sse-url', // SSE 服务地址,目前agent代理服务器代码未开源,如想进一步了解可以在github中提issue单
43
- token: 'your-token' // 认证 token
44
- }
45
- })
46
- </script>
47
-
48
- <template>
49
- <div>
50
- <h1>NextClient 代理客户端</h1>
51
- <p>会话 ID: {{ sessionId }}</p>
52
- </div>
53
- </template>
54
- ```
55
-
56
- ### 3. MCP 组件配置
57
-
58
- 在子页面中使用 Grid 等支持 MCP 的组件时,添加 MCP 配置:
59
-
60
- ```html
61
- <script setup lang="ts">
62
- import { useNextServer } from '@opentiny/next-vue'
63
-
64
- const { server } = useNextServer({
65
- serverInfo: { name: 'your-server-name', version: '1.0.0' }
66
- })
67
- </script>
68
-
69
- <template>
70
- <tiny-grid
71
- :tiny_mcp_config="{
72
- server,
73
- business: {
74
- id: 'your-business-id',
75
- description: '业务描述'
76
- }
77
- }"
78
- >
79
- <!-- 表格内容 -->
80
- </tiny-grid>
81
- </template>
82
- ```
83
-
84
- ## 注意事项
85
-
86
- 1. 确保服务端支持 SSE(Server-Sent Events)连接
87
- 2. 建议在生产环境使用 HTTPS 协议
88
- 3. 需要正确配置 CORS 以支持跨域请求
89
-
90
- ## 常见问题
91
-
92
- 1. 会话连接失败
93
-
94
- - 检查 SSE 服务地址是否正确
95
- - 确认网络连接是否正常
96
- - 验证认证信息是否有效
97
-
98
- 2. AI 对话无响应
99
- - 检查会话是否正常建立
100
- - 确认提示项配置是否正确
101
- - 查看网络请求是否有错误
@@ -1,33 +0,0 @@
1
- <template>
2
- <div class="mcp-list">
3
- <div class="mcp-title">
4
- <h2>{{ name }} 组件的 MCP 工具</h2>
5
- </div>
6
- <tiny-grid :data="data" row-id="name">
7
- <tiny-grid-column field="name" title="名称" width="180"> </tiny-grid-column>
8
- <tiny-grid-column field="param" title="参数类型" width="150"> </tiny-grid-column>
9
- <tiny-grid-column field="desc" title="工具描述"> </tiny-grid-column>
10
- </tiny-grid>
11
- </div>
12
- </template>
13
-
14
- <script setup>
15
- import { TinyGrid, TinyGridColumn } from '@opentiny/vue'
16
-
17
- const props = defineProps({
18
- name: String,
19
- data: Array
20
- })
21
- </script>
22
-
23
- <style scoped lang="less">
24
- .mcp-list {
25
- padding-bottom: 150px;
26
- }
27
- .mcp-title {
28
- font-size: 16px;
29
- font-weight: bold;
30
- margin-top: 26px;
31
- margin-bottom: 26px;
32
- }
33
- </style>
@@ -1,176 +0,0 @@
1
- import { WebMcpServer, WebMcpClient, createMessageChannelPairTransport, z } from '@opentiny/next-sdk'
2
- import { genMenus } from '../menus'
3
- import { useRouter } from 'vue-router'
4
- import { ref } from 'vue'
5
-
6
- export const AGENT_ROOT = 'https://agent.opentiny.design/api/v1/webmcp-trial/'
7
-
8
- // 调用 useTinyRemoter() 完毕后,下面三个变量变会有值。
9
- export const webMcpServer: { value: null | WebMcpServer } = { value: null }
10
- export const webMcpClient: { value: null | WebMcpClient } = { value: null }
11
- export const webMcpSessionId: { value: null | string } = ref('')
12
-
13
- export async function useTinyRemoter() {
14
- const [serverTransport, clientTransport] = createMessageChannelPairTransport()
15
-
16
- // 定义 MCP Server
17
- const server = new WebMcpServer(
18
- { name: 'base-config', version: '1.0.0' },
19
- {
20
- capabilities: {
21
- prompts: { listChanged: true },
22
- resources: { subscribe: true, listChanged: true },
23
- tools: { listChanged: true },
24
- completions: {},
25
- logging: {}
26
- }
27
- }
28
- )
29
- webMcpServer.value = server
30
- createGlobalMcpTool(server)
31
-
32
- serverTransport.onerror = (error) => {
33
- console.error(`ServerTransport error:`, error)
34
- }
35
- await server.connect(serverTransport)
36
-
37
- // 定义 MCP Client
38
- const client = new WebMcpClient(
39
- { name: 'mcp-web-client', version: '1.0.0' },
40
- { capabilities: { roots: { listChanged: true }, sampling: {}, elicitation: {} } }
41
- )
42
- webMcpClient.value = client
43
-
44
- await client.connect(clientTransport)
45
-
46
- // 不能传入固定的sessionId, 让它每次自动生成一个。
47
- const { sessionId } = await client.connect({
48
- url: AGENT_ROOT + 'mcp',
49
- agent: true,
50
- onError: (error: Error) => {
51
- console.error('Connect proxy error:', error)
52
- }
53
- })
54
- webMcpSessionId.value = sessionId
55
-
56
- window.addEventListener('pagehide', client.onPagehide)
57
- }
58
-
59
- // 组件页面的右上导航的数据回调函数
60
- export const cmpAnchorDataCallback = { value: null }
61
-
62
- export const createGlobalMcpTool = (server) => {
63
- const router = useRouter()
64
- server.registerResource(
65
- 'site-menus',
66
- 'site-menus://app',
67
- {
68
- title: 'TinyVue官网的菜单数据',
69
- description: 'TinyVue官网的菜单数据,其中"key"为路由路径,"name"为菜单名称,"children"为子菜单',
70
- mimeType: 'text/plain'
71
- },
72
- async (uri) => ({
73
- contents: [
74
- {
75
- uri: uri.href,
76
- text: JSON.stringify(genMenus())
77
- }
78
- ]
79
- })
80
- )
81
- // 帮我查看button组件的API
82
- server.registerTool(
83
- 'swtich-router',
84
- {
85
- title: 'router',
86
- description: '可以帮用户跳转到文档页面,组件示例的总页面或组件API文档页面,或组件库的概览页面',
87
- inputSchema: {
88
- key: z.string().describe('跳转页面路径'),
89
- type: z
90
- .enum(['components', 'docs', 'overview', 'features'])
91
- .describe('跳转页面类型,比如:组件的页面,文档的页面,组件的概览页面'),
92
- isOpenApi: z.boolean().describe('跳转到组件页面时,是否打开API文档')
93
- }
94
- },
95
- async ({ key, type, isOpenApi }) => {
96
- const { params, fullPath } = router.currentRoute.value
97
- const { theme } = params
98
- const themeIndex = fullPath.indexOf(theme)
99
- const linkUrl =
100
- fullPath.slice(0, themeIndex) + `${theme}/${type}/${key === 'overview' ? '' : key}${isOpenApi ? '#api' : ''}`
101
- router.push(linkUrl)
102
- return {
103
- content: [
104
- {
105
- type: 'text',
106
- text: `跳转页面成功: ${key}`
107
- }
108
- ]
109
- }
110
- }
111
- )
112
-
113
- server.registerTool(
114
- 'get-component-demos',
115
- {
116
- title: '查询全部示例的信息',
117
- description:
118
- '查询当前组件的全部示例信息,demos信息。返回值是一个数组,其中每一项的 demoId 属性是示例的键,通过键可以跳转到该示例。desc属性是示例的详细描述。',
119
- inputSchema: {}
120
- },
121
- async () => {
122
- // 通知组件页面返回右侧导航的数据
123
- if (cmpAnchorDataCallback.value != null) {
124
- const links = cmpAnchorDataCallback.value()
125
-
126
- return {
127
- content: [{ type: 'text', text: JSON.stringify(links) }]
128
- }
129
- } else {
130
- return {
131
- content: [{ type: 'text', text: '找不到示例' }]
132
- }
133
- }
134
- }
135
- )
136
-
137
- server.registerTool(
138
- 'jump-to-demo',
139
- {
140
- title: '跳转到组件的示例demo',
141
- description: '根据参数demoId, 跳转到指定的示例demo。',
142
- inputSchema: {
143
- demoId: z.string().describe('示例的id,唯一标识。')
144
- }
145
- },
146
- async ({ demoId }) => {
147
- // 通知组件页面返回右侧导航的数据
148
- location.hash = '#' + demoId
149
-
150
- return {
151
- content: [{ type: 'text', text: '跳转示例成功' }]
152
- }
153
- }
154
- )
155
-
156
- // 长任务示例
157
- server.registerTool(
158
- 'long-task',
159
- {
160
- title: 'long-task',
161
- description: '可以帮用户订机票'
162
- },
163
- async () => {
164
- // 执行一个长任务
165
- await new Promise((resolve) => setTimeout(resolve, 10000))
166
- return {
167
- content: [
168
- {
169
- type: 'text',
170
- text: '执行一个长任务,执行完成'
171
- }
172
- ]
173
- }
174
- }
175
- )
176
- }