g-ai-robot3 0.1.102 → 1.0.1
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/LICENSE +20 -20
- package/README.md +181 -242
- package/dist/assets/ai-robot.png +0 -0
- package/dist/assets/ai_photo.png +0 -0
- package/dist/assets/clear1.png +0 -0
- package/dist/assets/dialog.png +0 -0
- package/dist/assets/error.gif +0 -0
- package/dist/assets/frame.png +0 -0
- package/dist/assets/search.gif +0 -0
- package/dist/assets/send.png +0 -0
- package/dist/assets/speaking.gif +0 -0
- package/dist/assets/user_photo.png +0 -0
- package/dist/assets/xiaoGvideo.mp4 +0 -0
- package/dist/assets/xiaoRvideo.mp4 +0 -0
- package/dist/components/QaDialog.vue.d.ts +131 -0
- package/dist/components/digitalHuman.vue.d.ts +0 -3
- package/dist/composables/index.d.ts +6 -0
- package/dist/composables/useAudioPlayback.d.ts +7 -0
- package/dist/composables/useConversation.d.ts +14 -0
- package/dist/composables/useQADialog.d.ts +98 -0
- package/dist/composables/useStreamAnswer.d.ts +41 -0
- package/dist/composables/useVoiceRecognition.d.ts +41 -0
- package/dist/constants/audio.d.ts +6 -0
- package/dist/constants/avatar.d.ts +41 -0
- package/dist/constants/wakeWords.d.ts +28 -0
- package/dist/g-ai-robot3.es.js +9 -97164
- package/dist/index.css +1 -1
- package/dist/index.d.ts +703 -1
- package/dist/index.vue.d.ts +13 -31
- package/dist/internal-defaults.d.ts +32 -0
- package/dist/type.d.ts +17 -10
- package/dist/utils/index.d.ts +9 -1
- package/package.json +65 -55
- package/dist/g-ai-robot3.umd.js +0 -682
- package/dist/utils/log.data.d.ts +0 -24
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024 yuchen
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 yuchen
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,242 +1,181 @@
|
|
|
1
|
-
# g-ai-robot3
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
import {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
| `
|
|
129
|
-
| `
|
|
130
|
-
| `
|
|
131
|
-
| `
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
|
136
|
-
|
|
|
137
|
-
| `
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
| `offer` | 数字人形象接口 | string | `${apiPrefix}/metahuman/offer` |
|
|
183
|
-
| `humanaudio` | 数字人音频接口 | string | `${apiPrefix}/metahuman/humanaudio` |
|
|
184
|
-
| `stop_audio` | 停止音频接口 | string | `${apiPrefix}/metahuman/stop_audio` |
|
|
185
|
-
| `textDriven` | 文本驱动接口 | string | `${apiPrefix}/intelligentVoice/tts` |
|
|
186
|
-
|
|
187
|
-
## 消息气泡配置
|
|
188
|
-
|
|
189
|
-
| 参数 | 说明 | 类型 | 默认值 |
|
|
190
|
-
| ----------------- | -------------------- | ------------- | ----------------------------------- |
|
|
191
|
-
| `showMsgNumber` | 显示消息数量 | number | `5` |
|
|
192
|
-
| `bubbleTheme` | 气泡主题 | string | `'dark'` |
|
|
193
|
-
| `useCustomDialog` | 是否使用自定义对话框 | boolean | `false` |
|
|
194
|
-
| `BubbleWidth` | 气泡容器样式 | CSSProperties | `{ width: '220px', bottom: '85%' }` |
|
|
195
|
-
| `BubbleWidth` | 气泡宽度 | number | `220` |
|
|
196
|
-
| `BubbleBottom` | 气泡底部距离 | number | `85` |
|
|
197
|
-
|
|
198
|
-
- 组件会将后端返回的关联问题(如 `questions` 列表)整合为可点击项,点击后自动填充并发送。
|
|
199
|
-
|
|
200
|
-
用途:引导用户进行更深入或相关的追问,提升对话效率。
|
|
201
|
-
|
|
202
|
-
## 关键词触发事件(工作流)
|
|
203
|
-
|
|
204
|
-
```ts
|
|
205
|
-
eventFun: [
|
|
206
|
-
{
|
|
207
|
-
keywords: ["打开灌区"], // 触发关键词,关键词为工作流名称
|
|
208
|
-
trigger: "after", // 触发时机,after 表示在 AI 回答后触发
|
|
209
|
-
fun: (a: any) => {
|
|
210
|
-
console.log("打开灌区",a); // a为工作流设置的返回内容
|
|
211
|
-
},
|
|
212
|
-
},
|
|
213
|
-
{
|
|
214
|
-
keywords: ["打开技术舱"],
|
|
215
|
-
trigger: "after",
|
|
216
|
-
fun: (a: any) => {
|
|
217
|
-
console.log("打开技术舱",a);
|
|
218
|
-
},
|
|
219
|
-
},
|
|
220
|
-
];
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
## 常见问题
|
|
224
|
-
|
|
225
|
-
- 画布或视频尺寸不一致:请确保 `canvasWidth/canvasHeight` 与 `videoStyle/digitalStyle/canvasStyle` 一致。
|
|
226
|
-
- 音频或 WS 连接失败:检查 `audioWs/voiceprintWs` 地址可达性。
|
|
227
|
-
|
|
228
|
-
## 语音唤醒词与结束/暂停
|
|
229
|
-
|
|
230
|
-
- 支持的唤醒词(对应五位数字人):
|
|
231
|
-
- 小贵小贵
|
|
232
|
-
- 小慧小慧
|
|
233
|
-
- 小智小智
|
|
234
|
-
- 小 G 同学
|
|
235
|
-
- 小 R 同学
|
|
236
|
-
- 使用方式:在空闲状态直接说出唤醒词,系统会回复“我在,请问有什么可以帮您。”并进入对话。
|
|
237
|
-
- 结束词:再见、拜拜、小贵拜拜、小贵再见(任意其一即可识别,结束对话,需重新唤醒)
|
|
238
|
-
- 暂停词:暂停、停止、小贵暂停、小贵停止(任意其一即可识别,暂停说话,继续监听,无需重新唤醒)
|
|
239
|
-
|
|
240
|
-
## 许可证
|
|
241
|
-
|
|
242
|
-
本项目遵循仓库中的 `LICENSE` 许可。
|
|
1
|
+
# g-ai-robot3
|
|
2
|
+
|
|
3
|
+
内部数字人对话组件,基于 Vue 3,封装了文本问答、语音交互、数字人视频播放和工作流回调能力。
|
|
4
|
+
|
|
5
|
+
## 包说明
|
|
6
|
+
|
|
7
|
+
- 这是内部业务 npm 包,默认会随包发布内部接口地址、默认 `bot_id`、默认代理前缀和默认 WS 地址。
|
|
8
|
+
- 这些默认值已经集中到 [`packages/internal-defaults.ts`](E:/g-ai-robot3/packages/internal-defaults.ts) 统一管理。
|
|
9
|
+
- 组件仍然保留原有覆盖能力。业务方可以通过 props 覆盖 `apiPrefix`、REST 地址、WS 地址和数字人接口地址。
|
|
10
|
+
|
|
11
|
+
## 安装
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install g-ai-robot3
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
本包要求宿主项目使用 Vue 3。
|
|
18
|
+
|
|
19
|
+
## 快速开始
|
|
20
|
+
|
|
21
|
+
```vue
|
|
22
|
+
<script setup lang="ts">
|
|
23
|
+
import GAiRobot3 from "g-ai-robot3";
|
|
24
|
+
import "g-ai-robot3/style.css";
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<template>
|
|
28
|
+
<GAiRobot3
|
|
29
|
+
:cozeInfo="{ bot_id: '7429224296222097443' }"
|
|
30
|
+
apiPrefix="/api21216"
|
|
31
|
+
/>
|
|
32
|
+
</template>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## 仓库内示例
|
|
36
|
+
|
|
37
|
+
- 当前仓库直接使用 [`examples/App.vue`](E:/g-ai-robot3/examples/App.vue) 作为示例页面。
|
|
38
|
+
- 页面入口在 [`index.html`](E:/g-ai-robot3/index.html) 和 [`examples/main.ts`](E:/g-ai-robot3/examples/main.ts)。
|
|
39
|
+
- 本地联调时在仓库根目录运行 `npm run dev` 即可。
|
|
40
|
+
|
|
41
|
+
## Vite 代理示例
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
import { defineConfig } from "vite";
|
|
45
|
+
import vue from "@vitejs/plugin-vue";
|
|
46
|
+
|
|
47
|
+
export default defineConfig({
|
|
48
|
+
plugins: [vue()],
|
|
49
|
+
server: {
|
|
50
|
+
proxy: {
|
|
51
|
+
"/api21216": {
|
|
52
|
+
target: "https://model.keepsoft.net:39002",
|
|
53
|
+
changeOrigin: true,
|
|
54
|
+
secure: false,
|
|
55
|
+
rewrite: (path) => path.replace(/^\/api21216/, ""),
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## 默认内部配置
|
|
63
|
+
|
|
64
|
+
以下默认值会随 npm 包一起发布,且都可以通过 props 覆盖:
|
|
65
|
+
|
|
66
|
+
| 项目 | 默认值 |
|
|
67
|
+
| --- | --- |
|
|
68
|
+
| `apiPrefix` | `"/api21216"` |
|
|
69
|
+
| `cozeInfo.bot_id` | `"7473691358872584226"` |
|
|
70
|
+
| `createConversationUrl` | `${apiPrefix}/chatGlm/createConversation` |
|
|
71
|
+
| `qaServer` | `${apiPrefix}/chatGlm/searchTextNew` |
|
|
72
|
+
| `interrupt` | `${apiPrefix}/chatGlm/cancelChat` |
|
|
73
|
+
| `wakeupAudio` | `${apiPrefix}/asr/saveWakeUpAudio` |
|
|
74
|
+
| `offer` | `${apiPrefix}/metahuman/offer` |
|
|
75
|
+
| `humanaudio` | `${apiPrefix}/metahuman/humanaudio` |
|
|
76
|
+
| `stop_audio` | `${apiPrefix}/metahuman/stop_audio` |
|
|
77
|
+
| `textDriven` | `${apiPrefix}/intelligentVoice/tts` |
|
|
78
|
+
| `audioWs` | `wss://model.keepsoft.net:39002/funasrWs` |
|
|
79
|
+
| `voiceprintWs` | `wss://model.keepsoft.net:39002/speakerWs` |
|
|
80
|
+
| `instructWs` | `wss://model.keepsoft.net:39002/commandWs` |
|
|
81
|
+
|
|
82
|
+
## 常用 Props
|
|
83
|
+
|
|
84
|
+
### 核心配置
|
|
85
|
+
|
|
86
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
87
|
+
| --- | --- | --- | --- |
|
|
88
|
+
| `cozeInfo` | `{ bot_id: string }` | 内置默认值 | 智能体配置,建议显式传入 |
|
|
89
|
+
| `apiPrefix` | `string` | `"/api21216"` | API 基础前缀 |
|
|
90
|
+
| `modelType` | `"local" \| "online"` | `"online"` | 模型类型 |
|
|
91
|
+
| `showModelTypeToggle` | `boolean` | `false` | 是否显示本地/联网切换 |
|
|
92
|
+
| `isDebug` | `boolean` | `false` | 是否打印调试信息 |
|
|
93
|
+
| `mode` | `"audio" \| "text" \| "video"` | `"video"` | 交互模式 |
|
|
94
|
+
|
|
95
|
+
### 对话框与数字人
|
|
96
|
+
|
|
97
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
98
|
+
| --- | --- | --- | --- |
|
|
99
|
+
| `placementBottom` | `number` | `100` | 对话框底部偏移 |
|
|
100
|
+
| `placementLeft` | `number` | `450` | 对话框左侧偏移 |
|
|
101
|
+
| `canvasWidth` | `number` | `180` | 画布宽度 |
|
|
102
|
+
| `canvasHeight` | `number` | `180` | 画布高度 |
|
|
103
|
+
| `videoStyle` | `CSSProperties` | `{ width: "180px", opacity: "0", pointerEvents: "none" }` | 视频样式 |
|
|
104
|
+
| `digitalStyle` | `CSSProperties` | `{ width: "180px", height: "180px" }` | 数字人样式 |
|
|
105
|
+
| `canvasStyle` | `CSSProperties` | `{ width: "180px", height: "180px" }` | Canvas 样式 |
|
|
106
|
+
| `bubbleStyle` | `CSSProperties` | `{ width: "30%", height: "30%" }` | 状态图标样式 |
|
|
107
|
+
|
|
108
|
+
### 气泡与展示型对话
|
|
109
|
+
|
|
110
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
111
|
+
| --- | --- | --- | --- |
|
|
112
|
+
| `showMsgBubble` | `boolean` | `true` | 是否显示悬浮气泡 |
|
|
113
|
+
| `showMsgNumber` | `number` | `5` | 悬浮气泡展示条数 |
|
|
114
|
+
| `bubbleTheme` | `"dark" \| "light" \| "custom"` | `"dark"` | 气泡主题 |
|
|
115
|
+
| `useCustomDialog` | `boolean` | `false` | 是否使用自定义气泡样式 |
|
|
116
|
+
| `BubbleWidth` | `CSSProperties` | `{ width: "220px", bottom: "85%" }` | 气泡容器样式 |
|
|
117
|
+
| `BubbleBottom` | `number` | 无 | 额外气泡底部偏移 |
|
|
118
|
+
| `suspensionStyle` | `CSSProperties` | `{ maxHeight: "33vh" }` | 悬浮区容器样式 |
|
|
119
|
+
| `initialQuestion` | `string` | 无 | 外部传入的首条问题,仅展示不请求接口 |
|
|
120
|
+
| `streamChunks` | `StreamChunk[]` | `[]` | 外部传入的单条流式消息块 |
|
|
121
|
+
| `conversations` | `ConversationInput[]` | `[]` | 外部传入的多轮对话展示数据 |
|
|
122
|
+
|
|
123
|
+
### 接口覆盖
|
|
124
|
+
|
|
125
|
+
| 参数 | 类型 | 默认值说明 |
|
|
126
|
+
| --- | --- | --- |
|
|
127
|
+
| `createConversationUrl` | `string` | 默认由 `apiPrefix` 拼接 |
|
|
128
|
+
| `qaServer` | `string` | 默认由 `apiPrefix` 拼接 |
|
|
129
|
+
| `interrupt` | `string` | 默认由 `apiPrefix` 拼接 |
|
|
130
|
+
| `wakeupAudio` | `string` | 默认由 `apiPrefix` 拼接 |
|
|
131
|
+
| `audioWs` | `string` | 默认内部 WS |
|
|
132
|
+
| `voiceprintWs` | `string` | 默认内部 WS |
|
|
133
|
+
| `offer` | `string` | 默认由 `apiPrefix` 拼接 |
|
|
134
|
+
| `human` | `string` | 默认由 `apiPrefix` 拼接 |
|
|
135
|
+
| `humanaudio` | `string` | 默认由 `apiPrefix` 拼接 |
|
|
136
|
+
| `stop_audio` | `string` | 默认由 `apiPrefix` 拼接 |
|
|
137
|
+
| `textDriven` | `string` | 默认由 `apiPrefix` 拼接 |
|
|
138
|
+
|
|
139
|
+
## 类型导出
|
|
140
|
+
|
|
141
|
+
本包会导出常用类型,内部项目可以直接引用:
|
|
142
|
+
|
|
143
|
+
```ts
|
|
144
|
+
import type {
|
|
145
|
+
ConversationInput,
|
|
146
|
+
IndexProps,
|
|
147
|
+
StreamChunk,
|
|
148
|
+
} from "g-ai-robot3";
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## 工作流事件示例
|
|
152
|
+
|
|
153
|
+
```ts
|
|
154
|
+
const eventFun = [
|
|
155
|
+
{
|
|
156
|
+
keywords: ["scene1_fuyangWeather"],
|
|
157
|
+
trigger: "before",
|
|
158
|
+
fun: (params: Record<string, any>) => {
|
|
159
|
+
console.log("scene1_fuyangWeather", params);
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
keywords: ["scene2"],
|
|
164
|
+
trigger: "after",
|
|
165
|
+
fun: (params: Record<string, any>) => {
|
|
166
|
+
console.log("scene2", params);
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
];
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## 注意事项
|
|
173
|
+
|
|
174
|
+
- 这是浏览器组件,不适用于 SSR 直接渲染。
|
|
175
|
+
- 如果需要覆盖默认内部地址,优先通过 props 覆盖,不要直接改 `dist` 产物。
|
|
176
|
+
- `stream`、`space`、`instructWs` 等旧字段仍保留兼容,但不建议新增使用。
|
|
177
|
+
- 视频和动图资源体积较大,当前库产物会偏重,内部接入时建议通过缓存策略降低重复下载成本。
|
|
178
|
+
|
|
179
|
+
## 许可证
|
|
180
|
+
|
|
181
|
+
本项目遵循仓库内的 `LICENSE`。
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import type { CSSProperties } from 'vue';
|
|
2
|
+
import type { ConversationItem } from '../composables/useQADialog';
|
|
3
|
+
import type { Theme } from '../type';
|
|
4
|
+
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
5
|
+
title?: string | undefined;
|
|
6
|
+
useAudio?: boolean | undefined;
|
|
7
|
+
dialogBoxTheme?: Theme | undefined;
|
|
8
|
+
placementLeft?: number | undefined;
|
|
9
|
+
placementBottom?: number | undefined;
|
|
10
|
+
dialogCss?: CSSProperties | undefined;
|
|
11
|
+
isGettingAnswer?: boolean | undefined;
|
|
12
|
+
isLocal?: boolean | undefined;
|
|
13
|
+
conversationList?: ConversationItem[] | undefined;
|
|
14
|
+
followUpQuestions?: string[] | undefined;
|
|
15
|
+
promptItems?: any[] | undefined;
|
|
16
|
+
input?: string | undefined;
|
|
17
|
+
inputRecognitionType?: string | undefined;
|
|
18
|
+
audioSoundState?: boolean | undefined;
|
|
19
|
+
audioSoundType?: string | undefined;
|
|
20
|
+
}>, {
|
|
21
|
+
title: string;
|
|
22
|
+
useAudio: boolean;
|
|
23
|
+
dialogBoxTheme: string;
|
|
24
|
+
placementLeft: number;
|
|
25
|
+
placementBottom: number;
|
|
26
|
+
dialogCss: undefined;
|
|
27
|
+
isGettingAnswer: boolean;
|
|
28
|
+
isLocal: boolean;
|
|
29
|
+
conversationList: () => never[];
|
|
30
|
+
followUpQuestions: () => never[];
|
|
31
|
+
promptItems: () => never[];
|
|
32
|
+
input: string;
|
|
33
|
+
inputRecognitionType: string;
|
|
34
|
+
audioSoundState: boolean;
|
|
35
|
+
audioSoundType: string;
|
|
36
|
+
}>>, {
|
|
37
|
+
scrollContainerRef: import("vue").Ref<HTMLElement | null, HTMLElement | null>;
|
|
38
|
+
waveElRef: import("vue").Ref<HTMLElement | null, HTMLElement | null>;
|
|
39
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
40
|
+
close: () => void;
|
|
41
|
+
clear: () => void;
|
|
42
|
+
send: () => void;
|
|
43
|
+
"stop-response": () => void;
|
|
44
|
+
"reset-qa": () => void;
|
|
45
|
+
"update:input": (value: string) => void;
|
|
46
|
+
"play-audio": (url: string, type: string) => void;
|
|
47
|
+
"start-recognition": () => void;
|
|
48
|
+
"stop-recognition": () => void;
|
|
49
|
+
"input-change": () => void;
|
|
50
|
+
"prompt-click": (info: any) => void;
|
|
51
|
+
"drag-position": (css: CSSProperties) => void;
|
|
52
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
53
|
+
title?: string | undefined;
|
|
54
|
+
useAudio?: boolean | undefined;
|
|
55
|
+
dialogBoxTheme?: Theme | undefined;
|
|
56
|
+
placementLeft?: number | undefined;
|
|
57
|
+
placementBottom?: number | undefined;
|
|
58
|
+
dialogCss?: CSSProperties | undefined;
|
|
59
|
+
isGettingAnswer?: boolean | undefined;
|
|
60
|
+
isLocal?: boolean | undefined;
|
|
61
|
+
conversationList?: ConversationItem[] | undefined;
|
|
62
|
+
followUpQuestions?: string[] | undefined;
|
|
63
|
+
promptItems?: any[] | undefined;
|
|
64
|
+
input?: string | undefined;
|
|
65
|
+
inputRecognitionType?: string | undefined;
|
|
66
|
+
audioSoundState?: boolean | undefined;
|
|
67
|
+
audioSoundType?: string | undefined;
|
|
68
|
+
}>, {
|
|
69
|
+
title: string;
|
|
70
|
+
useAudio: boolean;
|
|
71
|
+
dialogBoxTheme: string;
|
|
72
|
+
placementLeft: number;
|
|
73
|
+
placementBottom: number;
|
|
74
|
+
dialogCss: undefined;
|
|
75
|
+
isGettingAnswer: boolean;
|
|
76
|
+
isLocal: boolean;
|
|
77
|
+
conversationList: () => never[];
|
|
78
|
+
followUpQuestions: () => never[];
|
|
79
|
+
promptItems: () => never[];
|
|
80
|
+
input: string;
|
|
81
|
+
inputRecognitionType: string;
|
|
82
|
+
audioSoundState: boolean;
|
|
83
|
+
audioSoundType: string;
|
|
84
|
+
}>>> & Readonly<{
|
|
85
|
+
onClose?: (() => any) | undefined;
|
|
86
|
+
onClear?: (() => any) | undefined;
|
|
87
|
+
onSend?: (() => any) | undefined;
|
|
88
|
+
"onStop-response"?: (() => any) | undefined;
|
|
89
|
+
"onReset-qa"?: (() => any) | undefined;
|
|
90
|
+
"onUpdate:input"?: ((value: string) => any) | undefined;
|
|
91
|
+
"onPlay-audio"?: ((url: string, type: string) => any) | undefined;
|
|
92
|
+
"onStart-recognition"?: (() => any) | undefined;
|
|
93
|
+
"onStop-recognition"?: (() => any) | undefined;
|
|
94
|
+
"onInput-change"?: (() => any) | undefined;
|
|
95
|
+
"onPrompt-click"?: ((info: any) => any) | undefined;
|
|
96
|
+
"onDrag-position"?: ((css: CSSProperties) => any) | undefined;
|
|
97
|
+
}>, {
|
|
98
|
+
input: string;
|
|
99
|
+
dialogBoxTheme: Theme;
|
|
100
|
+
title: string;
|
|
101
|
+
placementBottom: number;
|
|
102
|
+
placementLeft: number;
|
|
103
|
+
useAudio: boolean;
|
|
104
|
+
dialogCss: CSSProperties;
|
|
105
|
+
isGettingAnswer: boolean;
|
|
106
|
+
isLocal: boolean;
|
|
107
|
+
conversationList: ConversationItem[];
|
|
108
|
+
followUpQuestions: string[];
|
|
109
|
+
promptItems: any[];
|
|
110
|
+
inputRecognitionType: string;
|
|
111
|
+
audioSoundState: boolean;
|
|
112
|
+
audioSoundType: string;
|
|
113
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
114
|
+
export default _default;
|
|
115
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
116
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
117
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
118
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
119
|
+
} : {
|
|
120
|
+
type: import('vue').PropType<T[K]>;
|
|
121
|
+
required: true;
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
type __VLS_WithDefaults<P, D> = {
|
|
125
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
126
|
+
default: D[K];
|
|
127
|
+
}> : P[K];
|
|
128
|
+
};
|
|
129
|
+
type __VLS_Prettify<T> = {
|
|
130
|
+
[K in keyof T]: T[K];
|
|
131
|
+
} & {};
|