@blueking/ai-blueking 0.1.7 → 0.2.0-beta.10
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 +102 -64
- package/dist/ai-blueking.vue.d.ts +8 -2
- package/dist/components/render-content.vue.d.ts +11 -2
- package/dist/components/render-stop.vue.d.ts +18 -1
- package/dist/components/render-time.vue.d.ts +16 -0
- package/dist/lang/index.d.ts +14 -1
- package/dist/types/enum.d.ts +5 -0
- package/dist/types/index.d.ts +3 -2
- package/dist/util/index.d.ts +7 -0
- package/dist/vue2/index.es.min.js +6583 -6357
- package/dist/vue2/index.iife.min.js +42 -43
- package/dist/vue2/index.umd.min.js +34 -35
- package/dist/vue2/style.css +1 -1
- package/dist/vue2.d.ts +1 -1
- package/dist/vue3/index.es.min.js +3964 -3749
- package/dist/vue3/index.iife.min.js +33 -34
- package/dist/vue3/index.umd.min.js +17 -18
- package/dist/vue3/style.css +1 -1
- package/dist/vue3.d.ts +1 -1
- package/package.json +1 -2
package/README.md
CHANGED
|
@@ -17,13 +17,13 @@ npm i @blueking/ai-blueking
|
|
|
17
17
|
:messages="messages"
|
|
18
18
|
@clear="handleClear"
|
|
19
19
|
@send="handleSend"
|
|
20
|
+
@stop="handleStop"
|
|
20
21
|
/>
|
|
21
22
|
</template>
|
|
22
23
|
|
|
23
24
|
<script lang="ts" setup>
|
|
24
25
|
import { ref } from 'vue';
|
|
25
|
-
import AIBlueking from '@blueking/ai-blueking';
|
|
26
|
-
import { ChatHelper } from '@blueking/ai-blueking/dist/chat-helper';
|
|
26
|
+
import AIBlueking, { ChatHelper, RoleType, MessageStatus } from '@blueking/ai-blueking';
|
|
27
27
|
import '@blueking/ai-blueking/dist/vue3/style.css';
|
|
28
28
|
|
|
29
29
|
const loading = ref(false);
|
|
@@ -33,20 +33,20 @@ npm i @blueking/ai-blueking
|
|
|
33
33
|
const handleStart = (id: number | string) => {
|
|
34
34
|
loading.value = true;
|
|
35
35
|
messages.value.push({
|
|
36
|
-
role:
|
|
36
|
+
role: RoleType.Assistant,
|
|
37
37
|
content: '内容正在生成中...',
|
|
38
|
-
status:
|
|
38
|
+
status: MessageStatus.Loading,
|
|
39
39
|
});
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
// 接收消息
|
|
43
43
|
const handleReceiveMessage = (message: string, id: number | string) => {
|
|
44
44
|
const currentMessage = messages.value.at(-1);
|
|
45
|
-
if (currentMessage.status ===
|
|
45
|
+
if (currentMessage.status === MessageStatus.Loading) {
|
|
46
46
|
// 如果是loading状态,直接覆盖
|
|
47
47
|
currentMessage.content = message;
|
|
48
|
-
currentMessage.status =
|
|
49
|
-
} else if (currentMessage.status ===
|
|
48
|
+
currentMessage.status = MessageStatus.Success;
|
|
49
|
+
} else if (currentMessage.status === MessageStatus.Success) {
|
|
50
50
|
// 如果是后续消息,就追加消息
|
|
51
51
|
currentMessage.content += message;
|
|
52
52
|
}
|
|
@@ -57,13 +57,14 @@ npm i @blueking/ai-blueking
|
|
|
57
57
|
loading.value = false;
|
|
58
58
|
const currentMessage = messages.value.at(-1);
|
|
59
59
|
// loading 情况下终止
|
|
60
|
-
if (currentMessage.status ===
|
|
60
|
+
if (currentMessage.status === MessageStatus.Loading) {
|
|
61
61
|
currentMessage.content = '聊天内容已中断';
|
|
62
|
+
currentMessage.status = MessageStatus.Error;
|
|
62
63
|
}
|
|
63
64
|
};
|
|
64
65
|
|
|
65
66
|
// 错误处理
|
|
66
|
-
const handleError = (message: string, code: string, id: number | string) => {
|
|
67
|
+
const handleError = (message: string, code: string | number, id: number | string) => {
|
|
67
68
|
if (message.includes('user authentication failed')) {
|
|
68
69
|
// 未登录,跳转登录
|
|
69
70
|
const loginUrl = new URL(process.env.BK_LOGIN_URL);
|
|
@@ -72,13 +73,12 @@ npm i @blueking/ai-blueking
|
|
|
72
73
|
} else {
|
|
73
74
|
// 处理错误消息
|
|
74
75
|
const currentMessage = messages.value.at(-1);
|
|
75
|
-
currentMessage.status =
|
|
76
|
+
currentMessage.status = MessageStatus.Error;
|
|
76
77
|
currentMessage.content = message;
|
|
77
78
|
loading.value = false;
|
|
78
79
|
}
|
|
79
80
|
};
|
|
80
81
|
|
|
81
|
-
// 需要将 <网关名> 替换成插件部署后生成的网关名
|
|
82
82
|
const prefix = process.env.BK_API_URL_TMPL.replace('{api_name}', '<网关名>').replace('http', 'https');
|
|
83
83
|
const chatHelper = new ChatHelper(
|
|
84
84
|
`${prefix}/prod/bk_plugin/plugin_api/assistant/`,
|
|
@@ -113,6 +113,11 @@ npm i @blueking/ai-blueking
|
|
|
113
113
|
1,
|
|
114
114
|
);
|
|
115
115
|
};
|
|
116
|
+
|
|
117
|
+
// 暂停聊天
|
|
118
|
+
const handleStop = () => {
|
|
119
|
+
chatHelper.stop(1);
|
|
120
|
+
};
|
|
116
121
|
</script>
|
|
117
122
|
```
|
|
118
123
|
|
|
@@ -120,63 +125,67 @@ npm i @blueking/ai-blueking
|
|
|
120
125
|
|
|
121
126
|
```vue
|
|
122
127
|
<template>
|
|
123
|
-
<
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
128
|
+
<AIBlueking
|
|
129
|
+
:background="background"
|
|
130
|
+
:head-background="headBackground"
|
|
131
|
+
:loading="loading"
|
|
132
|
+
:messages="messages"
|
|
133
|
+
:position-limit="positionLimit"
|
|
134
|
+
:prompts="prompts"
|
|
135
|
+
:scroll-loading="scrollLoading"
|
|
136
|
+
:scroll-loading-end="scrollLoadingEnd"
|
|
137
|
+
:size-limit="sizeLimit"
|
|
138
|
+
:start-position="startPosition"
|
|
139
|
+
@choose-prompt="handleChoosePrompt"
|
|
140
|
+
@clear="handleClear"
|
|
141
|
+
@close="handleClose"
|
|
142
|
+
@scroll-load="handleScrollLoad"
|
|
143
|
+
@send="handleSend"
|
|
144
|
+
@stop="handleStop"
|
|
145
|
+
/>
|
|
140
146
|
</template>
|
|
141
147
|
<script setup lang="ts">
|
|
142
148
|
import { ref } from 'vue';
|
|
143
149
|
|
|
144
|
-
import AIBlueking from '@blueking/ai-blueking';
|
|
150
|
+
import AIBlueking, { type IPrompt, type IMessage, RoleType, MessageStatus } from '@blueking/ai-blueking';
|
|
151
|
+
|
|
145
152
|
import '@blueking/ai-blueking/dist/vue3/style.css';
|
|
146
153
|
|
|
147
|
-
//
|
|
148
|
-
const messages = [
|
|
149
|
-
{
|
|
150
|
-
content: '你好呀',
|
|
151
|
-
role: 'assistant',
|
|
152
|
-
},
|
|
154
|
+
// 展示的消息,其中 time 可以不传
|
|
155
|
+
const messages = ref<IMessage[]>([
|
|
153
156
|
{
|
|
154
157
|
content: '1+1=?',
|
|
155
|
-
|
|
158
|
+
time: '2023-08-12 10:28',
|
|
159
|
+
role: RoleType.User,
|
|
156
160
|
},
|
|
157
161
|
{
|
|
158
162
|
content: '1+1=3',
|
|
159
|
-
|
|
160
|
-
|
|
163
|
+
time: '2024-08-07 14:29',
|
|
164
|
+
role: RoleType.Assistant,
|
|
165
|
+
status: MessageStatus.Error,
|
|
161
166
|
},
|
|
162
167
|
{
|
|
163
168
|
content: '不对',
|
|
164
|
-
|
|
169
|
+
time: '2024-08-12 09:29',
|
|
170
|
+
role: RoleType.User,
|
|
165
171
|
},
|
|
166
172
|
{
|
|
167
173
|
content: '1+1=2',
|
|
168
|
-
|
|
169
|
-
|
|
174
|
+
time: '2024-08-12 09:31',
|
|
175
|
+
role: RoleType.Assistant,
|
|
176
|
+
status: MessageStatus.Loading,
|
|
170
177
|
},
|
|
171
178
|
{
|
|
172
179
|
content: '对了',
|
|
173
|
-
|
|
180
|
+
time: '2024-08-13 10:20',
|
|
181
|
+
role: RoleType.User,
|
|
174
182
|
},
|
|
175
183
|
{
|
|
176
184
|
content: '好的,任务已完成',
|
|
177
|
-
|
|
185
|
+
time: '2024-08-13 10:23',
|
|
186
|
+
role: RoleType.Assistant,
|
|
178
187
|
},
|
|
179
|
-
];
|
|
188
|
+
]);
|
|
180
189
|
// 内置 prompt
|
|
181
190
|
const prompts = [
|
|
182
191
|
{
|
|
@@ -214,6 +223,9 @@ npm i @blueking/ai-blueking
|
|
|
214
223
|
left: window.innerWidth - 400,
|
|
215
224
|
right: 0,
|
|
216
225
|
};
|
|
226
|
+
// 向上滚动加载
|
|
227
|
+
const scrollLoading = ref(false);
|
|
228
|
+
const scrollLoadingEnd = ref(false);
|
|
217
229
|
|
|
218
230
|
const handleClear = () => {
|
|
219
231
|
console.log('trigger clear');
|
|
@@ -223,15 +235,39 @@ npm i @blueking/ai-blueking
|
|
|
223
235
|
console.log('trigger send', val);
|
|
224
236
|
};
|
|
225
237
|
|
|
226
|
-
const
|
|
227
|
-
console.log('trigger
|
|
238
|
+
const handleStop = () => {
|
|
239
|
+
console.log('trigger stop');
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
const handleScrollLoad = () => {
|
|
243
|
+
scrollLoading.value = true;
|
|
244
|
+
setTimeout(() => {
|
|
245
|
+
// 模拟异步请求
|
|
246
|
+
messages.value.unshift(
|
|
247
|
+
...[
|
|
248
|
+
{
|
|
249
|
+
content: '1+1=?',
|
|
250
|
+
time: '2023-08-12 9:28',
|
|
251
|
+
role: RoleType.User,
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
content: '2',
|
|
255
|
+
time: '2023-08-12 9:30',
|
|
256
|
+
role: RoleType.Assistant,
|
|
257
|
+
},
|
|
258
|
+
],
|
|
259
|
+
);
|
|
260
|
+
// 设置状态
|
|
261
|
+
scrollLoading.value = false;
|
|
262
|
+
scrollLoadingEnd.value = true;
|
|
263
|
+
}, 1000);
|
|
228
264
|
};
|
|
229
265
|
|
|
230
266
|
const handleClose = () => {
|
|
231
267
|
console.log('trigger close');
|
|
232
268
|
};
|
|
233
269
|
|
|
234
|
-
const handleChoosePrompt = prompt => {
|
|
270
|
+
const handleChoosePrompt = (prompt: IPrompt) => {
|
|
235
271
|
console.log('choose prompt', prompt);
|
|
236
272
|
};
|
|
237
273
|
</script>
|
|
@@ -247,23 +283,22 @@ npm i @blueking/bkui-library
|
|
|
247
283
|
|
|
248
284
|
```vue
|
|
249
285
|
<template>
|
|
250
|
-
<
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
</div>
|
|
286
|
+
<AIBlueking
|
|
287
|
+
:background="background"
|
|
288
|
+
:head-background="headBackground"
|
|
289
|
+
:loading="loading"
|
|
290
|
+
:messages="messages"
|
|
291
|
+
:position-limit="positionLimit"
|
|
292
|
+
:prompts="prompts"
|
|
293
|
+
:size-limit="sizeLimit"
|
|
294
|
+
:start-position="startPosition"
|
|
295
|
+
@choose-prompt="handleChoosePrompt"
|
|
296
|
+
@clear="handleClear"
|
|
297
|
+
@close="handleClose"
|
|
298
|
+
@send="handleSend"
|
|
299
|
+
@scroll="handleScroll"
|
|
300
|
+
@stop="handleStop"
|
|
301
|
+
/>
|
|
267
302
|
</template>
|
|
268
303
|
<script lang="ts">
|
|
269
304
|
import { ref } from 'vue';
|
|
@@ -356,6 +391,9 @@ npm i @blueking/bkui-library
|
|
|
356
391
|
handleScroll(event: Event) {
|
|
357
392
|
console.log('trigger scroll', event);
|
|
358
393
|
},
|
|
394
|
+
handleStop() {
|
|
395
|
+
console.log('trigger stop');
|
|
396
|
+
},
|
|
359
397
|
},
|
|
360
398
|
};
|
|
361
399
|
</script>
|
|
@@ -10,12 +10,15 @@ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<{
|
|
|
10
10
|
startPosition?: IStartPosition | undefined;
|
|
11
11
|
userPhoto?: string | undefined;
|
|
12
12
|
logo?: string | undefined;
|
|
13
|
+
scrollLoading?: boolean | undefined;
|
|
14
|
+
scrollLoadingEnd?: boolean | undefined;
|
|
13
15
|
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
14
16
|
close: () => void;
|
|
17
|
+
stop: () => void;
|
|
15
18
|
clear: () => void;
|
|
19
|
+
"scroll-load": () => void;
|
|
16
20
|
send: (val: string) => void;
|
|
17
21
|
"choose-prompt": (prompt: IPrompt) => void;
|
|
18
|
-
scroll: (data: Event) => void;
|
|
19
22
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<{
|
|
20
23
|
messages: IMessage[];
|
|
21
24
|
prompts?: IPrompt[] | undefined;
|
|
@@ -27,11 +30,14 @@ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<{
|
|
|
27
30
|
startPosition?: IStartPosition | undefined;
|
|
28
31
|
userPhoto?: string | undefined;
|
|
29
32
|
logo?: string | undefined;
|
|
33
|
+
scrollLoading?: boolean | undefined;
|
|
34
|
+
scrollLoadingEnd?: boolean | undefined;
|
|
30
35
|
}>>> & {
|
|
31
|
-
onScroll?: ((data: Event) => any) | undefined;
|
|
32
36
|
"onChoose-prompt"?: ((prompt: IPrompt) => any) | undefined;
|
|
33
37
|
onClear?: (() => any) | undefined;
|
|
38
|
+
onStop?: (() => any) | undefined;
|
|
34
39
|
onSend?: ((val: string) => any) | undefined;
|
|
40
|
+
"onScroll-load"?: (() => any) | undefined;
|
|
35
41
|
onClose?: (() => any) | undefined;
|
|
36
42
|
}, {}, {}>;
|
|
37
43
|
export default _default;
|
|
@@ -5,26 +5,35 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
5
5
|
loading?: boolean | undefined;
|
|
6
6
|
background?: string | undefined;
|
|
7
7
|
userPhoto?: string | undefined;
|
|
8
|
+
scrollLoading?: boolean | undefined;
|
|
9
|
+
scrollLoadingEnd?: boolean | undefined;
|
|
8
10
|
}>, {
|
|
9
11
|
background: string;
|
|
12
|
+
scrollLoadingEnd: boolean;
|
|
10
13
|
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
11
14
|
send: (userInput: string) => void;
|
|
12
15
|
"choose-prompt": (prompt: IPrompt) => void;
|
|
13
|
-
|
|
16
|
+
stop: () => void;
|
|
17
|
+
"scroll-load": () => void;
|
|
14
18
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<{
|
|
15
19
|
messages: IMessage[];
|
|
16
20
|
prompts?: IPrompt[] | undefined;
|
|
17
21
|
loading?: boolean | undefined;
|
|
18
22
|
background?: string | undefined;
|
|
19
23
|
userPhoto?: string | undefined;
|
|
24
|
+
scrollLoading?: boolean | undefined;
|
|
25
|
+
scrollLoadingEnd?: boolean | undefined;
|
|
20
26
|
}>, {
|
|
21
27
|
background: string;
|
|
28
|
+
scrollLoadingEnd: boolean;
|
|
22
29
|
}>>> & {
|
|
23
|
-
onScroll?: ((data: Event) => any) | undefined;
|
|
24
30
|
"onChoose-prompt"?: ((prompt: IPrompt) => any) | undefined;
|
|
31
|
+
onStop?: (() => any) | undefined;
|
|
25
32
|
onSend?: ((userInput: string) => any) | undefined;
|
|
33
|
+
"onScroll-load"?: (() => any) | undefined;
|
|
26
34
|
}, {
|
|
27
35
|
background: string;
|
|
36
|
+
scrollLoadingEnd: boolean;
|
|
28
37
|
}, {}>;
|
|
29
38
|
export default _default;
|
|
30
39
|
type __VLS_WithDefaults<P, D> = {
|
|
@@ -1,2 +1,19 @@
|
|
|
1
|
-
declare const _default: import("vue").DefineComponent<
|
|
1
|
+
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<{
|
|
2
|
+
isShow?: boolean | undefined;
|
|
3
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
4
|
+
stop: () => void;
|
|
5
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<{
|
|
6
|
+
isShow?: boolean | undefined;
|
|
7
|
+
}>>> & {
|
|
8
|
+
onStop?: (() => any) | undefined;
|
|
9
|
+
}, {}, {}>;
|
|
2
10
|
export default _default;
|
|
11
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
12
|
+
type __VLS_TypePropsToOption<T> = {
|
|
13
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
14
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
15
|
+
} : {
|
|
16
|
+
type: import('vue').PropType<T[K]>;
|
|
17
|
+
required: true;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { IMessage } from '../types';
|
|
2
|
+
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<{
|
|
3
|
+
message: IMessage;
|
|
4
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<{
|
|
5
|
+
message: IMessage;
|
|
6
|
+
}>>>, {}, {}>;
|
|
7
|
+
export default _default;
|
|
8
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
9
|
+
type __VLS_TypePropsToOption<T> = {
|
|
10
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
11
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
12
|
+
} : {
|
|
13
|
+
type: import('vue').PropType<T[K]>;
|
|
14
|
+
required: true;
|
|
15
|
+
};
|
|
16
|
+
};
|
package/dist/lang/index.d.ts
CHANGED
|
@@ -9,5 +9,18 @@ export declare const langData: {
|
|
|
9
9
|
readonly 发送: "Send";
|
|
10
10
|
readonly '\u60A8\u53EF\u4EE5\u952E\u5165 \u201C/\u201D \u67E5\u770B\u66F4\u591APrompt': "You can type \"/\" to see more Prompts";
|
|
11
11
|
readonly 请输入: "Please input";
|
|
12
|
+
readonly 返回最新: "Scroll to bottom";
|
|
13
|
+
readonly 终止生成: "Stop";
|
|
14
|
+
readonly 向上滚动加载更多记录: "Scroll up to load more records";
|
|
15
|
+
readonly 日: "sunday";
|
|
16
|
+
readonly 一: "monday";
|
|
17
|
+
readonly 二: "tuesday";
|
|
18
|
+
readonly 三: "wednesday";
|
|
19
|
+
readonly 四: "thursday";
|
|
20
|
+
readonly 五: "friday";
|
|
21
|
+
readonly 六: "saturday";
|
|
22
|
+
readonly 昨天: "yesterday";
|
|
23
|
+
readonly 本周: "this week";
|
|
24
|
+
readonly 上周: "last week";
|
|
12
25
|
};
|
|
13
|
-
export declare const t: (key: keyof typeof langData) => "BK GPT" | "shrink down" | "expand upward" | "Empty chat records" | "close" | "The content is being executed, please enter it again after the execution is completed." | "Send" | "You can type \"/\" to see more Prompts" | "Please input" | "小鲸" | "向下收缩" | "向上扩展" | "清空聊天记录" | "关闭" | "内容正在执行中,请执行完成后再输入" | "发送" | "您可以键入 “/” 查看更多Prompt" | "请输入";
|
|
26
|
+
export declare const t: (key: keyof typeof langData) => "BK GPT" | "shrink down" | "expand upward" | "Empty chat records" | "close" | "The content is being executed, please enter it again after the execution is completed." | "Send" | "You can type \"/\" to see more Prompts" | "Please input" | "Scroll to bottom" | "Stop" | "Scroll up to load more records" | "sunday" | "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday" | "yesterday" | "this week" | "last week" | "小鲸" | "向下收缩" | "向上扩展" | "清空聊天记录" | "关闭" | "内容正在执行中,请执行完成后再输入" | "发送" | "您可以键入 “/” 查看更多Prompt" | "请输入" | "返回最新" | "终止生成" | "向上滚动加载更多记录" | "日" | "一" | "二" | "三" | "四" | "五" | "六" | "昨天" | "本周" | "上周";
|
package/dist/types/enum.d.ts
CHANGED
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { RoleType } from './enum';
|
|
1
|
+
import { RoleType, MessageStatus } from './enum';
|
|
2
2
|
export interface IMessage extends IChatHistory {
|
|
3
|
-
status?:
|
|
3
|
+
status?: MessageStatus;
|
|
4
|
+
time?: number | string;
|
|
4
5
|
}
|
|
5
6
|
export interface IPrompt {
|
|
6
7
|
id: number | string;
|
package/dist/util/index.d.ts
CHANGED
|
@@ -9,3 +9,10 @@ export declare const getCookieByName: (name: string) => string;
|
|
|
9
9
|
* @returns
|
|
10
10
|
*/
|
|
11
11
|
export declare const isJSON: (str: string) => boolean;
|
|
12
|
+
/**
|
|
13
|
+
* 节流,每隔一段时间执行
|
|
14
|
+
* @param {*} fn 需要执行的函数
|
|
15
|
+
* @param {*} delay 延迟时间,默认200
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
18
|
+
export declare const throttle: <T>(fn: (t: T) => void, delay?: number) => (t: T) => false | undefined;
|