@zero-library/chat-copilot 1.0.1 → 1.0.2
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 +413 -464
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +39 -64
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +93 -64
- package/dist/index.d.ts +93 -64
- package/dist/index.esm.js +413 -464
- package/dist/index.esm.js.map +1 -1
- package/package.json +5 -4
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import react__default from 'react';
|
|
|
3
3
|
import { ButtonProps, ThemeConfig } from 'antd';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
import { createRequest, RequestConfig, RenderControl } from '@zero-library/common';
|
|
6
|
+
import { BubbleProps } from '@ant-design/x-v2';
|
|
6
7
|
|
|
7
8
|
type ConversationMemberEnum = 'user' | 'agent';
|
|
8
9
|
declare enum AgentTypeEnum {
|
|
@@ -66,10 +67,10 @@ interface AgentConfig {
|
|
|
66
67
|
}
|
|
67
68
|
interface AgentInfo {
|
|
68
69
|
id: string;
|
|
69
|
-
name
|
|
70
|
-
description
|
|
71
|
-
iconUrl
|
|
72
|
-
agentType
|
|
70
|
+
name?: string;
|
|
71
|
+
description?: string;
|
|
72
|
+
iconUrl?: string;
|
|
73
|
+
agentType?: AgentTypeEnum;
|
|
73
74
|
updatedAt?: string;
|
|
74
75
|
tagIds?: string[];
|
|
75
76
|
spec?: AgentSpec;
|
|
@@ -77,6 +78,65 @@ interface AgentInfo {
|
|
|
77
78
|
userInput?: Variable[];
|
|
78
79
|
}
|
|
79
80
|
|
|
81
|
+
/**
|
|
82
|
+
* ChatSender 组件暴露的方法接口
|
|
83
|
+
*/
|
|
84
|
+
interface ChatSenderHandle {
|
|
85
|
+
/** 聚焦输入框 */
|
|
86
|
+
focus: (options?: {
|
|
87
|
+
cursor?: 'start' | 'end';
|
|
88
|
+
}) => void;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* 文件上传配置接口
|
|
92
|
+
*/
|
|
93
|
+
interface FileUpload {
|
|
94
|
+
/** 上传时的额外参数 */
|
|
95
|
+
params?: ObjectType<any>;
|
|
96
|
+
/** 文件上传配置列表 */
|
|
97
|
+
config: FileUploadConfig;
|
|
98
|
+
/** 文件上传请求函数 */
|
|
99
|
+
request: AttachmentsProps['fileUpload'];
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* ChatSender 组件属性接口
|
|
103
|
+
*/
|
|
104
|
+
interface SenderProps {
|
|
105
|
+
/** 输入框占位符 */
|
|
106
|
+
placeholder?: string;
|
|
107
|
+
/** 输入框内容 */
|
|
108
|
+
content?: string;
|
|
109
|
+
/** 文件列表 */
|
|
110
|
+
fileList?: InputFile[];
|
|
111
|
+
/** 是否打开文件选择头部 */
|
|
112
|
+
headerOpen?: boolean;
|
|
113
|
+
/** 是否正在发送消息 */
|
|
114
|
+
loading?: boolean;
|
|
115
|
+
/** 内容变化回调 */
|
|
116
|
+
onContentChange: (value: string) => void;
|
|
117
|
+
/** 文件列表变化回调 */
|
|
118
|
+
onFileListChange: (files: InputFile[]) => void;
|
|
119
|
+
/** 头部打开状态变化回调 */
|
|
120
|
+
onHeaderOpenChange: (open: boolean) => void;
|
|
121
|
+
/** 发送消息回调 */
|
|
122
|
+
onSend: () => void;
|
|
123
|
+
/** 取消发送回调 */
|
|
124
|
+
onCancel?: () => void;
|
|
125
|
+
/** 输入框聚焦回调 */
|
|
126
|
+
onFocus?: () => void;
|
|
127
|
+
/** 头部额外内容 */
|
|
128
|
+
extraHeader?: React.ReactNode;
|
|
129
|
+
/** 底部额外内容 */
|
|
130
|
+
extraFooter?: React.ReactNode;
|
|
131
|
+
/** 底部下方额外内容 */
|
|
132
|
+
extraFooterBelow?: React.ReactNode;
|
|
133
|
+
/** 发送按钮属性 */
|
|
134
|
+
sendBtnProps?: ButtonProps;
|
|
135
|
+
/** 文件上传配置 */
|
|
136
|
+
fileUpload?: FileUpload;
|
|
137
|
+
}
|
|
138
|
+
declare const _default$3: react.ForwardRefExoticComponent<SenderProps & react.RefAttributes<ChatSenderHandle>>;
|
|
139
|
+
|
|
80
140
|
interface UserInputType {
|
|
81
141
|
inputs: Variable[];
|
|
82
142
|
outputs: Variable[];
|
|
@@ -238,9 +298,13 @@ interface ConvMeta {
|
|
|
238
298
|
* 1 正常 2 debug
|
|
239
299
|
*/
|
|
240
300
|
mode?: number;
|
|
301
|
+
/** 项目或知识库ID */
|
|
241
302
|
libraryId?: string;
|
|
303
|
+
/** 会话来源 */
|
|
242
304
|
source?: number;
|
|
305
|
+
/** 项目或知识库类型 */
|
|
243
306
|
libraryType?: LibraryTypeEnum;
|
|
307
|
+
/** 技能会话ID */
|
|
244
308
|
skillConversationId?: string;
|
|
245
309
|
}
|
|
246
310
|
|
|
@@ -483,11 +547,17 @@ type MessageEvent = RunStartedEvent | TextEvent | FilesEvent | StepStartedEvent
|
|
|
483
547
|
* 定义智能体和用户之间的消息结构
|
|
484
548
|
*/
|
|
485
549
|
interface ConversationMessage {
|
|
550
|
+
/** 消息ID */
|
|
486
551
|
messageId: string;
|
|
552
|
+
/** 会话ID */
|
|
487
553
|
conversationId: string;
|
|
554
|
+
/** 执行ID */
|
|
488
555
|
executionId: string;
|
|
556
|
+
/** 角色:1-智能体 2-用户 */
|
|
489
557
|
role: number;
|
|
558
|
+
/** 消息内容 */
|
|
490
559
|
content: MessageEvent[];
|
|
560
|
+
/** 上传文件内容 */
|
|
491
561
|
files?: InputFile[];
|
|
492
562
|
/** 消息反馈:1-赞 2-踩 */
|
|
493
563
|
feedback?: number;
|
|
@@ -495,6 +565,7 @@ interface ConversationMessage {
|
|
|
495
565
|
params?: string;
|
|
496
566
|
/** 引用的消息信息 */
|
|
497
567
|
quoteMsg?: MessageQuoteMsg;
|
|
568
|
+
/** 创建时间 */
|
|
498
569
|
createdAt: string;
|
|
499
570
|
/** 是否被打断标志 */
|
|
500
571
|
stopFlag?: boolean;
|
|
@@ -1078,6 +1149,12 @@ interface ChatHooks {
|
|
|
1078
1149
|
* }
|
|
1079
1150
|
*/
|
|
1080
1151
|
onAppRightVerify?: (appKey: string) => boolean | Promise<boolean> | void;
|
|
1152
|
+
/**
|
|
1153
|
+
* 文件预览前回调函数
|
|
1154
|
+
* 在文件预览打开前调用,返回false可阻止预览
|
|
1155
|
+
* @param file - 被预览的文件对象, 如果不存在则表示正在关闭预览
|
|
1156
|
+
* @param isBuiltIn - 是否为内嵌布局
|
|
1157
|
+
*/
|
|
1081
1158
|
onBeforeFilePreview?: (file?: FileUrlType, isBuiltIn?: boolean) => boolean | Promise<boolean> | void;
|
|
1082
1159
|
/**
|
|
1083
1160
|
* 文件预览后的回调函数
|
|
@@ -1357,67 +1434,21 @@ interface AttachmentsProps {
|
|
|
1357
1434
|
/** 文件列表变化回调函数 */
|
|
1358
1435
|
onChange: (fileList: InputFile[]) => void;
|
|
1359
1436
|
}
|
|
1360
|
-
|
|
1361
|
-
/**
|
|
1362
|
-
* ChatSender 组件暴露的方法接口
|
|
1363
|
-
*/
|
|
1364
|
-
interface ChatSenderHandle {
|
|
1365
|
-
/** 聚焦输入框 */
|
|
1366
|
-
focus: (options?: {
|
|
1367
|
-
cursor?: 'start' | 'end';
|
|
1368
|
-
}) => void;
|
|
1369
|
-
}
|
|
1370
|
-
/**
|
|
1371
|
-
* 文件上传配置接口
|
|
1372
|
-
*/
|
|
1373
|
-
interface FileUpload {
|
|
1374
|
-
/** 上传时的额外参数 */
|
|
1375
|
-
params?: ObjectType<any>;
|
|
1376
|
-
/** 文件上传配置列表 */
|
|
1377
|
-
config: FileUploadConfig;
|
|
1378
|
-
/** 文件上传请求函数 */
|
|
1379
|
-
request: AttachmentsProps['fileUpload'];
|
|
1380
|
-
}
|
|
1381
1437
|
/**
|
|
1382
|
-
*
|
|
1438
|
+
* 附件上传组件
|
|
1439
|
+
* 支持多文件上传、文件类型验证、文件大小限制等功能
|
|
1383
1440
|
*/
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
/** 是否打开文件选择头部 */
|
|
1392
|
-
headerOpen?: boolean;
|
|
1393
|
-
/** 是否正在发送消息 */
|
|
1394
|
-
loading?: boolean;
|
|
1395
|
-
/** 内容变化回调 */
|
|
1396
|
-
onContentChange: (value: string) => void;
|
|
1397
|
-
/** 文件列表变化回调 */
|
|
1398
|
-
onFileListChange: (files: InputFile[]) => void;
|
|
1399
|
-
/** 头部打开状态变化回调 */
|
|
1400
|
-
onHeaderOpenChange: (open: boolean) => void;
|
|
1401
|
-
/** 发送消息回调 */
|
|
1402
|
-
onSend: () => void;
|
|
1403
|
-
/** 取消发送回调 */
|
|
1404
|
-
onCancel?: () => void;
|
|
1405
|
-
/** 输入框聚焦回调 */
|
|
1406
|
-
onFocus?: () => void;
|
|
1407
|
-
/** 头部额外内容 */
|
|
1408
|
-
extraHeader?: React.ReactNode;
|
|
1409
|
-
/** 底部额外内容 */
|
|
1410
|
-
extraFooter?: React.ReactNode;
|
|
1411
|
-
/** 底部下方额外内容 */
|
|
1412
|
-
extraFooterBelow?: React.ReactNode;
|
|
1413
|
-
/** 发送按钮属性 */
|
|
1414
|
-
sendBtnProps?: ButtonProps;
|
|
1415
|
-
/** 文件上传配置 */
|
|
1416
|
-
fileUpload?: FileUpload;
|
|
1441
|
+
declare const _default$2: react.ForwardRefExoticComponent<AttachmentsProps & react.RefAttributes<unknown>>;
|
|
1442
|
+
|
|
1443
|
+
interface RoleContent {
|
|
1444
|
+
role: number;
|
|
1445
|
+
user: ConversationMemberEnum;
|
|
1446
|
+
placement: BubbleProps['placement'];
|
|
1447
|
+
avatar?: any;
|
|
1417
1448
|
}
|
|
1418
|
-
declare const _default$3: react.ForwardRefExoticComponent<SenderProps & react.RefAttributes<ChatSenderHandle>>;
|
|
1419
1449
|
|
|
1420
1450
|
interface MessageRenderProps {
|
|
1451
|
+
role: RoleContent;
|
|
1421
1452
|
message: ConversationMessage;
|
|
1422
1453
|
messageIndex?: number;
|
|
1423
1454
|
loading?: boolean;
|
|
@@ -1426,10 +1457,8 @@ interface MessageRenderProps {
|
|
|
1426
1457
|
/** message自定义标记渲染组件 */
|
|
1427
1458
|
customComponents?: ChatLayoutMessageList['customComponents'];
|
|
1428
1459
|
}
|
|
1429
|
-
declare const _default$
|
|
1430
|
-
|
|
1431
|
-
declare const _default$1: ({ firstMessages, welcomeMessage, avatar, agentActions, customComponents }: ChatLayoutMessageList) => react_jsx_runtime.JSX.Element;
|
|
1460
|
+
declare const _default$1: react__default.MemoExoticComponent<({ role, message, messageIndex, loading, containerRef, customComponents }: MessageRenderProps) => react_jsx_runtime.JSX.Element>;
|
|
1432
1461
|
|
|
1433
1462
|
declare const _default: react.ForwardRefExoticComponent<ChatProps & react.RefAttributes<ChatHandle>>;
|
|
1434
1463
|
|
|
1435
|
-
export { type AgentConfig, type AgentInfo, type AgentSpec, _default$
|
|
1464
|
+
export { type AgentConfig, type AgentInfo, type AgentSpec, _default$2 as Attachments, type AttachmentsProps, type ChatConfig, _default as ChatCopilot, type ChatHandle, type ChatHooks, type ChatLayout, type ChatParams, type ChatProps, _default$3 as ChatSender, type ChatServices, type ConversationMessage, type ConversationStrategy, type FileUploadConfig, type InputFile, _default$1 as MessageRender, type MessageRenderProps, type ReferencesType, type RequestInstance, type SenderProps };
|