@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.
- package/demos/apis/action-menu.js +22 -0
- package/demos/apis/alert.js +19 -22
- package/demos/apis/button-group.js +15 -0
- package/demos/apis/calendar-view.js +5 -5
- package/demos/apis/cascader-view.js +5 -5
- package/demos/apis/dialog-box.js +39 -38
- package/demos/apis/drawer.js +31 -0
- package/demos/apis/dropdown.js +39 -1
- package/demos/apis/filter-panel.js +21 -1
- package/demos/apis/fluent-editor.js +30 -0
- package/demos/apis/form.js +11 -0
- package/demos/apis/fullscreen.js +10 -11
- package/demos/apis/grid.js +131 -16
- package/demos/apis/guide.js +14 -0
- package/demos/apis/link.js +11 -0
- package/demos/apis/message.js +48 -22
- package/demos/apis/modal.js +34 -31
- package/demos/apis/notify.js +13 -13
- package/demos/apis/rate.js +15 -0
- package/demos/apis/search-box.js +343 -0
- package/demos/apis/select.js +14 -2
- package/demos/apis/tag-input.js +182 -0
- package/demos/apis/tree.js +23 -23
- package/demos/mobile-first/app/button-group/display-mode.vue +31 -0
- package/demos/mobile-first/app/button-group/webdoc/button-group.js +13 -0
- package/demos/mobile-first/app/calendar-view/webdoc/calendar-view.js +5 -4
- package/demos/mobile-first/app/modal/webdoc/modal.js +2 -1
- package/demos/pc/app/alert/center.spec.ts +8 -0
- package/demos/pc/app/alert/custom-close.spec.ts +39 -9
- package/demos/pc/app/alert/icon.spec.ts +18 -7
- package/demos/pc/app/alert/show-icon.spec.ts +1 -1
- package/demos/pc/app/anchor/webdoc/anchor.js +1 -0
- package/demos/pc/app/base-select/copy-multi.spec.ts +1 -1
- package/demos/pc/app/button-group/display-mode-composition-api.vue +23 -0
- package/demos/pc/app/button-group/display-mode.spec.ts +0 -0
- package/demos/pc/app/button-group/display-mode.vue +31 -0
- package/demos/pc/app/button-group/sup-composition-api.vue +1 -0
- package/demos/pc/app/button-group/sup.vue +1 -0
- package/demos/pc/app/button-group/webdoc/button-group.js +14 -0
- package/demos/pc/app/calendar-view/calendar-event.spec.ts +1 -1
- package/demos/pc/app/calendar-view/custom-day-bg-color.vue +10 -0
- package/demos/pc/app/calendar-view/webdoc/calendar-view.js +4 -4
- package/demos/pc/app/cascader/filter-mode-composition-api.vue +2 -2
- package/demos/pc/app/checkbox/checked-composition-api.vue +3 -3
- package/demos/pc/app/checkbox/checked.vue +3 -3
- package/demos/pc/app/date-picker/align.spec.ts +10 -13
- package/demos/pc/app/date-picker/clear.spec.ts +3 -3
- package/demos/pc/app/date-picker/default-value.spec.ts +4 -4
- package/demos/pc/app/date-picker/events.spec.ts +2 -2
- package/demos/pc/app/date-picker/format.spec.ts +3 -3
- package/demos/pc/app/date-picker/now.spec.ts +4 -4
- package/demos/pc/app/date-picker/shortcuts.spec.ts +1 -1
- package/demos/pc/app/date-picker/slot.spec.ts +5 -5
- package/demos/pc/app/dialog-box/basic-usage.spec.ts +5 -5
- package/demos/pc/app/dialog-box/form-in-dialog.spec.ts +1 -2
- package/demos/pc/app/drawer/basic-usage.spec.ts +4 -3
- package/demos/pc/app/drawer/close-on-press-escape.spec.ts +4 -2
- package/demos/pc/app/drawer/placement.spec.ts +4 -4
- package/demos/pc/app/drawer/show-header.spec.ts +3 -2
- package/demos/pc/app/drawer/webdoc/drawer.js +3 -2
- package/demos/pc/app/dropdown/show-icon-composition-api.vue +1 -1
- package/demos/pc/app/dropdown/show-icon.vue +1 -1
- package/demos/pc/app/dropdown/tip-composition-api.vue +5 -2
- package/demos/pc/app/dropdown/tip.vue +5 -2
- package/demos/pc/app/dropdown/webdoc/dropdown.js +2 -2
- package/demos/pc/app/filter-panel/size-composition-api.vue +58 -0
- package/demos/pc/app/filter-panel/size.spec.ts +23 -0
- package/demos/pc/app/filter-panel/size.vue +68 -0
- package/demos/pc/app/filter-panel/webdoc/filter-panel.js +13 -0
- package/demos/pc/app/flowchart/basic-usage-composition-api.vue +10 -260
- package/demos/pc/app/flowchart/basic-usage.spec.ts +2 -1
- package/demos/pc/app/flowchart/basic-usage.vue +4 -249
- package/demos/pc/app/flowchart/slots-composition-api.vue +182 -0
- package/demos/pc/app/flowchart/slots.spec.ts +24 -0
- package/demos/pc/app/flowchart/slots.vue +193 -0
- package/demos/pc/app/flowchart/webdoc/flowchart.js +14 -2
- package/demos/pc/app/form/basic-usage.spec.ts +6 -4
- package/demos/pc/app/form/custom-validation-string-length-composition-api.vue +38 -0
- package/demos/pc/app/form/custom-validation-string-length.spec.ts +18 -0
- package/demos/pc/app/form/custom-validation-string-length.vue +28 -13
- package/demos/pc/app/form/group-form-composition-api.vue +2 -2
- package/demos/pc/app/form/group-form.vue +2 -2
- package/demos/pc/app/grid/filter/advanced-filter-composition-api.vue +1 -1
- package/demos/pc/app/grid/filter/advanced-filter.spec.js +1 -0
- package/demos/pc/app/grid/filter/advanced-filter.vue +1 -1
- package/demos/pc/app/grid/filter/custom-filter-composition-api.vue +46 -23
- package/demos/pc/app/grid/filter/custom-filter.spec.js +1 -1
- package/demos/pc/app/grid/filter/custom-filter.vue +47 -24
- package/demos/pc/app/grid/filter/default-filter-composition-api.vue +5 -1
- package/demos/pc/app/grid/filter/default-filter.spec.ts +1 -0
- package/demos/pc/app/grid/filter/default-filter.vue +4 -1
- package/demos/pc/app/grid/filter/filter-label-value-composition-api.vue +71 -0
- package/demos/pc/app/grid/filter/filter-label-value.spec.ts +27 -0
- package/demos/pc/app/grid/filter/filter-label-value.vue +78 -0
- package/demos/pc/app/grid/filter/input-filter-custom-component-composition-api.vue +116 -0
- package/demos/pc/app/grid/filter/input-filter-custom-component.spec.ts +20 -0
- package/demos/pc/app/grid/filter/input-filter-custom-component.vue +126 -0
- package/demos/pc/app/grid/filter/layout-order-filter-composition-api.vue +114 -0
- package/demos/pc/app/grid/filter/layout-order-filter.spec.ts +31 -0
- package/demos/pc/app/grid/filter/layout-order-filter.vue +123 -0
- package/demos/pc/app/grid/toolbar/custom-toolbar.spec.js +1 -1
- package/demos/pc/app/grid/webdoc/grid-filter.js +89 -40
- package/demos/pc/app/guide/show-close-composition-api.vue +77 -0
- package/demos/pc/app/guide/show-close.spec.ts +37 -0
- package/demos/pc/app/guide/show-close.vue +84 -0
- package/demos/pc/app/guide/webdoc/guide.js +12 -0
- package/demos/pc/app/icon/advance-icons.js +108 -2
- package/demos/pc/app/icon/advance-usage-composition-api.vue +26 -1
- package/demos/pc/app/icon/advance-usage.vue +27 -1
- package/demos/pc/app/icon/webdoc/icon.js +5 -3
- package/demos/pc/app/input/resize.spec.ts +2 -2
- package/demos/pc/app/link/custom-icon-composition-api.vue +1 -1
- package/demos/pc/app/link/custom-icon.vue +1 -1
- package/demos/pc/app/link/target-composition-api.vue +24 -0
- package/demos/pc/app/link/target.spec.ts +41 -0
- package/demos/pc/app/link/target.vue +30 -0
- package/demos/pc/app/link/webdoc/link.js +14 -0
- package/demos/pc/app/message/basic-usage-composition-api.vue +48 -0
- package/demos/pc/app/message/basic-usage.spec.ts +27 -0
- package/demos/pc/app/message/basic-usage.vue +50 -0
- package/demos/pc/app/message/message-close-composition-api.vue +25 -0
- package/demos/pc/app/message/message-close.spec.ts +9 -0
- package/demos/pc/app/message/message-close.vue +32 -0
- package/demos/pc/app/message/message-duration-composition-api.vue +25 -0
- package/demos/pc/app/message/message-duration.spec.ts +9 -0
- package/demos/pc/app/message/message-duration.vue +32 -0
- package/demos/pc/app/message/prevent-duplicate-composition-api.vue +25 -0
- package/demos/pc/app/message/prevent-duplicate.spec.ts +9 -0
- package/demos/pc/app/message/prevent-duplicate.vue +32 -0
- package/demos/pc/app/message/webdoc/message.cn.md +7 -0
- package/demos/pc/app/message/webdoc/message.en.md +7 -0
- package/demos/pc/app/message/webdoc/message.js +56 -0
- package/demos/pc/app/modal/basic-usage.spec.ts +3 -3
- package/demos/pc/app/modal/modal-footer-composition-api.vue +3 -3
- package/demos/pc/app/modal/modal-footer.spec.ts +9 -4
- package/demos/pc/app/modal/modal-footer.vue +3 -3
- package/demos/pc/app/modal/modal-header.spec.ts +2 -2
- package/demos/pc/app/modal/modal-size.spec.ts +2 -2
- package/demos/pc/app/modal/status.spec.ts +22 -15
- package/demos/pc/app/nav-menu/overflow.spec.ts +1 -1
- package/demos/pc/app/popconfirm/custom-class.spec.ts +0 -1
- package/demos/pc/app/popconfirm/slot-message.spec.ts +10 -2
- package/demos/pc/app/popconfirm/trigger.spec.ts +16 -12
- package/demos/pc/app/popover/basic-usage.spec.js +3 -8
- package/demos/pc/app/popover/custom-popper.spec.js +2 -2
- package/demos/pc/app/popover/delay.spec.js +2 -2
- package/demos/pc/app/popover/disabled.spec.js +2 -2
- package/demos/pc/app/popover/events.spec.js +1 -1
- package/demos/pc/app/popover/ignore-boundaries.spec.js +2 -3
- package/demos/pc/app/popover/offset.spec.js +17 -31
- package/demos/pc/app/radio/dynamic-disable-composition-api.vue +3 -3
- package/demos/pc/app/radio/dynamic-disable.vue +2 -2
- package/demos/pc/app/rate/clearable-composition-api.vue +20 -0
- package/demos/pc/app/rate/clearable.spec.js +74 -0
- package/demos/pc/app/rate/clearable.vue +28 -0
- package/demos/pc/app/rate/webdoc/rate.js +12 -0
- package/demos/pc/app/search/events.spec.ts +1 -1
- package/demos/pc/app/search-box/append-to-body-composition-api.vue +300 -0
- package/demos/pc/app/search-box/append-to-body.vue +308 -0
- package/demos/pc/app/search-box/auto-match-composition-api.vue +162 -0
- package/demos/pc/app/search-box/auto-match.vue +170 -0
- package/demos/pc/app/search-box/basic-usage-composition-api.vue +269 -0
- package/demos/pc/app/search-box/basic-usage.vue +277 -0
- package/demos/pc/app/search-box/custom-panel-composition-api.vue +63 -0
- package/demos/pc/app/search-box/custom-panel.vue +72 -0
- package/demos/pc/app/search-box/default-field-composition-api.vue +163 -0
- package/demos/pc/app/search-box/default-field.vue +171 -0
- package/demos/pc/app/search-box/editable-composition-api.vue +311 -0
- package/demos/pc/app/search-box/editable.vue +320 -0
- package/demos/pc/app/search-box/empty-placeholder-composition-api.vue +162 -0
- package/demos/pc/app/search-box/empty-placeholder.vue +170 -0
- package/demos/pc/app/search-box/events-composition-api.vue +169 -0
- package/demos/pc/app/search-box/events.vue +173 -0
- package/demos/pc/app/search-box/group-key-composition-api.vue +257 -0
- package/demos/pc/app/search-box/group-key.vue +266 -0
- package/demos/pc/app/search-box/help-composition-api.vue +166 -0
- package/demos/pc/app/search-box/help.vue +175 -0
- package/demos/pc/app/search-box/id-map-key-composition-api.vue +131 -0
- package/demos/pc/app/search-box/id-map-key.vue +140 -0
- package/demos/pc/app/search-box/item-placeholder-composition-api.vue +119 -0
- package/demos/pc/app/search-box/item-placeholder.vue +127 -0
- package/demos/pc/app/search-box/max-length-composition-api.vue +29 -0
- package/demos/pc/app/search-box/max-length.vue +38 -0
- package/demos/pc/app/search-box/max-time-length-composition-api.vue +53 -0
- package/demos/pc/app/search-box/max-time-length.vue +62 -0
- package/demos/pc/app/search-box/merge-tag-composition-api.vue +59 -0
- package/demos/pc/app/search-box/merge-tag.vue +68 -0
- package/demos/pc/app/search-box/panel-max-height-composition-api.vue +162 -0
- package/demos/pc/app/search-box/panel-max-height.vue +170 -0
- package/demos/pc/app/search-box/potential-match-composition-api.vue +193 -0
- package/demos/pc/app/search-box/potential-match.vue +201 -0
- package/demos/pc/app/search-box/settings-composition-api.vue +163 -0
- package/demos/pc/app/search-box/settings.vue +171 -0
- package/demos/pc/app/search-box/size-composition-api.vue +162 -0
- package/demos/pc/app/search-box/size.vue +170 -0
- package/demos/pc/app/search-box/split-input-value-composition-api.vue +162 -0
- package/demos/pc/app/search-box/split-input-value.vue +170 -0
- package/demos/pc/app/search-box/suffix-icon-composition-api.vue +209 -0
- package/demos/pc/app/search-box/suffix-icon.vue +219 -0
- package/demos/pc/app/search-box/v-model-composition-api.vue +174 -0
- package/demos/pc/app/search-box/v-model.vue +182 -0
- package/demos/pc/app/search-box/webdoc/search-box.cn.md +7 -0
- package/demos/pc/app/search-box/webdoc/search-box.en.md +7 -0
- package/demos/pc/app/search-box/webdoc/search-box.js +257 -0
- package/demos/pc/app/select/copy-multi.spec.ts +1 -1
- package/demos/pc/app/select-wrapper/copy-multi.spec.ts +2 -1
- package/demos/pc/app/tabs/basic-usage.spec.ts +2 -2
- package/demos/pc/app/tabs/more-show-all.spec.ts +2 -1
- package/demos/pc/app/tabs/tabs-events-close-composition-api.vue +8 -2
- package/demos/pc/app/tabs/tabs-events-close.vue +8 -2
- package/demos/pc/app/tabs/tooltip-composition-api.vue +1 -1
- package/demos/pc/app/tag/basic-usage.spec.ts +1 -1
- package/demos/pc/app/tag/color-border.spec.ts +2 -2
- package/demos/pc/app/tag/max-width.spec.ts +1 -1
- package/demos/pc/app/tag/size.spec.ts +3 -3
- package/demos/pc/app/tag/slot-default.spec.ts +3 -3
- package/demos/pc/app/tag-group/basic-usage.spec.js +5 -5
- package/demos/pc/app/tag-group/tag-group-effect.spec.js +10 -10
- package/demos/pc/app/tag-group/tag-group-event.spec.js +1 -1
- package/demos/pc/app/tag-input/basic-usage-composition-api.vue +29 -0
- package/demos/pc/app/tag-input/basic-usage.spec.ts +0 -0
- package/demos/pc/app/tag-input/basic-usage.vue +38 -0
- package/demos/pc/app/tag-input/clearable-tag-composition-api.vue +20 -0
- package/demos/pc/app/tag-input/clearable-tag.vue +27 -0
- package/demos/pc/app/tag-input/collapsed-tag-composition-api.vue +20 -0
- package/demos/pc/app/tag-input/collapsed-tag.vue +28 -0
- package/demos/pc/app/tag-input/disabled-readonly-composition-api.vue +20 -0
- package/demos/pc/app/tag-input/disabled-readonly.vue +29 -0
- package/demos/pc/app/tag-input/draggable-tag-composition-api.vue +12 -0
- package/demos/pc/app/tag-input/draggable-tag.spec.ts +0 -0
- package/demos/pc/app/tag-input/draggable-tag.vue +20 -0
- package/demos/pc/app/tag-input/max-composition-api.vue +20 -0
- package/demos/pc/app/tag-input/max.vue +28 -0
- package/demos/pc/app/tag-input/prefix-suffix-composition-api.vue +26 -0
- package/demos/pc/app/tag-input/prefix-suffix.vue +34 -0
- package/demos/pc/app/tag-input/separator-tag-composition-api.vue +20 -0
- package/demos/pc/app/tag-input/separator-tag.vue +28 -0
- package/demos/pc/app/tag-input/webdoc/tag-input.cn.md +7 -0
- package/demos/pc/app/tag-input/webdoc/tag-input.en.md +7 -0
- package/demos/pc/app/tag-input/webdoc/tag-input.js +107 -0
- package/demos/pc/app/time-picker/basic-usage.spec.ts +5 -4
- package/demos/pc/app/time-picker/clearable.spec.ts +5 -4
- package/demos/pc/app/time-picker/default-value.spec.ts +2 -2
- package/demos/pc/app/time-picker/disabled.spec.ts +4 -3
- package/demos/pc/app/time-picker/format.spec.ts +8 -11
- package/demos/pc/app/time-picker/is-range.spec.ts +4 -3
- package/demos/pc/app/time-picker/name.spec.ts +1 -1
- package/demos/pc/app/time-picker/placeholder.spec.ts +3 -3
- package/demos/pc/app/time-picker/popper-class.spec.ts +1 -1
- package/demos/pc/app/time-picker/size.spec.ts +2 -1
- package/demos/pc/app/time-select/basic-usage.spec.ts +1 -1
- package/demos/pc/app/time-select/clear-icon.spec.ts +1 -2
- package/demos/pc/app/time-select/focus.spec.ts +1 -1
- package/demos/pc/app/time-select/picker-options.spec.ts +2 -1
- package/demos/pc/app/time-select/range-placeholder.spec.ts +2 -2
- package/demos/pc/app/time-select/size-medium.spec.ts +3 -3
- package/demos/pc/app/tooltip/delay.spec.js +7 -9
- package/demos/pc/app/tooltip/offset.spec.js +0 -2
- package/demos/pc/app/tooltip/popper-options.spec.js +2 -1
- package/demos/pc/app/user-head/color-composition-api.vue +2 -1
- package/demos/pc/menus.js +6 -4
- package/demos/pc/webdoc/changelog-en.md +370 -176
- package/demos/pc/webdoc/changelog.md +177 -219
- package/demos/pc/webdoc/develop-demo-en.md +13 -13
- package/demos/pc/webdoc/import-components.md +1 -1
- package/demos/pc/webdoc/introduce.md +2 -0
- package/demos/pc/webdoc/skills-en.md +107 -0
- package/demos/pc/webdoc/skills.md +107 -0
- package/demos/pc/webdoc/theme-en.md +82 -79
- package/demos/pc/webdoc/v3.28.0-release-article.md +943 -0
- package/demos/saas/menus.js +1 -0
- package/package.json +21 -20
- package/playground/App.vue +12 -6
- package/playground/shims/vue-search-box.mjs +154 -0
- package/public/static/css/mobile-dark-theme.css +1 -0
- package/src/i18n/index.js +1 -2
- package/src/main.js +8 -5
- package/src/style.css +5 -0
- package/src/views/components-doc/common.vue +0 -25
- package/src/views/components-doc/mobile.vue +49 -2
- package/vite.config.ts +3 -2
- package/vite.extend.ts +65 -0
- package/demos/pc/app/grid/webdoc/grid-ai-agent.js +0 -23
- package/demos/pc/webdoc/mcp-en.md +0 -101
- package/demos/pc/webdoc/mcp.md +0 -101
- package/src/components/mcp-docs.vue +0 -33
- 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
|
package/demos/pc/webdoc/mcp.md
DELETED
|
@@ -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
|
-
}
|