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 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
- 封装了 QA 问答与语音问答能力,基于 Vue 3,可在业务中快速集成数字人对话体验。
6
-
7
- ## 特性
8
-
9
- - 支持文本问答与语音实时交互
10
- - 可配置对话框主题、气泡、数字人画布与样式
11
- - 内置工作流关键词触发
12
- - 统一 API 前缀便于本地代理
13
-
14
- ## 安装
15
-
16
- ```bash
17
- npm install g-ai-robot3 --save
18
- ```
19
-
20
- ## 快速开始
21
-
22
- 在页面中使用组件(最小必填配置):
23
-
24
- ```vue
25
- <script setup lang="ts">
26
- import GAiRobot3 from "g-ai-robot3";
27
- import "g-ai-robot3/dist/index.css";
28
- </script>
29
- <template>
30
- <GAiRobot3
31
- :cozeInfo="{ bot_id: '7429224296222097443' }"
32
- :apiPrefix="'/api21216'"
33
- >
34
- </GAiRobot3>
35
- </template>
36
- ```
37
-
38
- ## 高级示例:工作流与业务联动(富阳智能体使用示例)
39
-
40
- ```vue
41
- <script setup lang="ts">
42
- import GAiRobot3 from "g-ai-robot3";
43
- import "g-ai-robot3/dist/index.css";
44
- import { ref, computed } from "vue";
45
-
46
- const props = withDefaults(defineProps<{ eventFun: any[] }>(), {
47
- eventFun: () => [],
48
- });
49
- const gAiRobot3Ref = ref<InstanceType<typeof GAiRobot3>>();
50
-
51
- const aiEventFun = computed(() => {
52
- return Object.assign(
53
- [
54
- // 自定义工作流事件,场景1
55
- {
56
- keywords: ["scene1_fuyangWeather"], // keywords的值是所配置的工作流名称
57
- trigger: "before", // 固定值
58
- fun: (params: any) => {
59
- console.log("AI->富阳天气及山洪风险情况", params); // params是工作流的输出
60
- // 在此触发你的业务逻辑,如切场景、更新看板等
61
- },
62
- },
63
- // 自定义工作流事件,场景2
64
- {
65
- keywords: ["scene2"],
66
- trigger: "before",
67
- fun: () => {
68
- // 触发文档弹窗或其它路由跳转
69
- },
70
- },
71
- ],
72
- props.eventFun
73
- );
74
- });
75
- </script>
76
-
77
- <template>
78
- <GAiRobot3
79
- ref="gAiRobot3Ref"
80
- :isDebug="true"
81
- :cozeInfo="{ bot_id: '7429224296222097443' }"
82
- :apiPrefix="'/api21216'"
83
- :eventFun="aiEventFun"
84
- :canvasWidth="180"
85
- :canvasHeight="180"
86
- :videoStyle="{ width: '180px', visibility: 'hidden' }"
87
- :digitalStyle="{ width: '180px', height: '180px' }"
88
- :canvasStyle="{ width: '180px', height: '180px' }"
89
- >
90
- </GAiRobot3>
91
- <!-- :isDebug 是否开启调试模式(打印语音输出、工作流返回值),默认值为false -->
92
- <!-- :cozeInfo 智能体id,必填 -->
93
- <!-- :apiPrefix API基础路径,可通过本地代理或环境变量覆盖,默认值为/api21216 -->
94
- <!-- :canvasWidth 画布宽度,默认值为180 -->
95
- <!-- :canvasHeight 画布高度,默认值为180 -->
96
- <!-- :videoStyle 视频样式,默认值为{ width: '180px', visibility: 'hidden' } -->
97
- <!-- :digitalStyle 数字人样式,默认值为{ width: '180px', height: '180px' } -->
98
- <!-- :canvasStyle 画布样式,默认值为{ width: '180px', height: '180px' } -->
99
- </template>
100
- ```
101
-
102
- ## 前端代理与跨域示例(Vite)
103
-
104
- ```ts
105
- // vite.config.ts
106
- export default defineConfig({
107
- server: {
108
- proxy: {
109
- "/api21216": {
110
- target: "http://your-backend-host", // 默认https://model.keepsoft.net:39002
111
- changeOrigin: true,
112
- rewrite: (path) => path.replace(/^\/api21216/, ""),
113
- },
114
- },
115
- },
116
- });
117
- ```
118
-
119
- ## 必填参数(Required)
120
-
121
- | 参数 | 说明 | 类型 | 默认值 | 注意事项 |
122
- | ----------- | ------------ | ------ | ------------------- | --------------------------------------- |
123
- | `cozeInfo` | 智能体配置 | object | `{ bot_id: '...' }` | `bot_id`必须替换为实际的智能体 id |
124
- | `apiPrefix` | API 基础路径 | string | `-` | 必须配置为你的代理前缀(如`/api21216`) |
125
- | `apiPrefix` | API 基础路径 | string | `'/api21216'` | 可通过本地代理或环境变量覆盖 |
126
-
127
- 说明:其他参数均有默认值,按需覆盖即可(建议保持数字人宽高与样式一致以避免拉伸)。
128
- | `canvasHeight` | 画布高度 | number | `180` | 必须与 `videoStyle`、`digitalStyle.height` 一致 |
129
- | `videoStyle` | 视频样式 | CSSProperties | `{ width: '180px', visibility: 'hidden' }` | `width` `canvasWidth` 一致 |
130
- | `digitalStyle` | 数字人样式 | CSSProperties | `{ width: '180px', height: '180px' }` | `canvasWidth`/`canvasHeight` 保持一致 |
131
- | `canvasStyle` | 画布样式 | CSSProperties | `{ width: '180px', height: '180px' }` | `canvasWidth`/`canvasHeight` 保持一致 |
132
-
133
- ## 基础配置
134
-
135
- | 参数 | 说明 | 类型 | 默认值 |
136
- | ------------------ | ------------------------------------ | ------- | -------------------------------------- |
137
- | `isDebug` | 是否开启调试模式(打印语音输出) | boolean | `false` |
138
- | `dialogBoxTheme` | 对话框主题 | string | `'light'` |
139
- | `suspensionStyle` | 对话框高度 | string | `'33vh'` |
140
- | `showMsgBubble` | 是否显示消息气泡 | boolean | `true` |
141
- | `isExhibitionPro` | 是否为数字展厅项目 | boolean | `false` |
142
- | `isShowDialogIcon` | 是否显示对话框图标 | boolean | `false` |
143
- | `stream` | 是否启用流式传输(已废弃) | string | `'True'` |
144
- | `title` | 对话框标题 | string | `'GR水利大模型'` |
145
- | `greet` | 欢迎语(文本对话框) | string | `'您好,我是GR水利大模型智能小助手...'` |
146
- | `welcomeMessage` | 欢迎消息(气泡对话框) | string | `'您好,我是GR水利大模型智能小助手...'` |
147
- | `waitTxt` | 等待提示文本 | string | `'贵仁科技AI正在生成回答'` |
148
- | `systemName` | 系统标识 | string | `'g-ai-robot3'` |
149
- | `placementBottom` | 对话框底部距离 | number | `100` |
150
- | `placementLeft` | 对话框左侧距离 | number | `450` |
151
- | `useAudio` | 是否启用音频功能 | boolean | `true` |
152
- | `space` | 监听间隔(ms)已废弃 | number | `3000` |
153
- | `mode` | 交互模式(默认 `video`,其他已废弃) | string | `'video'` |
154
- | `modelType` | 模型类型('local' 或 'online') | string | `'online'` |
155
- | `showModelTypeToggle` | 显示模型类型切换开关 | boolean | `false` |
156
-
157
-
158
- ## API 配置
159
-
160
- | 参数 | 说明 | 类型 | 默认值 |
161
- | ----------------------- | ----------------------------- | ------ | ------------------------------------------ |
162
- | `apiPrefix` | API 基础路径(可自定义跨域) | string | `'/api21216'` |
163
- | `createConversationUrl` | 创建会话接口 | string | `${apiPrefix}/chatGlm/createConversation` |
164
- | `wakeupAudio` | 音频打标接口 | string | `${apiPrefix}/asr/saveWakeUpAudio` |
165
- | `interrupt` | 中断请求接口 | string | `${apiPrefix}/chatGlm/cancelChat` |
166
- | `qaServer` | 问答服务接口 | string | `${apiPrefix}/chatGlm/searchTextNew` |
167
- | `audioWs` | 语音 WebSocket 服务 | string | `wss://model.keepsoft.net:39002/funasrWs` |
168
- | `voiceprintWs` | 声纹识别 WebSocket 服务 | string | `wss://model.keepsoft.net:39002/speakerWs` |
169
- | `instructWs` | 指令 WebSocket 服务(已废弃) | string | `wss://model.keepsoft.net:39002/commandWs` |
170
-
171
- ## 数字人配置
172
-
173
- | 参数 | 说明 | 类型 | 默认值 |
174
- | --------------------- | -------------- | ------------- | ------------------------------------------ |
175
- | `videoStyle` | 视频样式 | CSSProperties | `{ width: '180px', visibility: 'hidden' }` |
176
- | `digitalStyle` | 数字人样式 | CSSProperties | `{ width: '180px', height: '180px' }` |
177
- | `bubbleStyle` | 气泡样式 | CSSProperties | `{ width: '30%', height: '30%' }` |
178
- | `canvasWidth` | 画布宽度 | number | `180` |
179
- | `canvasHeight` | 画布高度 | number | `180` |
180
- | `canvasCartoonWidth` | 卡通形象宽度 | number | `200` |
181
- | `canvasCartoonHeight` | 卡通形象高度 | number | `320` |
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
+ } & {};