@lxy-hyy/manus-chat-vue3 1.0.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/README.md +105 -0
- package/dist/manus-chat.es.js +54871 -0
- package/dist/manus-chat.umd.js +64 -0
- package/dist/style.css +1 -0
- package/dist/types/index.d.ts +327 -0
- package/dist/types/internal.d.ts +135 -0
- package/package.json +73 -0
package/README.md
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# CozeChat Vue3
|
|
2
|
+
|
|
3
|
+
A Vue 3 chat component for Coze AI platform.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install coze-chat-vue3
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Peer Dependencies
|
|
12
|
+
|
|
13
|
+
This package requires the following peer dependencies:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install vue@^3.0.0 element-plus@^2.0.0 @element-plus/icons-vue@^2.0.0
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
### Global Registration
|
|
22
|
+
|
|
23
|
+
```javascript
|
|
24
|
+
import { createApp } from 'vue'
|
|
25
|
+
import CozeChat from 'coze-chat-vue3'
|
|
26
|
+
import 'coze-chat-vue3/dist/style.css'
|
|
27
|
+
|
|
28
|
+
const app = createApp(App)
|
|
29
|
+
app.use(CozeChat)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Component Usage
|
|
33
|
+
|
|
34
|
+
```vue
|
|
35
|
+
<template>
|
|
36
|
+
<CozeChat
|
|
37
|
+
:token="yourToken"
|
|
38
|
+
:bot-id="yourBotId"
|
|
39
|
+
:user-avatar="userAvatar"
|
|
40
|
+
:ai-avatar="aiAvatar"
|
|
41
|
+
:base-url="baseUrl"
|
|
42
|
+
/>
|
|
43
|
+
</template>
|
|
44
|
+
|
|
45
|
+
<script setup>
|
|
46
|
+
const yourToken = 'your-coze-token'
|
|
47
|
+
const yourBotId = 'your-bot-id'
|
|
48
|
+
const userAvatar = 'https://example.com/user-avatar.png'
|
|
49
|
+
const aiAvatar = 'https://example.com/ai-avatar.png'
|
|
50
|
+
const baseUrl = 'https://api.coze.cn' // Optional, defaults to Coze China endpoint
|
|
51
|
+
</script>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Local Import
|
|
55
|
+
|
|
56
|
+
```vue
|
|
57
|
+
<template>
|
|
58
|
+
<CozeChat :token="token" :bot-id="botId" />
|
|
59
|
+
</template>
|
|
60
|
+
|
|
61
|
+
<script setup>
|
|
62
|
+
import { CozeChat } from 'coze-chat-vue3'
|
|
63
|
+
import 'coze-chat-vue3/dist/style.css'
|
|
64
|
+
|
|
65
|
+
const token = 'your-token'
|
|
66
|
+
const botId = 'your-bot-id'
|
|
67
|
+
</script>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Props
|
|
71
|
+
|
|
72
|
+
| Prop | Type | Required | Default | Description |
|
|
73
|
+
|------|------|----------|---------|-------------|
|
|
74
|
+
| token | String | Yes | - | Coze API token |
|
|
75
|
+
| botId | String | Yes | - | Bot ID |
|
|
76
|
+
| conversationId | String | No | '' | Specific conversation ID |
|
|
77
|
+
| userAvatar | String | No | '' | User avatar URL |
|
|
78
|
+
| aiAvatar | String | No | '' | AI avatar URL |
|
|
79
|
+
| baseUrl | String | No | COZE_CN_BASE_URL | API base URL |
|
|
80
|
+
| baseApiUrl | String | No | '' | Base URL for file access |
|
|
81
|
+
|
|
82
|
+
## Composable
|
|
83
|
+
|
|
84
|
+
You can also use the `useCozeAPI` composable directly:
|
|
85
|
+
|
|
86
|
+
```vue
|
|
87
|
+
<script setup>
|
|
88
|
+
import { useCozeAPI } from 'coze-chat-vue3'
|
|
89
|
+
|
|
90
|
+
const {
|
|
91
|
+
messages,
|
|
92
|
+
isReady,
|
|
93
|
+
currentConversationId,
|
|
94
|
+
sendMessage,
|
|
95
|
+
fetchConversations,
|
|
96
|
+
switchConversation,
|
|
97
|
+
uploadFile,
|
|
98
|
+
// ... other methods
|
|
99
|
+
} = useCozeAPI()
|
|
100
|
+
</script>
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## License
|
|
104
|
+
|
|
105
|
+
MIT
|