@zero-library/chat-agent 2.1.19 → 2.2.0
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 +259 -189
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.mts +1035 -204
- package/dist/index.d.ts +1035 -204
- package/dist/index.esm.js +260 -185
- package/dist/index.esm.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,14 +1,40 @@
|
|
|
1
|
-
import { createRequest,
|
|
1
|
+
import { createRequest, RequestConfig, RenderControl } 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
|
-
export * from '@ant-design/x';
|
|
6
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
7
6
|
|
|
7
|
+
/**
|
|
8
|
+
* 聊天服务模块
|
|
9
|
+
* 提供聊天相关的 API 接口定义和类型声明
|
|
10
|
+
* 包含会话管理、消息处理、智能体操作等功能
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* 用户信息接口
|
|
14
|
+
* 定义用户的基本信息和权限配置
|
|
15
|
+
*/
|
|
16
|
+
interface UserInfo {
|
|
17
|
+
/** 用户ID */
|
|
18
|
+
id?: string | number;
|
|
19
|
+
/** 用户姓名 */
|
|
20
|
+
name?: string;
|
|
21
|
+
/** 头像地址 */
|
|
22
|
+
avatar?: string;
|
|
23
|
+
/** 备注信息 */
|
|
24
|
+
remark?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* 会话列表查询参数接口
|
|
28
|
+
* 用于获取用户的会话列表
|
|
29
|
+
*/
|
|
8
30
|
interface ConversationsQuery extends PageReq {
|
|
31
|
+
/** 业务数据唯一ID,非必填 */
|
|
9
32
|
businessId?: string;
|
|
33
|
+
/** 业务类型,非必填 */
|
|
10
34
|
businessType?: number;
|
|
35
|
+
/** 目标ID(如智能体ID、专家ID等) */
|
|
11
36
|
targetId: string;
|
|
37
|
+
/** 目标类型:1-用户 2-专家 3-Agent 4-税协 */
|
|
12
38
|
targetType: number;
|
|
13
39
|
}
|
|
14
40
|
/**
|
|
@@ -148,299 +174,218 @@ interface ConversationRecentQuery {
|
|
|
148
174
|
*/
|
|
149
175
|
receiverType: number;
|
|
150
176
|
}
|
|
177
|
+
/**
|
|
178
|
+
* 会话消息查询参数接口
|
|
179
|
+
* 用于获取指定会话的消息列表
|
|
180
|
+
*/
|
|
151
181
|
interface conversationMessagesQuery extends PageReq {
|
|
182
|
+
/** 会话ID */
|
|
152
183
|
conversationId: string;
|
|
153
184
|
}
|
|
185
|
+
/**
|
|
186
|
+
* 输入文件接口
|
|
187
|
+
* 定义聊天中上传文件的属性
|
|
188
|
+
*/
|
|
154
189
|
interface InputFile {
|
|
155
|
-
/**
|
|
156
|
-
* Content,文件内容
|
|
157
|
-
*/
|
|
190
|
+
/** 文件内容(base64编码或URL) */
|
|
158
191
|
content: string;
|
|
159
|
-
/**
|
|
160
|
-
* 文件模式 remote_url local_file
|
|
161
|
-
*/
|
|
192
|
+
/** 文件模式:remote_url(远程URL)| local_file(本地文件) */
|
|
162
193
|
mode: string;
|
|
163
|
-
/**
|
|
164
|
-
* Type,文件类型
|
|
165
|
-
*/
|
|
194
|
+
/** 文件类型(MIME类型) */
|
|
166
195
|
type: string;
|
|
167
|
-
/**
|
|
168
|
-
* 文件扩展名
|
|
169
|
-
*/
|
|
196
|
+
/** 文件扩展名 */
|
|
170
197
|
extension: string;
|
|
171
|
-
/**
|
|
172
|
-
* 文件名
|
|
173
|
-
*/
|
|
198
|
+
/** 文件名 */
|
|
174
199
|
name: string;
|
|
175
200
|
}
|
|
201
|
+
/**
|
|
202
|
+
* 消息引用类型
|
|
203
|
+
* 用于消息回复时的引用信息
|
|
204
|
+
*/
|
|
176
205
|
interface MessageQuoteMsg {
|
|
177
|
-
/**
|
|
178
|
-
* Id,消息ID
|
|
179
|
-
*/
|
|
206
|
+
/** 被引用的消息ID */
|
|
180
207
|
id?: string;
|
|
181
|
-
/**
|
|
182
|
-
* Msgcontent,消息内容
|
|
183
|
-
*/
|
|
208
|
+
/** 被引用的消息内容 */
|
|
184
209
|
msgContent?: string;
|
|
185
|
-
/**
|
|
186
|
-
* Msgfiles,附件文件列表
|
|
187
|
-
*/
|
|
210
|
+
/** 被引用消息的附件文件列表 */
|
|
188
211
|
msgFiles?: InputFile[];
|
|
189
212
|
}
|
|
213
|
+
/**
|
|
214
|
+
* 消息发送者接口
|
|
215
|
+
* 定义消息发送者的身份信息
|
|
216
|
+
*/
|
|
190
217
|
interface MessageSender {
|
|
191
|
-
/**
|
|
192
|
-
* Curruser,是否为当前用户
|
|
193
|
-
*/
|
|
218
|
+
/** 是否为当前用户 */
|
|
194
219
|
currUser?: boolean;
|
|
195
|
-
/**
|
|
196
|
-
* Id,发送者ID
|
|
197
|
-
*/
|
|
220
|
+
/** 发送者ID */
|
|
198
221
|
id: string;
|
|
199
|
-
/**
|
|
200
|
-
* Type,1-用户 2-专家 3-Agent 4-税协
|
|
201
|
-
*/
|
|
222
|
+
/** 发送者类型:1-用户 2-专家 3-Agent 4-税协 */
|
|
202
223
|
type: number;
|
|
203
224
|
}
|
|
225
|
+
/**
|
|
226
|
+
* 会话消息接口
|
|
227
|
+
* 定义聊天消息的完整信息
|
|
228
|
+
*/
|
|
204
229
|
interface ConversationMessage {
|
|
205
|
-
/**
|
|
206
|
-
* Conversationid,会话ID
|
|
207
|
-
*/
|
|
230
|
+
/** 会话ID */
|
|
208
231
|
conversationId: string;
|
|
232
|
+
/** 会话标题(WebSocket返回时可能包含) */
|
|
209
233
|
conversationTitle?: string;
|
|
234
|
+
/** 消息类型:WebSocket流式消息类型 */
|
|
210
235
|
type?: 'TEXT_MESSAGE_START' | 'STEP_STARTED' | 'TEXT_MESSAGE_CONTENT' | 'TEXT_MESSAGE_END' | 'RUN_ERROR';
|
|
211
|
-
/**
|
|
212
|
-
* Id,消息ID
|
|
213
|
-
*/
|
|
236
|
+
/** 消息ID */
|
|
214
237
|
id: string;
|
|
215
|
-
/**
|
|
216
|
-
* Msgcontent,消息内容
|
|
217
|
-
*/
|
|
238
|
+
/** 消息内容 */
|
|
218
239
|
msgContent: string;
|
|
219
|
-
/**
|
|
220
|
-
* Msgfeedback,消息反馈
|
|
221
|
-
*/
|
|
240
|
+
/** 消息反馈:1-赞 2-踩 */
|
|
222
241
|
msgFeedback?: number;
|
|
223
|
-
/**
|
|
224
|
-
* Msgfiles,附件文件列表
|
|
225
|
-
*/
|
|
242
|
+
/** 附件文件列表 */
|
|
226
243
|
msgFiles?: InputFile[];
|
|
227
|
-
/**
|
|
228
|
-
* 引消息
|
|
229
|
-
*/
|
|
244
|
+
/** 引用的消息信息 */
|
|
230
245
|
quoteMsg?: MessageQuoteMsg;
|
|
231
|
-
/**
|
|
232
|
-
* 发送者信息
|
|
233
|
-
*/
|
|
246
|
+
/** 发送者信息 */
|
|
234
247
|
sender?: MessageSender;
|
|
235
|
-
/**
|
|
236
|
-
* Sendtime,发送时间
|
|
237
|
-
*/
|
|
248
|
+
/** 发送时间戳 */
|
|
238
249
|
sendTime: number;
|
|
239
|
-
/**
|
|
240
|
-
* Stopflag,是否打断
|
|
241
|
-
*/
|
|
250
|
+
/** 是否被打断标志 */
|
|
242
251
|
stopFlag?: boolean;
|
|
243
252
|
}
|
|
253
|
+
/**
|
|
254
|
+
* 消息反馈更新接口
|
|
255
|
+
* 用于用户对消息进行赞/踩评价
|
|
256
|
+
*/
|
|
244
257
|
interface FeedbackUpdate {
|
|
245
|
-
/**
|
|
246
|
-
* Conversationid,会话ID
|
|
247
|
-
*/
|
|
258
|
+
/** 会话ID */
|
|
248
259
|
conversationId: string;
|
|
249
|
-
/**
|
|
250
|
-
* Id,消息ID
|
|
251
|
-
*/
|
|
260
|
+
/** 消息ID */
|
|
252
261
|
id: string;
|
|
253
|
-
/**
|
|
254
|
-
* Msgfeedback,反馈类型:1-赞,2-踩
|
|
255
|
-
*/
|
|
262
|
+
/** 反馈类型:1-赞 2-踩 */
|
|
256
263
|
msgFeedback: number;
|
|
257
|
-
/**
|
|
258
|
-
* Msgfeedbackcontent,消息反馈内容
|
|
259
|
-
*/
|
|
264
|
+
/** 反馈内容描述,非必填 */
|
|
260
265
|
msgFeedbackContent?: string;
|
|
261
266
|
}
|
|
267
|
+
/**
|
|
268
|
+
* 消息发送参数接口
|
|
269
|
+
* 定义发送消息时所需的全部参数
|
|
270
|
+
*/
|
|
262
271
|
interface ConversationMessageSend {
|
|
263
|
-
/**
|
|
264
|
-
* Conversationid,会话 ID
|
|
265
|
-
*/
|
|
272
|
+
/** 会话ID */
|
|
266
273
|
conversationId: string;
|
|
267
|
-
/**
|
|
268
|
-
* Msgcontent,消息内容
|
|
269
|
-
*/
|
|
274
|
+
/** 消息内容 */
|
|
270
275
|
msgContent: string;
|
|
271
|
-
/**
|
|
272
|
-
* Msgfiles,附件文件列表
|
|
273
|
-
*/
|
|
276
|
+
/** 附件文件列表 */
|
|
274
277
|
msgFiles?: InputFile[];
|
|
275
|
-
/**
|
|
276
|
-
* Params,业务参数,透传到智能体
|
|
277
|
-
*/
|
|
278
|
+
/** 业务参数,透传到智能体的JSON字符串 */
|
|
278
279
|
params?: string;
|
|
279
|
-
/**
|
|
280
|
-
* Quotemsgid,引用的消息 ID,大于 0 的整数
|
|
281
|
-
*/
|
|
280
|
+
/** 引用的消息ID,大于0的整数 */
|
|
282
281
|
quoteMsgId?: number;
|
|
283
|
-
/**
|
|
284
|
-
* Receiverid,接收者 ID。当 receiverType ≠ 3(非 agent)时,后端需填充此字段
|
|
285
|
-
*/
|
|
282
|
+
/** 接收者ID,当receiverType≠3时由后端填充 */
|
|
286
283
|
receiverId: string;
|
|
287
|
-
/**
|
|
288
|
-
* Receivertype,接收者身份,必填:1-用户;2-专家;3-agent 4-税协
|
|
289
|
-
*/
|
|
284
|
+
/** 接收者类型:1-用户 2-专家 3-agent 4-税协 */
|
|
290
285
|
receiverType: number;
|
|
291
|
-
/**
|
|
292
|
-
* Returntype,返回方式:1-http;2-ws(WebSocket)
|
|
293
|
-
*/
|
|
286
|
+
/** 返回方式:1-http 2-WebSocket */
|
|
294
287
|
returnType: number;
|
|
295
|
-
/**
|
|
296
|
-
* Senderid,发送者 ID
|
|
297
|
-
*/
|
|
288
|
+
/** 发送者ID */
|
|
298
289
|
senderId: string;
|
|
299
|
-
/**
|
|
300
|
-
* Sendertype,发送者身份,必填:1-用户;2-专家;3-agent 4-税协
|
|
301
|
-
*/
|
|
290
|
+
/** 发送者类型:1-用户 2-专家 3-agent 4-税协 */
|
|
302
291
|
senderType: number;
|
|
303
|
-
/**
|
|
304
|
-
* Source,会话来源: 1-罗拉-APP; 2-罗拉-pc端; 3-合作伙伴端 4-税协 5-罗拉-cube 6-api
|
|
305
|
-
*/
|
|
292
|
+
/** 会话来源:1-罗拉-APP 2-罗拉-pc端 3-合作伙伴端 4-税协 5-罗拉-cube 6-api */
|
|
306
293
|
source: number;
|
|
307
|
-
/**
|
|
308
|
-
* Stream,是否启用流式返回响应结果
|
|
309
|
-
*/
|
|
294
|
+
/** 是否启用流式返回 */
|
|
310
295
|
stream: boolean;
|
|
311
296
|
}
|
|
312
297
|
/**
|
|
313
|
-
*
|
|
298
|
+
* 文件上传配置接口
|
|
299
|
+
* 定义智能体的文件上传规则
|
|
314
300
|
*/
|
|
315
301
|
interface FileUploadConfig {
|
|
316
|
-
/**
|
|
317
|
-
* Allowedfiletypes,允许的文件类型
|
|
318
|
-
*/
|
|
302
|
+
/** 允许的文件类型列表(MIME类型或扩展名) */
|
|
319
303
|
allowedFileTypes: string[];
|
|
320
|
-
/**
|
|
321
|
-
* Enabled,是否启用文件上传
|
|
322
|
-
*/
|
|
304
|
+
/** 是否启用文件上传功能 */
|
|
323
305
|
enabled: boolean;
|
|
324
|
-
/**
|
|
325
|
-
* Maxfilecount,最大文件数量
|
|
326
|
-
*/
|
|
306
|
+
/** 单次上传最大文件数量 */
|
|
327
307
|
maxFileCount: number;
|
|
328
|
-
/**
|
|
329
|
-
* Maxfilesize,最大文件大小
|
|
330
|
-
*/
|
|
308
|
+
/** 单个文件最大大小(字节) */
|
|
331
309
|
maxFileSize?: number;
|
|
332
310
|
}
|
|
333
311
|
/**
|
|
334
|
-
*
|
|
312
|
+
* 推荐问题接口
|
|
313
|
+
* 定义单个推荐问题的结构
|
|
335
314
|
*/
|
|
336
315
|
interface RecommendQuestion {
|
|
337
|
-
/**
|
|
338
|
-
* Id,问题 ID
|
|
339
|
-
*/
|
|
316
|
+
/** 问题ID */
|
|
340
317
|
id: number;
|
|
341
|
-
/**
|
|
342
|
-
* Question,问题内容
|
|
343
|
-
*/
|
|
318
|
+
/** 问题内容 */
|
|
344
319
|
question: string;
|
|
345
320
|
}
|
|
346
321
|
/**
|
|
347
|
-
*
|
|
322
|
+
* 热门问题标签接口
|
|
323
|
+
* 定义热门问题的分类标签
|
|
348
324
|
*/
|
|
349
325
|
interface HotQuestionList {
|
|
350
|
-
/**
|
|
351
|
-
* Id,标签 ID
|
|
352
|
-
*/
|
|
326
|
+
/** 标签ID */
|
|
353
327
|
id: number;
|
|
354
|
-
/**
|
|
355
|
-
* Items,标签下的问题列表
|
|
356
|
-
*/
|
|
328
|
+
/** 标签下的问题列表 */
|
|
357
329
|
items: RecommendQuestion[];
|
|
358
|
-
/**
|
|
359
|
-
* Name,标签名称
|
|
360
|
-
*/
|
|
330
|
+
/** 标签名称 */
|
|
361
331
|
name: string;
|
|
362
332
|
}
|
|
333
|
+
/**
|
|
334
|
+
* 智能体配置接口
|
|
335
|
+
* 定义智能体的功能配置信息
|
|
336
|
+
*/
|
|
363
337
|
interface AgentConfig {
|
|
364
|
-
/**
|
|
365
|
-
* 文件上传配置
|
|
366
|
-
*/
|
|
338
|
+
/** 文件上传配置列表 */
|
|
367
339
|
fileUpload?: FileUploadConfig[];
|
|
368
|
-
/**
|
|
369
|
-
* Labels,热门问题标签列表
|
|
370
|
-
*/
|
|
340
|
+
/** 热门问题标签列表 */
|
|
371
341
|
labels?: HotQuestionList[];
|
|
372
|
-
/**
|
|
373
|
-
* Recommendquestions,推荐问题列表
|
|
374
|
-
*/
|
|
342
|
+
/** 推荐问题列表 */
|
|
375
343
|
recommendQuestions?: RecommendQuestion[];
|
|
376
344
|
}
|
|
345
|
+
/**
|
|
346
|
+
* 智能体信息接口
|
|
347
|
+
* 定义智能体的基本信息和配置
|
|
348
|
+
*/
|
|
377
349
|
interface AgentInfo {
|
|
378
|
-
/**
|
|
379
|
-
* Agentname,名称
|
|
380
|
-
*/
|
|
350
|
+
/** 智能体名称 */
|
|
381
351
|
agentName: string;
|
|
382
|
-
/**
|
|
383
|
-
* Agenttype,智能体类型
|
|
384
|
-
*/
|
|
352
|
+
/** 智能体类型 */
|
|
385
353
|
agentType: number;
|
|
386
|
-
/**
|
|
387
|
-
* 智能体的附带信息
|
|
388
|
-
*/
|
|
354
|
+
/** 智能体的配置信息 */
|
|
389
355
|
config: AgentConfig;
|
|
390
|
-
/**
|
|
391
|
-
* Description,描述
|
|
392
|
-
*/
|
|
356
|
+
/** 智能体描述 */
|
|
393
357
|
description?: string;
|
|
394
|
-
/**
|
|
395
|
-
* Id,主键
|
|
396
|
-
*/
|
|
358
|
+
/** 智能体ID */
|
|
397
359
|
id: string;
|
|
398
|
-
/**
|
|
399
|
-
* Isavailable,是否可用
|
|
400
|
-
*/
|
|
360
|
+
/** 智能体是否可用 */
|
|
401
361
|
isAvailable?: boolean;
|
|
402
|
-
/**
|
|
403
|
-
* Logo,logo
|
|
404
|
-
*/
|
|
362
|
+
/** 智能体Logo地址 */
|
|
405
363
|
logo: string;
|
|
364
|
+
/** 智能体特性配置,JSON字符串格式 */
|
|
406
365
|
feature?: string;
|
|
407
366
|
}
|
|
367
|
+
/**
|
|
368
|
+
* 智能体性格接口
|
|
369
|
+
* 定义智能体的性格特征配置
|
|
370
|
+
*/
|
|
408
371
|
interface AgentCharacter {
|
|
409
|
-
/**
|
|
410
|
-
* Agentid,智能体ID
|
|
411
|
-
*/
|
|
372
|
+
/** 智能体ID */
|
|
412
373
|
agentId: number;
|
|
413
|
-
/**
|
|
414
|
-
* Charactername,性格名称
|
|
415
|
-
*/
|
|
374
|
+
/** 性格名称 */
|
|
416
375
|
characterName: string;
|
|
417
|
-
/**
|
|
418
|
-
* Detaillevel,详细程度:1-10
|
|
419
|
-
*/
|
|
376
|
+
/** 详细程度评级:1-10 */
|
|
420
377
|
detailLevel: number;
|
|
421
|
-
/**
|
|
422
|
-
* Humorlevel,幽默程度:1-10
|
|
423
|
-
*/
|
|
378
|
+
/** 幽默程度评级:1-10 */
|
|
424
379
|
humorLevel: number;
|
|
425
|
-
/**
|
|
426
|
-
* Id,id
|
|
427
|
-
*/
|
|
380
|
+
/** 性格配置ID */
|
|
428
381
|
id: number;
|
|
429
|
-
/**
|
|
430
|
-
* Logo,头像,存储图片路径
|
|
431
|
-
*/
|
|
382
|
+
/** 性格头像图片路径 */
|
|
432
383
|
logo: string;
|
|
433
|
-
/**
|
|
434
|
-
* Professionallevel,专业程度:1-10
|
|
435
|
-
*/
|
|
384
|
+
/** 专业程度评级:1-10 */
|
|
436
385
|
professionalLevel: number;
|
|
437
|
-
/**
|
|
438
|
-
* Selected,是否已选择
|
|
439
|
-
*/
|
|
386
|
+
/** 是否为当前选择的性格 */
|
|
440
387
|
selected: boolean;
|
|
441
|
-
/**
|
|
442
|
-
* Sex,性别:1-男,2-女
|
|
443
|
-
*/
|
|
388
|
+
/** 性别设置:1-男 2-女 */
|
|
444
389
|
sex: number;
|
|
445
390
|
}
|
|
446
391
|
/**
|
|
@@ -505,78 +450,671 @@ declare const createFileService: (request: ReturnType<typeof createRequest>) =>
|
|
|
505
450
|
fileCreate: (fileContent: string, fileName?: string, targetFormat?: string) => Promise<void>;
|
|
506
451
|
};
|
|
507
452
|
|
|
453
|
+
/**
|
|
454
|
+
* 会话策略类型
|
|
455
|
+
* 定义创建或获取会话的策略
|
|
456
|
+
*
|
|
457
|
+
* 取值说明:
|
|
458
|
+
* - 1: 最近会话策略 - 获取用户最近的会话继续对话
|
|
459
|
+
* - 2: 新会话策略 - 创建全新的会话开始对话
|
|
460
|
+
*/
|
|
508
461
|
type ConversationStrategy = 1 | 2;
|
|
462
|
+
/**
|
|
463
|
+
* 引用内容接口
|
|
464
|
+
* 扩展消息引用信息,支持更多引用格式
|
|
465
|
+
*
|
|
466
|
+
* @example
|
|
467
|
+
* // 引用文档片段
|
|
468
|
+
* const quote: ReferencesContent = {
|
|
469
|
+
* name: '法规条款',
|
|
470
|
+
* markdown: '> 根据《企业所得税法》第XX条规定...',
|
|
471
|
+
* }
|
|
472
|
+
*/
|
|
509
473
|
interface ReferencesContent extends MessageQuoteMsg {
|
|
474
|
+
/** 引用名称 */
|
|
510
475
|
name?: string;
|
|
476
|
+
/** Markdown格式的引用内容 */
|
|
511
477
|
markdown?: string;
|
|
478
|
+
/** 其他扩展属性 */
|
|
512
479
|
[key: string]: any;
|
|
513
480
|
}
|
|
481
|
+
/**
|
|
482
|
+
* 引用类型接口
|
|
483
|
+
* 定义消息引用的各种类型和参数
|
|
484
|
+
*
|
|
485
|
+
* @example
|
|
486
|
+
* // Markdown引用(拼接到正文发送)
|
|
487
|
+
* const markdownRef: ReferencesType = {
|
|
488
|
+
* type: 1,
|
|
489
|
+
* content: {
|
|
490
|
+
* name: '法规摘要',
|
|
491
|
+
* markdown: '> 根据相关规定...'
|
|
492
|
+
* },
|
|
493
|
+
* params: {
|
|
494
|
+
* source: 'law-001'
|
|
495
|
+
* }
|
|
496
|
+
* }
|
|
497
|
+
*
|
|
498
|
+
* // 文案引用(不发送正文)
|
|
499
|
+
* const textRef: ReferencesType = {
|
|
500
|
+
* type: 2,
|
|
501
|
+
* content: {
|
|
502
|
+
* name: '参考答案',
|
|
503
|
+
* markdown: '建议按以下方式处理...'
|
|
504
|
+
* }
|
|
505
|
+
* }
|
|
506
|
+
*
|
|
507
|
+
* // 消息引用
|
|
508
|
+
* const messageRef: ReferencesType = {
|
|
509
|
+
* type: 3,
|
|
510
|
+
* content: {
|
|
511
|
+
* id: 'msg-001',
|
|
512
|
+
* msgContent: '之前的回答内容'
|
|
513
|
+
* }
|
|
514
|
+
* }
|
|
515
|
+
*/
|
|
514
516
|
interface ReferencesType {
|
|
517
|
+
/** 引用类型:1-markdown引用(拼正文发) 2-文案引用(不发正文) 3-消息引用 */
|
|
515
518
|
type: number;
|
|
519
|
+
/** 引用内容 */
|
|
516
520
|
content: ReferencesContent;
|
|
521
|
+
/** 引用参数,最终透传大模型 */
|
|
517
522
|
params?: ObjectType<any>;
|
|
518
523
|
}
|
|
524
|
+
/**
|
|
525
|
+
* 聊天组件生命周期钩子接口
|
|
526
|
+
* 定义聊天组件在各种事件发生时的回调函数
|
|
527
|
+
* @example
|
|
528
|
+
* // 完整的钩子配置示例
|
|
529
|
+
* const hooks: ChatHooks = {
|
|
530
|
+
* onBeforeInit: () => {
|
|
531
|
+
* console.log('聊天组件初始化前')
|
|
532
|
+
* },
|
|
533
|
+
* onAfterInit: () => {
|
|
534
|
+
* console.log('聊天组件初始化后')
|
|
535
|
+
* },
|
|
536
|
+
* onBeforeSend: (message, files) => {
|
|
537
|
+
* // 验证消息内容
|
|
538
|
+
* if (!message?.trim()) {
|
|
539
|
+
* message.error('请输入消息内容')
|
|
540
|
+
* return false // 阻止发送
|
|
541
|
+
* }
|
|
542
|
+
* return true // 允许发送
|
|
543
|
+
* },
|
|
544
|
+
* onAfterSend: () => {
|
|
545
|
+
* console.log('消息发送完成')
|
|
546
|
+
* },
|
|
547
|
+
* onRequestInterceptor: [
|
|
548
|
+
* (config) => {
|
|
549
|
+
* // 添加认证头
|
|
550
|
+
* config.headers.Authorization = `Bearer ${getToken()}`
|
|
551
|
+
* return config
|
|
552
|
+
* },
|
|
553
|
+
* (error) => {
|
|
554
|
+
* console.error('请求错误:', error)
|
|
555
|
+
* return Promise.reject(error)
|
|
556
|
+
* }
|
|
557
|
+
* ],
|
|
558
|
+
* ...
|
|
559
|
+
* }
|
|
560
|
+
*/
|
|
519
561
|
interface ChatHooks {
|
|
562
|
+
/**
|
|
563
|
+
* 初始化前回调
|
|
564
|
+
* 在聊天组件初始化之前调用
|
|
565
|
+
*
|
|
566
|
+
* @example
|
|
567
|
+
* onBeforeInit: () => {
|
|
568
|
+
* console.log('准备初始化聊天组件')
|
|
569
|
+
* }
|
|
570
|
+
*/
|
|
520
571
|
onBeforeInit?: () => void;
|
|
572
|
+
/**
|
|
573
|
+
* 初始化后回调
|
|
574
|
+
* 在聊天组件初始化完成后调用
|
|
575
|
+
*
|
|
576
|
+
* @example
|
|
577
|
+
* onAfterInit: () => {
|
|
578
|
+
* console.log('聊天组件初始化完成')
|
|
579
|
+
* }
|
|
580
|
+
*/
|
|
521
581
|
onAfterInit?: () => void;
|
|
582
|
+
/**
|
|
583
|
+
* 输入框聚焦回调
|
|
584
|
+
* 当输入框获得焦点时调用
|
|
585
|
+
*
|
|
586
|
+
* @example
|
|
587
|
+
* onSenderFocus: () => {
|
|
588
|
+
* console.log('输入框获得焦点')
|
|
589
|
+
* }
|
|
590
|
+
*/
|
|
522
591
|
onSenderFocus?: () => void;
|
|
592
|
+
/**
|
|
593
|
+
* 头部关闭回调
|
|
594
|
+
* 当聊天窗口头部关闭按钮被点击时调用
|
|
595
|
+
*
|
|
596
|
+
* @example
|
|
597
|
+
* onHeaderClose: () => {
|
|
598
|
+
* console.log('聊天窗口关闭')
|
|
599
|
+
* // 可以在这里执行清理操作
|
|
600
|
+
* }
|
|
601
|
+
*/
|
|
523
602
|
onHeaderClose?: () => void;
|
|
603
|
+
/**
|
|
604
|
+
* 发送消息前回调
|
|
605
|
+
* 在消息发送前调用,返回false可阻止发送
|
|
606
|
+
*
|
|
607
|
+
* @param message - 要发送的消息内容
|
|
608
|
+
* @param files - 要发送的文件列表
|
|
609
|
+
* @returns boolean | Promise<boolean> | void - 返回false阻止发送
|
|
610
|
+
*
|
|
611
|
+
* @example
|
|
612
|
+
* onBeforeSend: (message, files) => {
|
|
613
|
+
* // 检查消息长度
|
|
614
|
+
* if (message.length > 1000) {
|
|
615
|
+
* message.error('消息内容过长')
|
|
616
|
+
* return false
|
|
617
|
+
* }
|
|
618
|
+
* return true
|
|
619
|
+
* }
|
|
620
|
+
*/
|
|
524
621
|
onBeforeSend?: (message: ConversationMessageSend['msgContent'], files: InputFile[]) => boolean | Promise<boolean> | void;
|
|
622
|
+
/**
|
|
623
|
+
* 发送消息后回调
|
|
624
|
+
* 在消息发送完成后调用
|
|
625
|
+
*
|
|
626
|
+
* @example
|
|
627
|
+
* onAfterSend: () => {
|
|
628
|
+
* console.log('消息发送完成')
|
|
629
|
+
* // 可以在这里执行后续操作,如滚动到底部
|
|
630
|
+
* }
|
|
631
|
+
*/
|
|
525
632
|
onAfterSend?: () => void;
|
|
633
|
+
/**
|
|
634
|
+
* 切换智能体前回调
|
|
635
|
+
* 在切换智能体前调用,返回false可阻止切换
|
|
636
|
+
*
|
|
637
|
+
* @param agentId - 目标智能体ID
|
|
638
|
+
* @returns boolean | Promise<boolean> | void - 返回false阻止切换
|
|
639
|
+
*
|
|
640
|
+
* @example
|
|
641
|
+
* onBeforeSwitchAgent: (agentId) => {
|
|
642
|
+
* // 检查智能体权益
|
|
643
|
+
* }
|
|
644
|
+
*/
|
|
526
645
|
onBeforeSwitchAgent?: (agentId: string) => boolean | Promise<boolean> | void;
|
|
646
|
+
/**
|
|
647
|
+
* 切换智能体后回调
|
|
648
|
+
* 在切换智能体完成后调用
|
|
649
|
+
*
|
|
650
|
+
* @param agent - 新的智能体信息
|
|
651
|
+
*
|
|
652
|
+
* @example
|
|
653
|
+
* onAfterSwitchAgent: (agent) => {
|
|
654
|
+
* console.log(`已切换到智能体: ${agent.agentName}`)
|
|
655
|
+
* // 可以在这里获取最新的智能体
|
|
656
|
+
* }
|
|
657
|
+
*/
|
|
527
658
|
onAfterSwitchAgent?: (agent: AgentInfo) => void;
|
|
659
|
+
/**
|
|
660
|
+
* 切换会话前回调
|
|
661
|
+
* 在切换会话前调用,返回false可阻止切换
|
|
662
|
+
*
|
|
663
|
+
* @param conversationId - 目标会话ID
|
|
664
|
+
* @returns boolean | Promise<boolean> | void - 返回false阻止切换
|
|
665
|
+
*
|
|
666
|
+
* @example
|
|
667
|
+
* onBeforeSwitchConversation: (conversationId) => {
|
|
668
|
+
* // 检查当前会话状态
|
|
669
|
+
* if (isSendingMessage) {
|
|
670
|
+
* message.warning('正在发送消息,请稍后再切换会话')
|
|
671
|
+
* return false
|
|
672
|
+
* }
|
|
673
|
+
* return true
|
|
674
|
+
* }
|
|
675
|
+
*/
|
|
528
676
|
onBeforeSwitchConversation?: (conversationId: string) => boolean | Promise<boolean> | void;
|
|
677
|
+
/**
|
|
678
|
+
* 在切换会话完成后调用
|
|
679
|
+
*
|
|
680
|
+
* @param conversationId - 新的会话ID
|
|
681
|
+
*
|
|
682
|
+
* @example
|
|
683
|
+
* onAfterSwitchConversation: (conversationId) => {
|
|
684
|
+
* console.log(`已切换到会话: ${conversationId}`)
|
|
685
|
+
* // 可以在这里更新界面状态
|
|
686
|
+
* }
|
|
687
|
+
*/
|
|
529
688
|
onAfterSwitchConversation?: (conversationId: string) => void;
|
|
689
|
+
/**
|
|
690
|
+
* 初始化消息前回调
|
|
691
|
+
* 在初始化消息列表前调用,返回false可阻止初始化
|
|
692
|
+
*
|
|
693
|
+
* @param conversationId - 会话ID
|
|
694
|
+
* @returns boolean | Promise<boolean> | void - 返回false阻止初始化
|
|
695
|
+
*
|
|
696
|
+
* @example
|
|
697
|
+
* onBeforeInitMessages: (conversationId) => {
|
|
698
|
+
* // 检查会话权限
|
|
699
|
+
* if (!hasPermission(conversationId)) {
|
|
700
|
+
* message.error('无权访问此会话')
|
|
701
|
+
* return false
|
|
702
|
+
* }
|
|
703
|
+
* return true
|
|
704
|
+
* }
|
|
705
|
+
*/
|
|
530
706
|
onBeforeInitMessages?: (conversationId: string) => boolean | Promise<boolean> | void;
|
|
707
|
+
/**
|
|
708
|
+
* 初始化消息后回调
|
|
709
|
+
* 在初始化消息列表完成后调用
|
|
710
|
+
*
|
|
711
|
+
* @param messages - 初始化的消息列表
|
|
712
|
+
*
|
|
713
|
+
* @example
|
|
714
|
+
* onAfterInitMessages: (messages) => {
|
|
715
|
+
* console.log(`加载了 ${messages.length} 条消息`)
|
|
716
|
+
* // 可以在这里执行消息分析等操作
|
|
717
|
+
* }
|
|
718
|
+
*/
|
|
531
719
|
onAfterInitMessages?: (messages: ConversationMessage[]) => void;
|
|
720
|
+
/**
|
|
721
|
+
* 删除会话前回调
|
|
722
|
+
* 在删除会话前调用,返回false可阻止删除
|
|
723
|
+
*
|
|
724
|
+
* @param conversationId - 要删除的会话ID
|
|
725
|
+
* @returns boolean | Promise<boolean> | void - 返回false阻止删除
|
|
726
|
+
*
|
|
727
|
+
* @example
|
|
728
|
+
* onBeforeDelConversation: (conversationId) => {
|
|
729
|
+
* window.confirm('确定要删除此会话吗?删除后无法恢复。')
|
|
730
|
+
* return confirm
|
|
731
|
+
* }
|
|
732
|
+
*/
|
|
532
733
|
onBeforeDelConversation?: (conversationId: string) => boolean | Promise<boolean> | void;
|
|
734
|
+
/**
|
|
735
|
+
* 在删除会话完成后调用
|
|
736
|
+
*
|
|
737
|
+
* @param conversationId - 已删除的会话ID
|
|
738
|
+
* @param isCurrentConversation - 是否为当前会话
|
|
739
|
+
*
|
|
740
|
+
* @example
|
|
741
|
+
* onAfterDelConversation: (conversationId, isCurrentConversation) => {
|
|
742
|
+
* console.log(`会话 ${conversationId} 已删除`)
|
|
743
|
+
* if (isCurrentConversation) {
|
|
744
|
+
* // 当前会话被删除,可能需要切换到其他会话
|
|
745
|
+
* }
|
|
746
|
+
* }
|
|
747
|
+
*/
|
|
533
748
|
onAfterDelConversation?: (conversationId: string, isCurrentConversation: boolean) => void;
|
|
749
|
+
/**
|
|
750
|
+
* 接收消息前回调
|
|
751
|
+
* 在接收到WebSocket消息后调用,返回false可阻止渲染
|
|
752
|
+
*
|
|
753
|
+
* @param message - 接收到的消息
|
|
754
|
+
* @returns boolean | Promise<boolean> | void - 返回false阻止渲染
|
|
755
|
+
*
|
|
756
|
+
* @example
|
|
757
|
+
* onBeforeAcceptMessage: (message) => {
|
|
758
|
+
* // 过滤特定类型的消息
|
|
759
|
+
* if (message.type === 'SYSTEM_NOTIFICATION') {
|
|
760
|
+
* handleSystemNotification(message)
|
|
761
|
+
* return false // 不在聊天界面显示
|
|
762
|
+
* }
|
|
763
|
+
* return true
|
|
764
|
+
* }
|
|
765
|
+
*/
|
|
766
|
+
onBeforeAcceptMessage?: (message: ConversationMessage) => boolean | Promise<boolean> | void;
|
|
767
|
+
/**
|
|
768
|
+
* 在接收到WebSocket消息并处理完成后调用
|
|
769
|
+
*
|
|
770
|
+
* @param message - 处理完成的消息
|
|
771
|
+
*
|
|
772
|
+
* @example
|
|
773
|
+
* onAfterAcceptMessage: (message) => {
|
|
774
|
+
* console.log('收到新消息:', message)
|
|
775
|
+
* // 可以在这里执行消息通知等操作
|
|
776
|
+
* }
|
|
777
|
+
*/
|
|
778
|
+
onAfterAcceptMessage?: (message: ConversationMessage) => void;
|
|
779
|
+
/**
|
|
780
|
+
* HTTP 请求拦截器
|
|
781
|
+
* 在每个HTTP请求发送前调用,可用于修改请求配置、添加认证头等
|
|
782
|
+
*
|
|
783
|
+
* 拦截器数组包含两个函数:
|
|
784
|
+
* 1. 第一个函数:处理成功的请求配置
|
|
785
|
+
* - 参数:当前请求配置对象
|
|
786
|
+
* - 返回:修改后的请求配置对象或Promise
|
|
787
|
+
* 2. 第二个函数:处理请求错误
|
|
788
|
+
* - 参数:错误对象
|
|
789
|
+
* - 返回:错误处理结果或Promise
|
|
790
|
+
*
|
|
791
|
+
* @example
|
|
792
|
+
* // 添加认证头和日志
|
|
793
|
+
* onRequestInterceptor: [
|
|
794
|
+
* (config) => {
|
|
795
|
+
* // 添加认证头
|
|
796
|
+
* config.headers.Authorization = `Bearer ${getToken()}`
|
|
797
|
+
* console.log('发送请求:', config)
|
|
798
|
+
* return config
|
|
799
|
+
* },
|
|
800
|
+
* (error) => {
|
|
801
|
+
* // 处理请求错误
|
|
802
|
+
* console.error('请求错误:', error)
|
|
803
|
+
* return Promise.reject(error)
|
|
804
|
+
* }
|
|
805
|
+
* ]
|
|
806
|
+
*/
|
|
807
|
+
onRequestInterceptor?: [(config: RequestConfig) => RequestConfig | Promise<RequestConfig>, (error: any) => any];
|
|
808
|
+
/**
|
|
809
|
+
* HTTP 响应拦截器
|
|
810
|
+
* 在每个HTTP响应返回后调用,可用于处理响应数据或错误
|
|
811
|
+
*
|
|
812
|
+
* 拦截器数组包含两个函数:
|
|
813
|
+
* 1. 第一个函数:处理成功的响应
|
|
814
|
+
* - 参数:响应对象
|
|
815
|
+
* - 返回:处理后的响应数据或Promise
|
|
816
|
+
* 2. 第二个函数:处理响应错误
|
|
817
|
+
* - 参数:错误对象
|
|
818
|
+
* - 返回:错误处理结果或Promise
|
|
819
|
+
*
|
|
820
|
+
* @example
|
|
821
|
+
* // 统一处理响应和错误
|
|
822
|
+
* onResponseInterceptor: [
|
|
823
|
+
* (response) => {
|
|
824
|
+
* // 统一处理业务错误
|
|
825
|
+
* if (response.data.code !== 200) {
|
|
826
|
+
* message.error(response.data.message)
|
|
827
|
+
* }
|
|
828
|
+
* return response.data
|
|
829
|
+
* },
|
|
830
|
+
* (error) => {
|
|
831
|
+
* // 统一处理HTTP错误
|
|
832
|
+
* if (error?.response?.status === 401) {
|
|
833
|
+
* // 未授权,跳转登录
|
|
834
|
+
* onRedirectLogin?.()
|
|
835
|
+
* }
|
|
836
|
+
* return Promise.reject(error)
|
|
837
|
+
* }
|
|
838
|
+
* ]
|
|
839
|
+
*/
|
|
840
|
+
onResponseInterceptor?: [(response: any) => any | Promise<any>, (error: any) => any];
|
|
841
|
+
/**
|
|
842
|
+
* 重定向到登录页面回调函数
|
|
843
|
+
* 当用户未授权或认证失败时调用,用于执行跳转登录逻辑
|
|
844
|
+
*
|
|
845
|
+
* 使用场景:
|
|
846
|
+
* - HTTP 401 未授权响应
|
|
847
|
+
*
|
|
848
|
+
* @example
|
|
849
|
+
* // 自定义登录跳转逻辑
|
|
850
|
+
* onRedirectLogin: () => {
|
|
851
|
+
* // 清除认证信息
|
|
852
|
+
* tokenManager.clear()
|
|
853
|
+
* userInfoManager.clear()
|
|
854
|
+
* // 跳转到登录页
|
|
855
|
+
* window.location.href = '/login'
|
|
856
|
+
* }
|
|
857
|
+
*/
|
|
858
|
+
onRedirectLogin?: () => void;
|
|
534
859
|
}
|
|
860
|
+
/**
|
|
861
|
+
* 聊天参数接口
|
|
862
|
+
* 定义聊天组件的运行时参数
|
|
863
|
+
*/
|
|
535
864
|
interface ChatParams {
|
|
536
|
-
|
|
865
|
+
/** 会话来源设置:1-罗拉-APP 2-罗拉-pc端 3-合作伙伴端 4-税协 5-罗拉-cube 6-api */
|
|
866
|
+
source: number;
|
|
867
|
+
/** 业务扩展数据,非必填 JSON字符串格式 */
|
|
537
868
|
businessData?: string;
|
|
869
|
+
/** 业务数据唯一ID 非必填 */
|
|
538
870
|
businessId?: string;
|
|
871
|
+
/** 业务类型 非必填 1-风控;2-弹窗 */
|
|
539
872
|
businessType?: number;
|
|
873
|
+
/** 扩展参数对象 透传大模型 */
|
|
540
874
|
params?: ObjectType<any>;
|
|
541
875
|
}
|
|
876
|
+
/**
|
|
877
|
+
* 聊天布局头部配置接口
|
|
878
|
+
* 控制聊天头部区域的显示和功能
|
|
879
|
+
* ChatHeader组件默认 title = true, avatar = true, closeBtn = false, newConversationBtn = true, conversationListBtn = true
|
|
880
|
+
* @example
|
|
881
|
+
* // 自定义头部配置
|
|
882
|
+
* const header: ChatLayoutHeader = {
|
|
883
|
+
* title: true, // 显示标题
|
|
884
|
+
* avatar: true, // 显示头像
|
|
885
|
+
* closeBtn: true, // 显示关闭按钮
|
|
886
|
+
* newConversationBtn: false, // 隐藏新建会话按钮
|
|
887
|
+
* agentCharacter: true, // 显示智能体性格选择
|
|
888
|
+
* conversationListBtn: true // 显示会话列表按钮
|
|
889
|
+
* }
|
|
890
|
+
*/
|
|
542
891
|
interface ChatLayoutHeader {
|
|
892
|
+
/** 标题渲染控制 */
|
|
543
893
|
title?: RenderControl<void, void>;
|
|
894
|
+
/** 头像渲染控制 */
|
|
895
|
+
avatar?: RenderControl<void, void>;
|
|
896
|
+
/** 是否显示关闭按钮 */
|
|
544
897
|
closeBtn?: boolean;
|
|
898
|
+
/** 新建会话按钮渲染控制 */
|
|
545
899
|
newConversationBtn?: RenderControl<void, void>;
|
|
900
|
+
/** 是否显示智能体性格选择 */
|
|
546
901
|
agentCharacter?: boolean;
|
|
902
|
+
/** 是否显示会话列表按钮 */
|
|
547
903
|
conversationListBtn?: boolean;
|
|
548
904
|
}
|
|
905
|
+
/**
|
|
906
|
+
* 聊天布局会话列表配置接口
|
|
907
|
+
* 控制会话列表区域的显示和功能
|
|
908
|
+
* ConversationList组件默认 header = true
|
|
909
|
+
* @example
|
|
910
|
+
* // 自定义会话列表配置
|
|
911
|
+
* const conversationList: ChatLayoutConversationList = {
|
|
912
|
+
* header: true // 显示会话列表头部
|
|
913
|
+
* }
|
|
914
|
+
*/
|
|
549
915
|
interface ChatLayoutConversationList {
|
|
916
|
+
/** 会话列表头部渲染控制 */
|
|
550
917
|
header?: RenderControl<void, void>;
|
|
551
918
|
}
|
|
919
|
+
/**
|
|
920
|
+
* 聊天布局输入框配置接口
|
|
921
|
+
* 控制输入框区域的功能和样式
|
|
922
|
+
* ChatSender组件默认 placeholder, extraBtn = false, referencesBtn = false
|
|
923
|
+
* @example
|
|
924
|
+
* // 自定义输入框配置
|
|
925
|
+
* const sender: ChatLayoutSender = {
|
|
926
|
+
* placeholder: '请输入您的问题...',
|
|
927
|
+
* extraBtn: true, // 显示额外按钮
|
|
928
|
+
* referencesBtn: true, // 显示引用按钮
|
|
929
|
+
* prompts: true, // 显示推荐问题
|
|
930
|
+
* sendBtnProps: () => ({
|
|
931
|
+
* type: 'primary',
|
|
932
|
+
* children: '发送'
|
|
933
|
+
* })
|
|
934
|
+
* }
|
|
935
|
+
*/
|
|
552
936
|
interface ChatLayoutSender {
|
|
937
|
+
/** 输入框占位符文本 */
|
|
553
938
|
placeholder?: string;
|
|
939
|
+
/** 额外按钮渲染控制 */
|
|
554
940
|
extraBtn?: RenderControl<void, void>;
|
|
941
|
+
/** 引用按钮渲染控制 */
|
|
555
942
|
referencesBtn?: RenderControl<void, void>;
|
|
943
|
+
/** 底部额外内容渲染控制 */
|
|
556
944
|
footerBelow?: RenderControl<void, void>;
|
|
945
|
+
/** 发送按钮属性配置函数 */
|
|
557
946
|
sendBtnProps?: () => ButtonProps;
|
|
947
|
+
/** 是否显示推荐问题 */
|
|
558
948
|
prompts?: boolean;
|
|
559
949
|
}
|
|
950
|
+
/**
|
|
951
|
+
* 消息列表欢迎信息配置
|
|
952
|
+
* 控制聊天界面初始欢迎信息的显示内容和自定义渲染
|
|
953
|
+
* @example
|
|
954
|
+
* // 自定义欢迎信息
|
|
955
|
+
* const welcomeMessage: ChatLayoutWelcomeMessage = {
|
|
956
|
+
* icon: true, // 显示默认图标
|
|
957
|
+
* title: {render: () => <>欢迎使用AI助手</>}, // 修改标题
|
|
958
|
+
* description: false, // 不显示详情
|
|
959
|
+
* prompts: true // 显示推荐问题
|
|
960
|
+
* }
|
|
961
|
+
*/
|
|
962
|
+
interface ChatLayoutWelcomeMessage {
|
|
963
|
+
icon?: RenderControl<void, void>;
|
|
964
|
+
title?: RenderControl<void, void>;
|
|
965
|
+
description?: RenderControl<void, void>;
|
|
966
|
+
prompts?: RenderControl<void, void>;
|
|
967
|
+
}
|
|
968
|
+
/**
|
|
969
|
+
* 聊天布局消息列表配置接口
|
|
970
|
+
* 控制消息列表区域的显示和功能
|
|
971
|
+
* @example
|
|
972
|
+
* // 自定义消息列表配置
|
|
973
|
+
* const messageList: ChatLayoutMessageList = {
|
|
974
|
+
* avatar: {
|
|
975
|
+
* user: true,
|
|
976
|
+
* agent: true,
|
|
977
|
+
* other: false
|
|
978
|
+
* },
|
|
979
|
+
* firstMessage: false // 不显示首条消息
|
|
980
|
+
* welcomeMessage: false // 不显示欢迎消息
|
|
981
|
+
* }
|
|
982
|
+
*/
|
|
560
983
|
interface ChatLayoutMessageList {
|
|
984
|
+
/** 头像显示控制:可以是全局布尔值或按成员类型分别控制 */
|
|
561
985
|
avatar?: boolean | Partial<Record<ConversationMemberEnum, boolean>>;
|
|
986
|
+
/** 首条消息渲染控制 */
|
|
562
987
|
firstMessage?: RenderControl<void, void>;
|
|
988
|
+
/** 欢迎消息渲染控制, 要渲染时如果列表有内容则不渲染 */
|
|
989
|
+
welcomeMessage?: RenderControl<void, ChatLayoutWelcomeMessage>;
|
|
563
990
|
}
|
|
991
|
+
/**
|
|
992
|
+
* 聊天布局配置接口(专家和智能体各有一套默认布局)
|
|
993
|
+
* 控制聊天组件整体布局的显示和功能
|
|
994
|
+
*
|
|
995
|
+
* @example
|
|
996
|
+
* const layout: ChatLayout = {
|
|
997
|
+
* leftPanel: false,
|
|
998
|
+
* conversationList: false,
|
|
999
|
+
* preview: false,
|
|
1000
|
+
* messageList: true,
|
|
1001
|
+
* sender: {
|
|
1002
|
+
* props: {
|
|
1003
|
+
* prompts: false
|
|
1004
|
+
* }
|
|
1005
|
+
* },
|
|
1006
|
+
* chatHeader: {
|
|
1007
|
+
* render: (props) => <div>{props.children}</div>:
|
|
1008
|
+
* },
|
|
1009
|
+
* disclaimerNotice: false
|
|
1010
|
+
* }
|
|
1011
|
+
*/
|
|
564
1012
|
interface ChatLayout {
|
|
1013
|
+
/** 左侧面板渲染控制 */
|
|
565
1014
|
leftPanel?: RenderControl<void, void>;
|
|
1015
|
+
/** 会话列表面板渲染控制 */
|
|
566
1016
|
conversationList?: RenderControl<void, ChatLayoutConversationList>;
|
|
1017
|
+
/** 是否允许预览功能 */
|
|
567
1018
|
preview?: boolean;
|
|
1019
|
+
/** 消息列表渲染控制 */
|
|
568
1020
|
messageList?: RenderControl<void, ChatLayoutMessageList>;
|
|
1021
|
+
/** 输入框头部渲染控制 */
|
|
569
1022
|
senderHeader?: RenderControl<void, void>;
|
|
1023
|
+
/** 输入框渲染控制 */
|
|
570
1024
|
sender?: RenderControl<void, ChatLayoutSender>;
|
|
1025
|
+
/** 输入框底部渲染控制 */
|
|
571
1026
|
senderFooter?: RenderControl<void, void>;
|
|
1027
|
+
/** 全局头部渲染控制 */
|
|
572
1028
|
globalHeader?: RenderControl<void, ChatLayoutHeader>;
|
|
1029
|
+
/** 聊天区域头部渲染控制 */
|
|
573
1030
|
chatHeader?: RenderControl<void, ChatLayoutHeader>;
|
|
1031
|
+
/** 免责声明渲染控制 */
|
|
574
1032
|
disclaimerNotice?: RenderControl<void, void>;
|
|
575
1033
|
}
|
|
1034
|
+
type RequestInstance = ReturnType<typeof createChatService> & ReturnType<typeof createFileService>;
|
|
1035
|
+
/**
|
|
1036
|
+
* 聊天HTTP服务配置接口
|
|
1037
|
+
* 定义聊天组件所需的HTTP服务配置,用于API请求
|
|
1038
|
+
*/
|
|
1039
|
+
interface ChatHttpServices {
|
|
1040
|
+
/**
|
|
1041
|
+
* 基于axios扩展的配置参数
|
|
1042
|
+
* 支持所有axios配置选项,如baseURL、timeout、headers等
|
|
1043
|
+
* @see {@link RequestConfig}
|
|
1044
|
+
*/
|
|
1045
|
+
config?: RequestConfig;
|
|
1046
|
+
/**
|
|
1047
|
+
* 聊天服务和文件服务的合并请求对象(没有测试,暂时不使用)
|
|
1048
|
+
* 可以提供自定义的请求实例,用于替代默认创建的实例
|
|
1049
|
+
*/
|
|
1050
|
+
request?: RequestInstance;
|
|
1051
|
+
}
|
|
1052
|
+
/**
|
|
1053
|
+
* 聊天WebSocket服务配置接口
|
|
1054
|
+
* 定义聊天组件所需的WebSocket服务配置,用于实时消息通信
|
|
1055
|
+
*/
|
|
1056
|
+
interface ChatWebsocketServices {
|
|
1057
|
+
/**
|
|
1058
|
+
* WebSocket连接基础URL列表,支持多地址容错(目前只支持两个地址)
|
|
1059
|
+
*
|
|
1060
|
+
* 使用方式:
|
|
1061
|
+
* - undefined: 继承http.config.baseURL的值
|
|
1062
|
+
* - []: 空数组表示关闭WebSocket功能
|
|
1063
|
+
* - [url]: 单个URL用于WebSocket连接
|
|
1064
|
+
* - [url1, url2]: 两个URL用于WebSocket连接,支持多端容错
|
|
1065
|
+
*/
|
|
1066
|
+
baseURLs?: (string | undefined)[];
|
|
1067
|
+
/**
|
|
1068
|
+
* WebSocket连接参数
|
|
1069
|
+
* - undefined: 继承http.config.headers的值
|
|
1070
|
+
* 附加到WebSocket URL上的查询参数
|
|
1071
|
+
*/
|
|
1072
|
+
params?: Record<string, string | number>;
|
|
1073
|
+
}
|
|
1074
|
+
/**
|
|
1075
|
+
* 聊天服务配置接口
|
|
1076
|
+
* 定义聊天组件所需的所有服务配置,包括HTTP和WebSocket
|
|
1077
|
+
* * @example
|
|
1078
|
+
* // 基本配置,使用默认继承
|
|
1079
|
+
* const services: ChatServices = {
|
|
1080
|
+
* http: {
|
|
1081
|
+
* config: {
|
|
1082
|
+
* baseURL: '/api',
|
|
1083
|
+
* timeout: 10000,
|
|
1084
|
+
* headers: { 'NS-TOKEN': '123456' }
|
|
1085
|
+
* }
|
|
1086
|
+
* },
|
|
1087
|
+
* websocket: {} // 继承http的baseURL和headers参数
|
|
1088
|
+
* }
|
|
1089
|
+
*
|
|
1090
|
+
* @example
|
|
1091
|
+
* // 自定义WebSocket配置
|
|
1092
|
+
* const services: ChatServices = {
|
|
1093
|
+
* http: {
|
|
1094
|
+
* config: { baseURL: '/api' }
|
|
1095
|
+
* },
|
|
1096
|
+
* websocket: {
|
|
1097
|
+
* baseURLs: ['/api', '/api/saas'],
|
|
1098
|
+
* params: { token: 'abc123' }
|
|
1099
|
+
* }
|
|
1100
|
+
* }
|
|
1101
|
+
*
|
|
1102
|
+
* @example
|
|
1103
|
+
* // 关闭WebSocket功能
|
|
1104
|
+
* const services: ChatServices = {
|
|
1105
|
+
* http: {
|
|
1106
|
+
* config: { baseURL: '/api' }
|
|
1107
|
+
* },
|
|
1108
|
+
* websocket: {
|
|
1109
|
+
* baseURLs: [] // 空数组表示关闭WebSocket
|
|
1110
|
+
* }
|
|
1111
|
+
* }
|
|
1112
|
+
*/
|
|
576
1113
|
interface ChatServices {
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
1114
|
+
/** HTTP服务配置 */
|
|
1115
|
+
http?: ChatHttpServices;
|
|
1116
|
+
/** WebSocket服务配置 */
|
|
1117
|
+
websocket?: ChatWebsocketServices;
|
|
580
1118
|
}
|
|
581
1119
|
|
|
582
1120
|
/**
|
|
@@ -659,33 +1197,326 @@ interface SenderProps {
|
|
|
659
1197
|
}
|
|
660
1198
|
declare const _default$2: react.ForwardRefExoticComponent<SenderProps & react.RefAttributes<ChatSenderHandle>>;
|
|
661
1199
|
|
|
1200
|
+
/**
|
|
1201
|
+
* 聊天组件配置接口
|
|
1202
|
+
* 定义聊天组件的初始化配置选项
|
|
1203
|
+
*
|
|
1204
|
+
* @example
|
|
1205
|
+
* // 基本配置 - 指定智能体
|
|
1206
|
+
* const config: ChatConfig = {
|
|
1207
|
+
* receiverType: 3, // 智能体类型
|
|
1208
|
+
* receiverId: 'agent-001', // 智能体ID
|
|
1209
|
+
* conversationStrategy: 2 // 创建新会话
|
|
1210
|
+
* }
|
|
1211
|
+
*
|
|
1212
|
+
* @example
|
|
1213
|
+
* // 指定已有会话
|
|
1214
|
+
* const config: ChatConfig = {
|
|
1215
|
+
* conversationId: 'conv-001' // 直接打开指定会话
|
|
1216
|
+
* }
|
|
1217
|
+
*/
|
|
662
1218
|
interface ChatConfig {
|
|
1219
|
+
/** 接收者类型:1-用户 2-专家 3-Agent; 控制默认布局显示 */
|
|
663
1220
|
receiverType?: number;
|
|
1221
|
+
/** 接收者ID:专家或智能体ID */
|
|
664
1222
|
receiverId?: string;
|
|
1223
|
+
/** 会话ID:已存在的会话ID */
|
|
665
1224
|
conversationId?: string;
|
|
1225
|
+
/** 会话策略:1-最近会话 2-新会话 */
|
|
666
1226
|
conversationStrategy?: ConversationStrategy;
|
|
667
1227
|
}
|
|
1228
|
+
/**
|
|
1229
|
+
* 提供外部操作聊天组件的方法
|
|
1230
|
+
*
|
|
1231
|
+
* @example
|
|
1232
|
+
* // 使用ref调用组件方法
|
|
1233
|
+
* const chatRef = useRef<ChatHandle>(null)
|
|
1234
|
+
* // 在组件中使用
|
|
1235
|
+
* <Chat ref={chatRef} config={chatConfig} />
|
|
1236
|
+
*
|
|
1237
|
+
* // 发送消息
|
|
1238
|
+
* chatRef.current?.sendMessage('你好,帮我分析一下这份报表')
|
|
1239
|
+
*
|
|
1240
|
+
* // 切换智能体会话
|
|
1241
|
+
* chatRef.current?.switchAgentConversation('agent-002')
|
|
1242
|
+
*
|
|
1243
|
+
* // 创建新会话
|
|
1244
|
+
* chatRef.current?.createConversation()
|
|
1245
|
+
*
|
|
1246
|
+
* // 设置引用内容
|
|
1247
|
+
* chatRef.current?.setReferences({
|
|
1248
|
+
* type: 1,
|
|
1249
|
+
* content: {
|
|
1250
|
+
* name: '法规条款',
|
|
1251
|
+
* markdown: '> 根据《企业所得税法》第XX条规定...'
|
|
1252
|
+
* }
|
|
1253
|
+
* })
|
|
1254
|
+
*
|
|
1255
|
+
* // 聚焦输入框
|
|
1256
|
+
* chatRef.current?.senderFocus()
|
|
1257
|
+
*/
|
|
668
1258
|
interface ChatHandle {
|
|
669
|
-
|
|
1259
|
+
/** 发送消息
|
|
1260
|
+
* @param message - 消息内容,如果提供则直接发送该内容,否则使用输入框内容, 且两者必须存在一个
|
|
1261
|
+
* @param files - 文件列表,与消息一起发送的文件
|
|
1262
|
+
* @param params - 透传给大模型的参数,用于控制模型行为
|
|
1263
|
+
*
|
|
1264
|
+
* @remarks
|
|
1265
|
+
* 1. 传参调用则只会将参数直接传入接口,不会影响当前输入框数据
|
|
1266
|
+
* 2. 参数为空则触发默认逻辑,收集输入框数据、引用等内容发送
|
|
1267
|
+
* 3. 如果基于1想发送引用等内容,可以调用setMessage(message)-->sendMessage()
|
|
1268
|
+
*
|
|
1269
|
+
* @example
|
|
1270
|
+
* // 直接发送消息(不影响输入框)
|
|
1271
|
+
* chatRef.current?.sendMessage('你好,帮我分析一下这份报表')
|
|
1272
|
+
*
|
|
1273
|
+
* @example
|
|
1274
|
+
* // 触发默认逻辑(收集输入框内容发送)
|
|
1275
|
+
* chatRef.current?.sendMessage()
|
|
1276
|
+
*/
|
|
1277
|
+
sendMessage: (message?: string, files?: InputFile[], params?: ObjectType<any>) => void;
|
|
1278
|
+
/**
|
|
1279
|
+
* 切换智能体会话
|
|
1280
|
+
* 切换到指定的智能体并创建或获取会话
|
|
1281
|
+
*
|
|
1282
|
+
* @param agentId - 目标智能体ID
|
|
1283
|
+
* @param strategy - 会话策略,1-使用最近会话,2-创建新会话
|
|
1284
|
+
*
|
|
1285
|
+
* @example
|
|
1286
|
+
* // 切换到指定智能体并创建新会话
|
|
1287
|
+
* chatRef.current?.switchAgentConversation('agent-001')
|
|
1288
|
+
*
|
|
1289
|
+
* @example
|
|
1290
|
+
* // 切换到指定智能体并使用最近会话
|
|
1291
|
+
* chatRef.current?.switchAgentConversation('agent-001', 1)
|
|
1292
|
+
*/
|
|
670
1293
|
switchAgentConversation: (agentId: AgentInfo['id'], strategy?: ConversationStrategy) => Promise<void>;
|
|
671
|
-
|
|
1294
|
+
/**
|
|
1295
|
+
* 切换到指定的会话
|
|
1296
|
+
*
|
|
1297
|
+
* @param id - 目标会话ID
|
|
1298
|
+
*
|
|
1299
|
+
* @example
|
|
1300
|
+
* // 切换到指定会话
|
|
1301
|
+
* chatRef.current?.switchConversation('conv-001')
|
|
1302
|
+
*/
|
|
1303
|
+
switchConversation: (id: Conversation['id']) => Promise<void>;
|
|
1304
|
+
/**
|
|
1305
|
+
* 基于当前接收者创建新的会话
|
|
1306
|
+
*
|
|
1307
|
+
* @example
|
|
1308
|
+
* // 创建新会话
|
|
1309
|
+
* chatRef.current?.createConversation()
|
|
1310
|
+
*/
|
|
672
1311
|
createConversation: () => Promise<void>;
|
|
1312
|
+
/**
|
|
1313
|
+
* 设置引用消息
|
|
1314
|
+
* 在输入框中设置引用内容,将在下次发送消息时包含引用信息
|
|
1315
|
+
*
|
|
1316
|
+
* @param references - 引用内容对象
|
|
1317
|
+
*
|
|
1318
|
+
* @example
|
|
1319
|
+
* // 设置Markdown引用
|
|
1320
|
+
* chatRef.current?.setReferences({
|
|
1321
|
+
* type: 1,
|
|
1322
|
+
* content: {
|
|
1323
|
+
* name: '法规条款',
|
|
1324
|
+
* markdown: '> 根据《企业所得税法》第XX条规定...'
|
|
1325
|
+
* },
|
|
1326
|
+
* params: {
|
|
1327
|
+
* source: 'law-001'
|
|
1328
|
+
* }
|
|
1329
|
+
* })
|
|
1330
|
+
*
|
|
1331
|
+
* @example
|
|
1332
|
+
* // 清除引用
|
|
1333
|
+
* chatRef.current?.setReferences(undefined)
|
|
1334
|
+
*/
|
|
673
1335
|
setReferences: (references?: ReferencesType) => void;
|
|
1336
|
+
/**
|
|
1337
|
+
* 直接设置输入框中的文本内容
|
|
1338
|
+
*
|
|
1339
|
+
* @param message - 要设置的消息内容
|
|
1340
|
+
*
|
|
1341
|
+
* @example
|
|
1342
|
+
* // 设置输入框内容
|
|
1343
|
+
* chatRef.current?.setMessage('请帮我分析以下问题...')
|
|
1344
|
+
*
|
|
1345
|
+
* @example
|
|
1346
|
+
* // 清空输入框
|
|
1347
|
+
* chatRef.current?.setMessage('')
|
|
1348
|
+
*/
|
|
674
1349
|
setMessage: (message?: string) => void;
|
|
1350
|
+
/**
|
|
1351
|
+
* 设置输入框中要上传的文件列表
|
|
1352
|
+
*
|
|
1353
|
+
* @param files - 文件列表
|
|
1354
|
+
*
|
|
1355
|
+
* @example
|
|
1356
|
+
* // 设置文件列表
|
|
1357
|
+
* chatRef.current?.setFiles([
|
|
1358
|
+
* {
|
|
1359
|
+
* fileId: 'file-001',
|
|
1360
|
+
* fileName: '财务报表.xlsx',
|
|
1361
|
+
* fileUrl: '/files/report.xlsx'
|
|
1362
|
+
* }
|
|
1363
|
+
* ])
|
|
1364
|
+
*
|
|
1365
|
+
* @example
|
|
1366
|
+
* // 清空文件列表
|
|
1367
|
+
* chatRef.current?.setFiles([])
|
|
1368
|
+
*/
|
|
675
1369
|
setFiles: (files?: InputFile[]) => void;
|
|
1370
|
+
/**
|
|
1371
|
+
* 设置全局参数
|
|
1372
|
+
* 更新聊天组件运行时需要的参数
|
|
1373
|
+
*
|
|
1374
|
+
* @param params - 聊天参数对象
|
|
1375
|
+
*
|
|
1376
|
+
* @example
|
|
1377
|
+
* // 设置业务参数
|
|
1378
|
+
* chatRef.current?.setParams({
|
|
1379
|
+
* businessId: 'case-001',
|
|
1380
|
+
* businessType: 2,
|
|
1381
|
+
* source: 1
|
|
1382
|
+
* })
|
|
1383
|
+
*
|
|
1384
|
+
* @example
|
|
1385
|
+
* // 设置扩展参数, 透传大模型
|
|
1386
|
+
* chatRef.current?.setParams({
|
|
1387
|
+
* params: {
|
|
1388
|
+
* textInfo: '税务局',
|
|
1389
|
+
* }
|
|
1390
|
+
* })
|
|
1391
|
+
*/
|
|
676
1392
|
setParams: (params?: ChatParams) => void;
|
|
1393
|
+
/**
|
|
1394
|
+
* 设置服务配置
|
|
1395
|
+
* 动态更新聊天组件的服务配置
|
|
1396
|
+
*
|
|
1397
|
+
* @param services - 服务配置对象
|
|
1398
|
+
*
|
|
1399
|
+
* @example
|
|
1400
|
+
* // 更新HTTP配置,WebSocket继承
|
|
1401
|
+
* chatRef.current?.setServices({
|
|
1402
|
+
* http: {
|
|
1403
|
+
* config: {
|
|
1404
|
+
* baseURL: '/new-api',
|
|
1405
|
+
* headers: {
|
|
1406
|
+
* token: 'new-token'
|
|
1407
|
+
* }
|
|
1408
|
+
* }
|
|
1409
|
+
* }
|
|
1410
|
+
* })
|
|
1411
|
+
*
|
|
1412
|
+
* @example
|
|
1413
|
+
* // 更新WebSocket配置,http使用默认
|
|
1414
|
+
* chatRef.current?.setServices({
|
|
1415
|
+
* websocket: {
|
|
1416
|
+
* baseURLs: ['/api', '/api/backup'],
|
|
1417
|
+
* params: {
|
|
1418
|
+
* token: 'new-token'
|
|
1419
|
+
* }
|
|
1420
|
+
* }
|
|
1421
|
+
* })
|
|
1422
|
+
*/
|
|
677
1423
|
setServices: (services?: ChatServices) => void;
|
|
1424
|
+
/**
|
|
1425
|
+
* 输入框聚焦
|
|
1426
|
+
* 使聊天输入框获得焦点
|
|
1427
|
+
*
|
|
1428
|
+
* @example
|
|
1429
|
+
* // 聚焦输入框
|
|
1430
|
+
* chatRef.current?.senderFocus()
|
|
1431
|
+
*/
|
|
678
1432
|
senderFocus: ChatSenderHandle['focus'];
|
|
679
1433
|
}
|
|
1434
|
+
/**
|
|
1435
|
+
* 聊天组件属性接口
|
|
1436
|
+
* 定义聊天组件的输入属性
|
|
1437
|
+
*/
|
|
680
1438
|
interface ChatProps {
|
|
1439
|
+
/** 主题配置 */
|
|
681
1440
|
theme?: ThemeConfig;
|
|
1441
|
+
/** 聊天配置 */
|
|
682
1442
|
config?: ChatConfig;
|
|
1443
|
+
/** 聊天参数 */
|
|
683
1444
|
params?: ChatParams;
|
|
1445
|
+
/** 生命周期钩子 */
|
|
684
1446
|
hooks?: ChatHooks;
|
|
1447
|
+
/** 布局配置 */
|
|
685
1448
|
layout?: ChatLayout;
|
|
1449
|
+
/** 用户信息, 如果会话成员类型可以区分当前用户则不需要传入此参数;否则必传id */
|
|
686
1450
|
userInfo?: UserInfo;
|
|
1451
|
+
/** 服务配置 */
|
|
687
1452
|
services?: ChatServices;
|
|
688
1453
|
}
|
|
1454
|
+
|
|
1455
|
+
/**
|
|
1456
|
+
* 聊天组件
|
|
1457
|
+
* 使用 React.forwardRef 实现的聊天界面组件
|
|
1458
|
+
* 集成了消息收发、会话管理、文件预览等功能
|
|
1459
|
+
*
|
|
1460
|
+
* @example
|
|
1461
|
+
* // 基本使用
|
|
1462
|
+
* <Chat
|
|
1463
|
+
* config={{
|
|
1464
|
+
* receiverType: 3,
|
|
1465
|
+
* receiverId: 'agent-001'
|
|
1466
|
+
* }}
|
|
1467
|
+
* params={{
|
|
1468
|
+
* businessId: 'case-001',
|
|
1469
|
+
* businessType: 2
|
|
1470
|
+
* }}
|
|
1471
|
+
* />
|
|
1472
|
+
*
|
|
1473
|
+
* @example
|
|
1474
|
+
* <Chat
|
|
1475
|
+
* config={{
|
|
1476
|
+
* receiverType: 3,
|
|
1477
|
+
* receiverId: 'agent-001'
|
|
1478
|
+
* }}
|
|
1479
|
+
* params={{
|
|
1480
|
+
* businessId: 'case-001',
|
|
1481
|
+
* businessType: 2
|
|
1482
|
+
* }}
|
|
1483
|
+
* // 钩子配置
|
|
1484
|
+
* hooks={{
|
|
1485
|
+
* onBeforeSend: (message, files) => {
|
|
1486
|
+
* if (!message?.trim()) {
|
|
1487
|
+
* message.error('请输入消息内容')
|
|
1488
|
+
* return false
|
|
1489
|
+
* }
|
|
1490
|
+
* return true
|
|
1491
|
+
* },
|
|
1492
|
+
* onAfterSend: () => {
|
|
1493
|
+
* console.log('消息发送完成')
|
|
1494
|
+
* }
|
|
1495
|
+
* }}
|
|
1496
|
+
* // 布局配置
|
|
1497
|
+
* layout={{
|
|
1498
|
+
* preview: true,
|
|
1499
|
+
* sender: {
|
|
1500
|
+
* props: {
|
|
1501
|
+
* placeholder: '请输入您的问题...'
|
|
1502
|
+
* }
|
|
1503
|
+
* }
|
|
1504
|
+
* }}
|
|
1505
|
+
* // 服务配置
|
|
1506
|
+
* services={{
|
|
1507
|
+
* http: {
|
|
1508
|
+
* config: {
|
|
1509
|
+
* baseURL: '/api',
|
|
1510
|
+
* timeout: 30000
|
|
1511
|
+
* }
|
|
1512
|
+
* },
|
|
1513
|
+
* websocket: {
|
|
1514
|
+
* baseURLs: ['/api', '/api/backup']
|
|
1515
|
+
* }
|
|
1516
|
+
* }}
|
|
1517
|
+
* />
|
|
1518
|
+
*
|
|
1519
|
+
*/
|
|
689
1520
|
declare const _default$1: react.ForwardRefExoticComponent<ChatProps & react.RefAttributes<ChatHandle>>;
|
|
690
1521
|
|
|
691
1522
|
/**
|
|
@@ -703,4 +1534,4 @@ interface MessageRenderProps {
|
|
|
703
1534
|
*/
|
|
704
1535
|
declare const _default: ({ message, placement }: MessageRenderProps) => react_jsx_runtime.JSX.Element;
|
|
705
1536
|
|
|
706
|
-
export { type AgentInfo, _default$3 as Attachments, type AttachmentsProps, 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 MessageRenderProps, type ReferencesType, type SenderProps };
|
|
1537
|
+
export { type AgentInfo, _default$3 as Attachments, type AttachmentsProps, type ChatConfig, _default$1 as ChatCopilot, type ChatHandle, type ChatHooks, type ChatLayout, type ChatParams, type ChatProps, _default$2 as ChatSender, type ChatServices, type ConversationStrategy, type InputFile, _default as MessageRender, type MessageRenderProps, type ReferencesType, type RequestInstance, type SenderProps, type UserInfo };
|