@zero-library/chat-agent 2.3.11 → 2.3.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 +46 -14
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.mts +28 -4
- package/dist/index.d.ts +28 -4
- package/dist/index.esm.js +46 -14
- package/dist/index.esm.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -403,6 +403,8 @@ interface LabelItemUpdate extends LabelItemPrompt {
|
|
|
403
403
|
* 快速提问列表查询参数接口
|
|
404
404
|
*/
|
|
405
405
|
interface LabelItemListQuery {
|
|
406
|
+
/** 智能体ID */
|
|
407
|
+
agentId: AgentInfo['id'];
|
|
406
408
|
/** 分类ID */
|
|
407
409
|
labelId?: string;
|
|
408
410
|
/** 搜索关键字 */
|
|
@@ -414,24 +416,43 @@ interface LabelItemListQuery {
|
|
|
414
416
|
interface LabelItem extends LabelItemUpdate {
|
|
415
417
|
/** 问题ID */
|
|
416
418
|
id: string;
|
|
417
|
-
|
|
419
|
+
/** 智能体ID */
|
|
420
|
+
agentId: AgentInfo['id'];
|
|
421
|
+
/** 排序序号 */
|
|
418
422
|
seq: number;
|
|
419
423
|
/** 是否置顶 */
|
|
420
424
|
isTop?: 1 | 0;
|
|
425
|
+
/** 创建时间戳 */
|
|
421
426
|
createTime: number;
|
|
427
|
+
/** 更新时间戳 */
|
|
422
428
|
updateTime: number;
|
|
429
|
+
/** 是否允许删除 */
|
|
423
430
|
canDelete?: boolean;
|
|
424
431
|
}
|
|
432
|
+
/**
|
|
433
|
+
* 快速提问分类查询参数接口
|
|
434
|
+
*/
|
|
425
435
|
interface LabelQuery extends PageReq {
|
|
436
|
+
/** 智能体ID */
|
|
437
|
+
agentId: AgentInfo['id'];
|
|
438
|
+
/** 业务扩展数据,非必填 JSON字符串格式 */
|
|
439
|
+
businessData?: string;
|
|
440
|
+
/** 分类名称 */
|
|
426
441
|
labelName?: string;
|
|
427
442
|
}
|
|
443
|
+
/**
|
|
444
|
+
* 快速提问分类接口
|
|
445
|
+
*/
|
|
428
446
|
interface LabelType {
|
|
429
447
|
/** 分类ID */
|
|
430
448
|
id: string;
|
|
431
449
|
/** 分类名称 */
|
|
432
450
|
labelName: string;
|
|
451
|
+
/** 创建时间戳 */
|
|
433
452
|
createTime: number;
|
|
453
|
+
/** 更新时间戳 */
|
|
434
454
|
updateTime: number;
|
|
455
|
+
/** 是否允许删除 */
|
|
435
456
|
canDelete?: boolean;
|
|
436
457
|
}
|
|
437
458
|
/**
|
|
@@ -467,8 +488,11 @@ interface FavoriteConversationsQuery extends PageReq {
|
|
|
467
488
|
* 收藏列表返回数据结构
|
|
468
489
|
*/
|
|
469
490
|
interface FavoriteConversationType {
|
|
491
|
+
/** 收藏ID */
|
|
470
492
|
id: string;
|
|
493
|
+
/** 收藏标题 */
|
|
471
494
|
title: string;
|
|
495
|
+
/** 收藏时间 */
|
|
472
496
|
favoriteTime: string;
|
|
473
497
|
}
|
|
474
498
|
/**
|
|
@@ -498,8 +522,8 @@ declare const createChatService: (request: ReturnType<typeof createRequest>) =>
|
|
|
498
522
|
fileUpload: (formData: FormData) => Promise<R<InputFile>>;
|
|
499
523
|
labelItemUpdate: (agentId: AgentInfo["id"], params: LabelItemUpdate) => Promise<R<LabelItem["id"]>>;
|
|
500
524
|
labelItemDelete: (id: LabelItem["id"]) => Promise<R<null>>;
|
|
501
|
-
labelsQuery: (
|
|
502
|
-
labelItemsQuery: (
|
|
525
|
+
labelsQuery: (params?: LabelQuery) => Promise<R<PageRes<LabelType>>>;
|
|
526
|
+
labelItemsQuery: (params: LabelItemListQuery) => Promise<R<LabelItem[]>>;
|
|
503
527
|
labelItemTop: (params: LabelItemTop) => Promise<R<null>>;
|
|
504
528
|
labelItemPromptAssistant: (prompt: string) => Promise<R<LabelItemPrompt>>;
|
|
505
529
|
recommendQuestionsQuery: (agentId: AgentInfo["id"], conversationId: ConversationType["id"]) => Promise<R<string[]>>;
|
|
@@ -1695,7 +1719,7 @@ interface ChatHandle {
|
|
|
1695
1719
|
*/
|
|
1696
1720
|
setServices: (services?: ChatServices) => void;
|
|
1697
1721
|
/**
|
|
1698
|
-
*
|
|
1722
|
+
* 输入框聚焦(如果前一步是设置message,最好加个延时)
|
|
1699
1723
|
* 使聊天输入框获得焦点
|
|
1700
1724
|
*
|
|
1701
1725
|
* @example
|
package/dist/index.d.ts
CHANGED
|
@@ -403,6 +403,8 @@ interface LabelItemUpdate extends LabelItemPrompt {
|
|
|
403
403
|
* 快速提问列表查询参数接口
|
|
404
404
|
*/
|
|
405
405
|
interface LabelItemListQuery {
|
|
406
|
+
/** 智能体ID */
|
|
407
|
+
agentId: AgentInfo['id'];
|
|
406
408
|
/** 分类ID */
|
|
407
409
|
labelId?: string;
|
|
408
410
|
/** 搜索关键字 */
|
|
@@ -414,24 +416,43 @@ interface LabelItemListQuery {
|
|
|
414
416
|
interface LabelItem extends LabelItemUpdate {
|
|
415
417
|
/** 问题ID */
|
|
416
418
|
id: string;
|
|
417
|
-
|
|
419
|
+
/** 智能体ID */
|
|
420
|
+
agentId: AgentInfo['id'];
|
|
421
|
+
/** 排序序号 */
|
|
418
422
|
seq: number;
|
|
419
423
|
/** 是否置顶 */
|
|
420
424
|
isTop?: 1 | 0;
|
|
425
|
+
/** 创建时间戳 */
|
|
421
426
|
createTime: number;
|
|
427
|
+
/** 更新时间戳 */
|
|
422
428
|
updateTime: number;
|
|
429
|
+
/** 是否允许删除 */
|
|
423
430
|
canDelete?: boolean;
|
|
424
431
|
}
|
|
432
|
+
/**
|
|
433
|
+
* 快速提问分类查询参数接口
|
|
434
|
+
*/
|
|
425
435
|
interface LabelQuery extends PageReq {
|
|
436
|
+
/** 智能体ID */
|
|
437
|
+
agentId: AgentInfo['id'];
|
|
438
|
+
/** 业务扩展数据,非必填 JSON字符串格式 */
|
|
439
|
+
businessData?: string;
|
|
440
|
+
/** 分类名称 */
|
|
426
441
|
labelName?: string;
|
|
427
442
|
}
|
|
443
|
+
/**
|
|
444
|
+
* 快速提问分类接口
|
|
445
|
+
*/
|
|
428
446
|
interface LabelType {
|
|
429
447
|
/** 分类ID */
|
|
430
448
|
id: string;
|
|
431
449
|
/** 分类名称 */
|
|
432
450
|
labelName: string;
|
|
451
|
+
/** 创建时间戳 */
|
|
433
452
|
createTime: number;
|
|
453
|
+
/** 更新时间戳 */
|
|
434
454
|
updateTime: number;
|
|
455
|
+
/** 是否允许删除 */
|
|
435
456
|
canDelete?: boolean;
|
|
436
457
|
}
|
|
437
458
|
/**
|
|
@@ -467,8 +488,11 @@ interface FavoriteConversationsQuery extends PageReq {
|
|
|
467
488
|
* 收藏列表返回数据结构
|
|
468
489
|
*/
|
|
469
490
|
interface FavoriteConversationType {
|
|
491
|
+
/** 收藏ID */
|
|
470
492
|
id: string;
|
|
493
|
+
/** 收藏标题 */
|
|
471
494
|
title: string;
|
|
495
|
+
/** 收藏时间 */
|
|
472
496
|
favoriteTime: string;
|
|
473
497
|
}
|
|
474
498
|
/**
|
|
@@ -498,8 +522,8 @@ declare const createChatService: (request: ReturnType<typeof createRequest>) =>
|
|
|
498
522
|
fileUpload: (formData: FormData) => Promise<R<InputFile>>;
|
|
499
523
|
labelItemUpdate: (agentId: AgentInfo["id"], params: LabelItemUpdate) => Promise<R<LabelItem["id"]>>;
|
|
500
524
|
labelItemDelete: (id: LabelItem["id"]) => Promise<R<null>>;
|
|
501
|
-
labelsQuery: (
|
|
502
|
-
labelItemsQuery: (
|
|
525
|
+
labelsQuery: (params?: LabelQuery) => Promise<R<PageRes<LabelType>>>;
|
|
526
|
+
labelItemsQuery: (params: LabelItemListQuery) => Promise<R<LabelItem[]>>;
|
|
503
527
|
labelItemTop: (params: LabelItemTop) => Promise<R<null>>;
|
|
504
528
|
labelItemPromptAssistant: (prompt: string) => Promise<R<LabelItemPrompt>>;
|
|
505
529
|
recommendQuestionsQuery: (agentId: AgentInfo["id"], conversationId: ConversationType["id"]) => Promise<R<string[]>>;
|
|
@@ -1695,7 +1719,7 @@ interface ChatHandle {
|
|
|
1695
1719
|
*/
|
|
1696
1720
|
setServices: (services?: ChatServices) => void;
|
|
1697
1721
|
/**
|
|
1698
|
-
*
|
|
1722
|
+
* 输入框聚焦(如果前一步是设置message,最好加个延时)
|
|
1699
1723
|
* 使聊天输入框获得焦点
|
|
1700
1724
|
*
|
|
1701
1725
|
* @example
|
package/dist/index.esm.js
CHANGED
|
@@ -179,7 +179,7 @@ var init_MdEdit = __esm({
|
|
|
179
179
|
setValue(data.content);
|
|
180
180
|
}, [data.content]);
|
|
181
181
|
return /* @__PURE__ */ jsxs("div", { className: styles_module_default.mdEdit, children: [
|
|
182
|
-
/* @__PURE__ */ jsx(MarkdownEditor, { disabled: loading, value, onChange: setValue,
|
|
182
|
+
/* @__PURE__ */ jsx(MarkdownEditor, { disabled: loading, value, onChange: setValue, fixedToolbar: false, floatToolbar: false }),
|
|
183
183
|
!loading && /* @__PURE__ */ jsx(Flex, { justify: "end", className: "m-t-16", children: /* @__PURE__ */ jsx(Button, { color: "primary", variant: "outlined", onClick: onOk, children: btnText }) })
|
|
184
184
|
] });
|
|
185
185
|
};
|
|
@@ -419,11 +419,11 @@ var createChatService = (request) => {
|
|
|
419
419
|
const labelItemDelete = (id) => {
|
|
420
420
|
return request.delete("/lolr/label/item", { id });
|
|
421
421
|
};
|
|
422
|
-
const labelsQuery = (
|
|
423
|
-
return request.get("/lolr/label",
|
|
422
|
+
const labelsQuery = (params) => {
|
|
423
|
+
return request.get("/lolr/label", params);
|
|
424
424
|
};
|
|
425
|
-
const labelItemsQuery = (
|
|
426
|
-
return request.get("/lolr/label/item",
|
|
425
|
+
const labelItemsQuery = (params) => {
|
|
426
|
+
return request.get("/lolr/label/item", params);
|
|
427
427
|
};
|
|
428
428
|
const labelItemTop = (params) => {
|
|
429
429
|
return request.put("/lolr/label/item/top", params);
|
|
@@ -2117,6 +2117,13 @@ var ChatSender_default = forwardRef(
|
|
|
2117
2117
|
onSend();
|
|
2118
2118
|
}
|
|
2119
2119
|
};
|
|
2120
|
+
const isFocusedRef = useRef(false);
|
|
2121
|
+
useEffect(() => {
|
|
2122
|
+
if (!content) return;
|
|
2123
|
+
if (!isFocusedRef.current) {
|
|
2124
|
+
senderRef.current?.focus({ cursor: "end" });
|
|
2125
|
+
}
|
|
2126
|
+
}, [content]);
|
|
2120
2127
|
useImperativeHandle(
|
|
2121
2128
|
ref,
|
|
2122
2129
|
() => ({
|
|
@@ -2135,7 +2142,13 @@ var ChatSender_default = forwardRef(
|
|
|
2135
2142
|
header: senderHeader,
|
|
2136
2143
|
onSubmit,
|
|
2137
2144
|
onChange: setInputValue,
|
|
2138
|
-
onFocus
|
|
2145
|
+
onFocus: () => {
|
|
2146
|
+
isFocusedRef.current = true;
|
|
2147
|
+
onFocus?.();
|
|
2148
|
+
},
|
|
2149
|
+
onBlur: () => {
|
|
2150
|
+
isFocusedRef.current = false;
|
|
2151
|
+
},
|
|
2139
2152
|
autoSize: { minRows: 2, maxRows: 6 },
|
|
2140
2153
|
onCancel,
|
|
2141
2154
|
footer: ({ components }) => {
|
|
@@ -2281,7 +2294,12 @@ var QuickAskPanelDrawer_default = ({ open, onClose }) => {
|
|
|
2281
2294
|
const [editingItem, setEditingItem] = useState();
|
|
2282
2295
|
const fetchCategories = async () => {
|
|
2283
2296
|
try {
|
|
2284
|
-
const res = await configState.services.request?.labelsQuery?.(
|
|
2297
|
+
const res = await configState.services.request?.labelsQuery?.({
|
|
2298
|
+
agentId: receiverState.active?.id,
|
|
2299
|
+
businessData: configState.params.businessData,
|
|
2300
|
+
pageNo: 1,
|
|
2301
|
+
pageSize: 1e3
|
|
2302
|
+
});
|
|
2285
2303
|
if (res?.data) {
|
|
2286
2304
|
setCategories(res.data?.items);
|
|
2287
2305
|
if (!activeTab && res.data?.items?.length) {
|
|
@@ -2303,7 +2321,8 @@ var QuickAskPanelDrawer_default = ({ open, onClose }) => {
|
|
|
2303
2321
|
if (!getActiveTab()) return;
|
|
2304
2322
|
try {
|
|
2305
2323
|
setLoading(true);
|
|
2306
|
-
const res = await configState.services.request?.labelItemsQuery?.(
|
|
2324
|
+
const res = await configState.services.request?.labelItemsQuery?.({
|
|
2325
|
+
agentId: receiverState.active?.id,
|
|
2307
2326
|
labelId: getActiveTab(),
|
|
2308
2327
|
keyword: getSearchText()
|
|
2309
2328
|
});
|
|
@@ -2360,9 +2379,10 @@ var QuickAskPanelDrawer_default = ({ open, onClose }) => {
|
|
|
2360
2379
|
if (canProceed === false) {
|
|
2361
2380
|
return;
|
|
2362
2381
|
}
|
|
2363
|
-
chatStore.setContent(item.
|
|
2382
|
+
chatStore.setContent(`#${item.title}# `);
|
|
2364
2383
|
chatStore.setContentParams({
|
|
2365
|
-
|
|
2384
|
+
capacityId: item.id,
|
|
2385
|
+
capacityTitle: item.title
|
|
2366
2386
|
});
|
|
2367
2387
|
};
|
|
2368
2388
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -2380,11 +2400,10 @@ var QuickAskPanelDrawer_default = ({ open, onClose }) => {
|
|
|
2380
2400
|
children: /* @__PURE__ */ jsxs(Flex, { vertical: true, className: styles_module_default4.quickAskPanel, children: [
|
|
2381
2401
|
/* @__PURE__ */ jsxs(Flex, { gap: 12, className: "p-16", vertical: true, children: [
|
|
2382
2402
|
/* @__PURE__ */ jsxs(Flex, { gap: 8, children: [
|
|
2383
|
-
!searchExpanded
|
|
2403
|
+
!searchExpanded ? /* @__PURE__ */ jsx(
|
|
2384
2404
|
Button,
|
|
2385
2405
|
{
|
|
2386
2406
|
type: "dashed",
|
|
2387
|
-
block: true,
|
|
2388
2407
|
icon: /* @__PURE__ */ jsx(PlusOutlined, {}),
|
|
2389
2408
|
className: "flex-1",
|
|
2390
2409
|
onClick: () => {
|
|
@@ -2393,6 +2412,20 @@ var QuickAskPanelDrawer_default = ({ open, onClose }) => {
|
|
|
2393
2412
|
},
|
|
2394
2413
|
children: "\u65B0\u589E\u80FD\u529B\u6A21\u677F"
|
|
2395
2414
|
}
|
|
2415
|
+
) : /* @__PURE__ */ jsx(
|
|
2416
|
+
Button,
|
|
2417
|
+
{
|
|
2418
|
+
icon: /* @__PURE__ */ jsx(PlusOutlined, {}),
|
|
2419
|
+
onClick: () => {
|
|
2420
|
+
if (getSearchText()) {
|
|
2421
|
+
setSearchText("");
|
|
2422
|
+
fetchItems();
|
|
2423
|
+
}
|
|
2424
|
+
setSearchExpanded(false);
|
|
2425
|
+
setEditingItem(null);
|
|
2426
|
+
setEditModalOpen(true);
|
|
2427
|
+
}
|
|
2428
|
+
}
|
|
2396
2429
|
),
|
|
2397
2430
|
searchExpanded ? /* @__PURE__ */ jsx(
|
|
2398
2431
|
Input,
|
|
@@ -2406,8 +2439,7 @@ var QuickAskPanelDrawer_default = ({ open, onClose }) => {
|
|
|
2406
2439
|
fetchItems();
|
|
2407
2440
|
},
|
|
2408
2441
|
className: "flex-1",
|
|
2409
|
-
allowClear: true
|
|
2410
|
-
onBlur: () => setSearchExpanded(false)
|
|
2442
|
+
allowClear: true
|
|
2411
2443
|
}
|
|
2412
2444
|
) : /* @__PURE__ */ jsx(Button, { icon: /* @__PURE__ */ jsx(SearchOutlined, {}), onClick: () => setSearchExpanded(true) })
|
|
2413
2445
|
] }),
|