@zero-library/chat-agent 2.1.10 → 2.1.12
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/dist/index.cjs.js +209 -118
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +36 -28
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +279 -14
- package/dist/index.d.ts +279 -14
- package/dist/index.esm.js +209 -118
- package/dist/index.esm.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,156 @@
|
|
|
1
|
-
import { RenderControl, UserInfo } from '@zero-library/common';
|
|
1
|
+
import { createRequest, RenderControl, UserInfo } from '@zero-library/common';
|
|
2
2
|
import { ButtonProps, ThemeConfig } from 'antd';
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
import { Conversation, BubbleProps } from '@ant-design/x';
|
|
5
5
|
export * from '@ant-design/x';
|
|
6
6
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
7
7
|
|
|
8
|
+
interface ConversationsQuery extends PageReq {
|
|
9
|
+
businessId?: string;
|
|
10
|
+
businessType?: number;
|
|
11
|
+
targetId: string;
|
|
12
|
+
targetType: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* 会话成员返回模型
|
|
16
|
+
*/
|
|
17
|
+
interface ConversationMember {
|
|
18
|
+
/**
|
|
19
|
+
* Conversationid,会话ID
|
|
20
|
+
*/
|
|
21
|
+
conversationId: string;
|
|
22
|
+
/**
|
|
23
|
+
* Id,会话成员表ID
|
|
24
|
+
*/
|
|
25
|
+
id: string;
|
|
26
|
+
/**
|
|
27
|
+
* Jointime,加入时间
|
|
28
|
+
*/
|
|
29
|
+
joinTime: Date;
|
|
30
|
+
/**
|
|
31
|
+
* Memberavatar,成员头像
|
|
32
|
+
*/
|
|
33
|
+
memberAvatar: string;
|
|
34
|
+
/**
|
|
35
|
+
* Memberid,成员ID
|
|
36
|
+
*/
|
|
37
|
+
memberId: string;
|
|
38
|
+
/**
|
|
39
|
+
* Membername,成员名称
|
|
40
|
+
*/
|
|
41
|
+
memberName: string;
|
|
42
|
+
/**
|
|
43
|
+
* Membertype,成员类型
|
|
44
|
+
*/
|
|
45
|
+
memberType: number;
|
|
46
|
+
/**
|
|
47
|
+
* Orgid,机构ID
|
|
48
|
+
*/
|
|
49
|
+
orgId: number;
|
|
50
|
+
/**
|
|
51
|
+
* Orgname,机构名称
|
|
52
|
+
*/
|
|
53
|
+
orgName: string;
|
|
54
|
+
}
|
|
55
|
+
interface ConversationType {
|
|
56
|
+
/**
|
|
57
|
+
* Agentid,智能体 ID
|
|
58
|
+
*/
|
|
59
|
+
agentId: string;
|
|
60
|
+
/**
|
|
61
|
+
* Agentname,智能体名称
|
|
62
|
+
*/
|
|
63
|
+
agentName: string;
|
|
64
|
+
/**
|
|
65
|
+
* Id,会话 ID
|
|
66
|
+
*/
|
|
67
|
+
id: string;
|
|
68
|
+
/**
|
|
69
|
+
* Logourl,头像路径
|
|
70
|
+
*/
|
|
71
|
+
logoUrl: string;
|
|
72
|
+
/**
|
|
73
|
+
* Members,会话成员
|
|
74
|
+
*/
|
|
75
|
+
members?: ConversationMember[];
|
|
76
|
+
/**
|
|
77
|
+
* Selected,当前选择的会话
|
|
78
|
+
*/
|
|
79
|
+
selected: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* State,会话状态 1-正常 2-结束
|
|
82
|
+
*/
|
|
83
|
+
state: number;
|
|
84
|
+
/**
|
|
85
|
+
* Title,会话标题
|
|
86
|
+
*/
|
|
87
|
+
title: string;
|
|
88
|
+
/**
|
|
89
|
+
* Unreadcount,当前用户未读消息数
|
|
90
|
+
*/
|
|
91
|
+
unreadCount: number;
|
|
92
|
+
/**
|
|
93
|
+
* Updatetime,更新时间
|
|
94
|
+
*/
|
|
95
|
+
updateTime: number;
|
|
96
|
+
}
|
|
97
|
+
interface ConversationCreate {
|
|
98
|
+
/**
|
|
99
|
+
* Businessdata,业务扩展参数,非必填
|
|
100
|
+
*/
|
|
101
|
+
businessData?: string;
|
|
102
|
+
/**
|
|
103
|
+
* Businessid,业务数据唯一ID,非必填
|
|
104
|
+
*/
|
|
105
|
+
businessId?: string;
|
|
106
|
+
/**
|
|
107
|
+
* Businesstype,业务类型,非必填。1-风控;2-弹窗
|
|
108
|
+
*/
|
|
109
|
+
businessType?: number;
|
|
110
|
+
/**
|
|
111
|
+
* Receiverid,接收者ID
|
|
112
|
+
*/
|
|
113
|
+
receiverId: string;
|
|
114
|
+
/**
|
|
115
|
+
* Receivertype,接收者类型:1-用户 2-专家 3-Agent 4-税协
|
|
116
|
+
*/
|
|
117
|
+
receiverType: number;
|
|
118
|
+
/**
|
|
119
|
+
* Source,会话来源: 1-罗拉-APP; 2-罗拉-pc端; 3-合作伙伴端 4-税协 5-罗拉-cube 6-api
|
|
120
|
+
*/
|
|
121
|
+
source: number;
|
|
122
|
+
/**
|
|
123
|
+
* Type,会话类型: 1-对话; 2-工具
|
|
124
|
+
*/
|
|
125
|
+
type: number;
|
|
126
|
+
}
|
|
127
|
+
interface ConversationRecentUpdate extends ConversationRecentQuery {
|
|
128
|
+
/**
|
|
129
|
+
* Conversationid,会话ID
|
|
130
|
+
*/
|
|
131
|
+
conversationId: string;
|
|
132
|
+
}
|
|
133
|
+
interface ConversationRecentQuery {
|
|
134
|
+
/**
|
|
135
|
+
* Businessid,业务数据唯一ID,非必填
|
|
136
|
+
*/
|
|
137
|
+
businessId?: string;
|
|
138
|
+
/**
|
|
139
|
+
* Businesstype,业务类型,非必填。1-风控;2-弹窗
|
|
140
|
+
*/
|
|
141
|
+
businessType?: number;
|
|
142
|
+
/**
|
|
143
|
+
* Receiverid,接收者ID
|
|
144
|
+
*/
|
|
145
|
+
receiverId: string;
|
|
146
|
+
/**
|
|
147
|
+
* Receivertype,接收者类型:1-用户 2-专家 3-Agent 4-税协
|
|
148
|
+
*/
|
|
149
|
+
receiverType: number;
|
|
150
|
+
}
|
|
151
|
+
interface conversationMessagesQuery extends PageReq {
|
|
152
|
+
conversationId: string;
|
|
153
|
+
}
|
|
8
154
|
interface InputFile {
|
|
9
155
|
/**
|
|
10
156
|
* Content,文件内容
|
|
@@ -39,7 +185,7 @@ interface MessageQuoteMsg {
|
|
|
39
185
|
/**
|
|
40
186
|
* Msgfiles,附件文件列表
|
|
41
187
|
*/
|
|
42
|
-
msgFiles?: InputFile;
|
|
188
|
+
msgFiles?: InputFile[];
|
|
43
189
|
}
|
|
44
190
|
interface MessageSender {
|
|
45
191
|
/**
|
|
@@ -95,6 +241,24 @@ interface ConversationMessage {
|
|
|
95
241
|
*/
|
|
96
242
|
stopFlag?: boolean;
|
|
97
243
|
}
|
|
244
|
+
interface FeedbackUpdate {
|
|
245
|
+
/**
|
|
246
|
+
* Conversationid,会话ID
|
|
247
|
+
*/
|
|
248
|
+
conversationId: string;
|
|
249
|
+
/**
|
|
250
|
+
* Id,消息ID
|
|
251
|
+
*/
|
|
252
|
+
id: string;
|
|
253
|
+
/**
|
|
254
|
+
* Msgfeedback,反馈类型:1-赞,2-踩
|
|
255
|
+
*/
|
|
256
|
+
msgFeedback: number;
|
|
257
|
+
/**
|
|
258
|
+
* Msgfeedbackcontent,消息反馈内容
|
|
259
|
+
*/
|
|
260
|
+
msgFeedbackContent?: string;
|
|
261
|
+
}
|
|
98
262
|
interface ConversationMessageSend {
|
|
99
263
|
/**
|
|
100
264
|
* Conversationid,会话 ID
|
|
@@ -241,9 +405,101 @@ interface AgentInfo {
|
|
|
241
405
|
logo: string;
|
|
242
406
|
feature?: string;
|
|
243
407
|
}
|
|
408
|
+
interface AgentCharacter {
|
|
409
|
+
/**
|
|
410
|
+
* Agentid,智能体ID
|
|
411
|
+
*/
|
|
412
|
+
agentId: number;
|
|
413
|
+
/**
|
|
414
|
+
* Charactername,性格名称
|
|
415
|
+
*/
|
|
416
|
+
characterName: string;
|
|
417
|
+
/**
|
|
418
|
+
* Detaillevel,详细程度:1-10
|
|
419
|
+
*/
|
|
420
|
+
detailLevel: number;
|
|
421
|
+
/**
|
|
422
|
+
* Humorlevel,幽默程度:1-10
|
|
423
|
+
*/
|
|
424
|
+
humorLevel: number;
|
|
425
|
+
/**
|
|
426
|
+
* Id,id
|
|
427
|
+
*/
|
|
428
|
+
id: number;
|
|
429
|
+
/**
|
|
430
|
+
* Logo,头像,存储图片路径
|
|
431
|
+
*/
|
|
432
|
+
logo: string;
|
|
433
|
+
/**
|
|
434
|
+
* Professionallevel,专业程度:1-10
|
|
435
|
+
*/
|
|
436
|
+
professionalLevel: number;
|
|
437
|
+
/**
|
|
438
|
+
* Selected,是否已选择
|
|
439
|
+
*/
|
|
440
|
+
selected: boolean;
|
|
441
|
+
/**
|
|
442
|
+
* Sex,性别:1-男,2-女
|
|
443
|
+
*/
|
|
444
|
+
sex: number;
|
|
445
|
+
}
|
|
446
|
+
declare const createChatService: (request: ReturnType<typeof createRequest>) => {
|
|
447
|
+
conversationsQuery: (params: ConversationsQuery) => Promise<R<PageRes<ConversationType>>>;
|
|
448
|
+
conversationCreate: (params: ConversationCreate) => Promise<R<string>>;
|
|
449
|
+
conversationDelete: (conversationId: string) => Promise<R<null>>;
|
|
450
|
+
conversationRecentUpdate: (params: ConversationRecentUpdate) => Promise<R<boolean>>;
|
|
451
|
+
conversationRecentQuery: (params: ConversationRecentQuery) => Promise<R<string>>;
|
|
452
|
+
conversationMessagesQuery: (params: conversationMessagesQuery) => Promise<R<PageRes<ConversationMessage>>>;
|
|
453
|
+
conversationMessageRead: (conversationId: ConversationType["id"]) => Promise<R<boolean>>;
|
|
454
|
+
feedbackUpdate: (params: FeedbackUpdate) => Promise<R<null>>;
|
|
455
|
+
messageSuggestedQuery: (msgId: ConversationMessage["id"], maxCount?: number) => Promise<R<string[]>>;
|
|
456
|
+
conversationMemberQuery: (conversationId: ConversationType["id"]) => Promise<R<ConversationMember[]>>;
|
|
457
|
+
conversationStateUpdate: (conversationId: ConversationType["id"], state: ConversationType["state"]) => Promise<R<boolean>>;
|
|
458
|
+
conversationMessageSend: (params: ConversationMessageSend) => Promise<R<void>>;
|
|
459
|
+
conversationStop: (conversationId: ConversationType["id"]) => Promise<R<void>>;
|
|
460
|
+
agentInfoQuery: (agentId: AgentInfo["id"]) => Promise<R<AgentInfo>>;
|
|
461
|
+
agentCharacterQuery: (agentId: AgentInfo["id"]) => Promise<R<AgentCharacter[]>>;
|
|
462
|
+
agentCharacterSelect: (agentId: AgentInfo["id"], characterId: AgentCharacter["id"]) => Promise<R<null>>;
|
|
463
|
+
fileUpload: (formData: FormData) => Promise<R<InputFile>>;
|
|
464
|
+
};
|
|
244
465
|
|
|
245
466
|
type ConversationMemberEnum = 'agent' | 'user' | 'other';
|
|
246
467
|
|
|
468
|
+
interface DocType {
|
|
469
|
+
/**
|
|
470
|
+
* 内容
|
|
471
|
+
*/
|
|
472
|
+
content: string;
|
|
473
|
+
/**
|
|
474
|
+
* 文档ID
|
|
475
|
+
*/
|
|
476
|
+
docId: string;
|
|
477
|
+
/**
|
|
478
|
+
* 关键字
|
|
479
|
+
*/
|
|
480
|
+
keywords?: string[];
|
|
481
|
+
/**
|
|
482
|
+
* 位置
|
|
483
|
+
*/
|
|
484
|
+
position?: number;
|
|
485
|
+
/**
|
|
486
|
+
* 分段ID
|
|
487
|
+
*/
|
|
488
|
+
sid?: string;
|
|
489
|
+
/**
|
|
490
|
+
* 令牌数
|
|
491
|
+
*/
|
|
492
|
+
tokens?: number;
|
|
493
|
+
/**
|
|
494
|
+
* 字数
|
|
495
|
+
*/
|
|
496
|
+
wordCount?: number;
|
|
497
|
+
}
|
|
498
|
+
declare const createFileService: (request: ReturnType<typeof createRequest>) => {
|
|
499
|
+
docQuery: (paramsStr: string) => Promise<R<DocType>>;
|
|
500
|
+
fileCreate: (fileContent: string, fileName?: string, targetFormat?: string) => Promise<void>;
|
|
501
|
+
};
|
|
502
|
+
|
|
247
503
|
type ConversationStrategy = 1 | 2;
|
|
248
504
|
interface ReferencesContent extends MessageQuoteMsg {
|
|
249
505
|
name?: string;
|
|
@@ -312,6 +568,20 @@ interface ChatLayout {
|
|
|
312
568
|
chatHeader?: RenderControl<void, ChatLayoutHeader>;
|
|
313
569
|
disclaimerNotice?: RenderControl<void, void>;
|
|
314
570
|
}
|
|
571
|
+
interface ChatServices {
|
|
572
|
+
websocketBaseUrls?: string[];
|
|
573
|
+
baseUrl?: string;
|
|
574
|
+
request?: ReturnType<typeof createChatService> & ReturnType<typeof createFileService>;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
interface AttachmentsProps {
|
|
578
|
+
fileUpload: (formData: FormData) => Promise<R<InputFile>>;
|
|
579
|
+
fileUploadConfig?: FileUploadConfig[];
|
|
580
|
+
extraParams?: ObjectType<string | undefined>;
|
|
581
|
+
fileList?: InputFile[];
|
|
582
|
+
onChange: (fileList: InputFile[]) => void;
|
|
583
|
+
}
|
|
584
|
+
declare const _default$3: react.ForwardRefExoticComponent<AttachmentsProps & react.RefAttributes<unknown>>;
|
|
315
585
|
|
|
316
586
|
interface ChatSenderHandle {
|
|
317
587
|
focus: (options?: {
|
|
@@ -321,8 +591,9 @@ interface ChatSenderHandle {
|
|
|
321
591
|
interface FileUpload {
|
|
322
592
|
params?: ObjectType<any>;
|
|
323
593
|
config: FileUploadConfig[];
|
|
594
|
+
request: AttachmentsProps['fileUpload'];
|
|
324
595
|
}
|
|
325
|
-
interface Props$
|
|
596
|
+
interface Props$1 {
|
|
326
597
|
placeholder?: string;
|
|
327
598
|
content?: string;
|
|
328
599
|
fileList?: InputFile[];
|
|
@@ -340,7 +611,7 @@ interface Props$2 {
|
|
|
340
611
|
sendBtnProps?: ButtonProps;
|
|
341
612
|
fileUpload?: FileUpload;
|
|
342
613
|
}
|
|
343
|
-
declare const _default$
|
|
614
|
+
declare const _default$2: react.ForwardRefExoticComponent<Props$1 & react.RefAttributes<ChatSenderHandle>>;
|
|
344
615
|
|
|
345
616
|
interface ChatConfig {
|
|
346
617
|
receiverType?: number;
|
|
@@ -357,6 +628,7 @@ interface ChatHandle {
|
|
|
357
628
|
setMessage: (message?: string) => void;
|
|
358
629
|
setFiles: (files?: InputFile[]) => void;
|
|
359
630
|
setParams: (params?: ChatParams) => void;
|
|
631
|
+
setServices: (services?: ChatServices) => void;
|
|
360
632
|
senderFocus: ChatSenderHandle['focus'];
|
|
361
633
|
}
|
|
362
634
|
interface ChatProps {
|
|
@@ -366,16 +638,9 @@ interface ChatProps {
|
|
|
366
638
|
hooks?: ChatHooks;
|
|
367
639
|
layout?: ChatLayout;
|
|
368
640
|
userInfo?: UserInfo;
|
|
641
|
+
services?: ChatServices;
|
|
369
642
|
}
|
|
370
|
-
declare const _default$
|
|
371
|
-
|
|
372
|
-
interface Props$1 {
|
|
373
|
-
fileUploadConfig?: FileUploadConfig[];
|
|
374
|
-
extraParams?: ObjectType<string | undefined>;
|
|
375
|
-
fileList?: InputFile[];
|
|
376
|
-
onChange: (fileList: InputFile[]) => void;
|
|
377
|
-
}
|
|
378
|
-
declare const _default$1: react.ForwardRefExoticComponent<Props$1 & react.RefAttributes<unknown>>;
|
|
643
|
+
declare const _default$1: react.ForwardRefExoticComponent<ChatProps & react.RefAttributes<ChatHandle>>;
|
|
379
644
|
|
|
380
645
|
interface Props {
|
|
381
646
|
message: ConversationMessage;
|
|
@@ -383,4 +648,4 @@ interface Props {
|
|
|
383
648
|
}
|
|
384
649
|
declare const _default: ({ message, placement }: Props) => react_jsx_runtime.JSX.Element;
|
|
385
650
|
|
|
386
|
-
export { type AgentInfo, _default$
|
|
651
|
+
export { type AgentInfo, _default$3 as Attachments, type ChatConfig, _default$1 as ChatCopilot, type ChatHandle, type ChatHooks, type ChatLayout, type ChatParams, type ChatProps, _default$2 as ChatSender, type ConversationStrategy, type InputFile, _default as MessageRender, type ReferencesType };
|