@zero-library/chat-agent 2.3.4 → 2.3.6
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 +220 -115
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +29 -2
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +48 -5
- package/dist/index.d.ts +48 -5
- package/dist/index.esm.js +222 -117
- package/dist/index.esm.js.map +1 -1
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createSecureManager, createTokenManager, useRefState, useDebounce, useSyncInput, markdownToText, RenderWrapper, shouldRender, isFunction, useDeepEffect, useWebSocket, downloadFile, FilePreview, MarkdownEditor, isObject, isNullOrUnDef, isNumber, getFileSuffixName, isBoolean, UserAvatar, htmlToMarkdown, copyText, deepCopy, transforms, deepMerge, createRequest, HttpStatus, isArray, isString, isEmptyObj, RenderMarkdown, transform, emit, buildUrlParams, getWebSocketUrl, useCreateValtioContext, FileIcon, isExternal, LazyComponent } from '@zero-library/common';
|
|
2
|
-
import { App, Badge, Button, Flex, Typography, Spin, Splitter, Tag, Popover,
|
|
2
|
+
import { App, Badge, Button, Flex, Typography, Spin, Splitter, Tag, Popover, Avatar, Space, Input, Popconfirm, message, Empty, Tooltip, Form, Modal, AutoComplete, Row, Col, Collapse, Skeleton, Alert, Drawer } from 'antd';
|
|
3
3
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
4
|
import { forwardRef, useRef, useEffect, useImperativeHandle, useMemo, useState } from 'react';
|
|
5
5
|
import { useSnapshot, proxy } from 'valtio';
|
|
6
|
-
import { CloudUploadOutlined, PaperClipOutlined, EnterOutlined, CloseOutlined, FileSearchOutlined, UserSwitchOutlined, PlusOutlined, CommentOutlined, OpenAIOutlined, CopyOutlined, LikeOutlined, DislikeOutlined, SearchOutlined, PushpinOutlined, EditOutlined, DeleteOutlined, RedoOutlined, SignatureOutlined, PlayCircleOutlined, DotChartOutlined } from '@ant-design/icons';
|
|
6
|
+
import { CloudUploadOutlined, PaperClipOutlined, EnterOutlined, CloseOutlined, FileSearchOutlined, UserSwitchOutlined, PlusOutlined, CommentOutlined, OpenAIOutlined, CopyOutlined, LikeOutlined, DislikeOutlined, SearchOutlined, PushpinOutlined, EditOutlined, DeleteOutlined, StarFilled, StarOutlined, RedoOutlined, SignatureOutlined, PlayCircleOutlined, DotChartOutlined } from '@ant-design/icons';
|
|
7
7
|
import classNames11 from 'classnames';
|
|
8
8
|
import { Attachments, Sender, Suggestion, XProvider, Prompts, Bubble, Conversations, Welcome } from '@ant-design/x';
|
|
9
9
|
import dayjs from 'dayjs';
|
|
@@ -365,6 +365,12 @@ var createChatService = (request) => {
|
|
|
365
365
|
const conversationDelete = (conversationId) => {
|
|
366
366
|
return request.delete("/lolr/conversation", { conversationId });
|
|
367
367
|
};
|
|
368
|
+
const conversationFavoritesQuery = (params) => {
|
|
369
|
+
return request.get("/lolr/conversation/favorite", params);
|
|
370
|
+
};
|
|
371
|
+
const conversationFavorite = (conversationId, isFavorite) => {
|
|
372
|
+
return request.put("/lolr/conversation/favorite/status", { conversationId, status: Number(isFavorite) });
|
|
373
|
+
};
|
|
368
374
|
const conversationRecentUpdate = (params) => {
|
|
369
375
|
return request.put("/lolr/conversation/recent", params);
|
|
370
376
|
};
|
|
@@ -432,6 +438,8 @@ var createChatService = (request) => {
|
|
|
432
438
|
conversationsQuery,
|
|
433
439
|
conversationCreate,
|
|
434
440
|
conversationDelete,
|
|
441
|
+
conversationFavoritesQuery,
|
|
442
|
+
conversationFavorite,
|
|
435
443
|
conversationRecentUpdate,
|
|
436
444
|
conversationRecentQuery,
|
|
437
445
|
conversationMessagesQuery,
|
|
@@ -737,7 +745,8 @@ function createChatStore() {
|
|
|
737
745
|
group: (c) => {
|
|
738
746
|
return classifyTime(c.updateTime);
|
|
739
747
|
},
|
|
740
|
-
timestamp: "updateTime"
|
|
748
|
+
timestamp: "updateTime",
|
|
749
|
+
isFavorite: "isFavorite"
|
|
741
750
|
});
|
|
742
751
|
conversations.list.items = items;
|
|
743
752
|
} finally {
|
|
@@ -761,6 +770,48 @@ function createChatStore() {
|
|
|
761
770
|
conversations.delLoading = false;
|
|
762
771
|
}
|
|
763
772
|
};
|
|
773
|
+
const favorite = proxy({
|
|
774
|
+
/** 收藏列表数据 */
|
|
775
|
+
list: {
|
|
776
|
+
items: [],
|
|
777
|
+
/** 分页查询参数 */
|
|
778
|
+
params: {
|
|
779
|
+
pageNo: 1,
|
|
780
|
+
pageSize: 1e3
|
|
781
|
+
}
|
|
782
|
+
},
|
|
783
|
+
/** 收藏列表的加载状态 */
|
|
784
|
+
loading: false
|
|
785
|
+
});
|
|
786
|
+
const getConversationFavorite = async () => {
|
|
787
|
+
try {
|
|
788
|
+
favorite.loading = true;
|
|
789
|
+
const { data } = await config.services.request.conversationFavoritesQuery({
|
|
790
|
+
targetId: receiver.active.id,
|
|
791
|
+
targetType: receiver.active.type,
|
|
792
|
+
...favorite.list.params
|
|
793
|
+
});
|
|
794
|
+
favorite.list.items = data?.items || [];
|
|
795
|
+
} finally {
|
|
796
|
+
favorite.loading = false;
|
|
797
|
+
}
|
|
798
|
+
};
|
|
799
|
+
const collectConversation = async (conversationId, isFavorite) => {
|
|
800
|
+
try {
|
|
801
|
+
await config.services.request.conversationFavorite(conversationId, isFavorite);
|
|
802
|
+
if (conversations.list.items.length) {
|
|
803
|
+
const item = conversations.list.items.find((item2) => item2.id === conversationId);
|
|
804
|
+
if (item) {
|
|
805
|
+
item.isFavorite = isFavorite;
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
if (!isFavorite && favorite.list.items.length) {
|
|
809
|
+
favorite.list.items = favorite.list.items.filter((item) => item.id !== conversationId);
|
|
810
|
+
}
|
|
811
|
+
message.success(isFavorite ? "\u6536\u85CF\u6210\u529F" : "\u5DF2\u53D6\u6D88\u6536\u85CF");
|
|
812
|
+
} finally {
|
|
813
|
+
}
|
|
814
|
+
};
|
|
764
815
|
const conversation = proxy({
|
|
765
816
|
/** 当前激活的会话信息 */
|
|
766
817
|
active: {
|
|
@@ -1155,6 +1206,12 @@ function createChatStore() {
|
|
|
1155
1206
|
getConversations,
|
|
1156
1207
|
/** 删除会话 */
|
|
1157
1208
|
delConversation,
|
|
1209
|
+
/** 收藏相关状态 */
|
|
1210
|
+
favorite,
|
|
1211
|
+
/** 取消/收藏 */
|
|
1212
|
+
collectConversation,
|
|
1213
|
+
/** 获取收藏的会话列表 */
|
|
1214
|
+
getConversationFavorite,
|
|
1158
1215
|
/** 当前会话状态 */
|
|
1159
1216
|
conversation,
|
|
1160
1217
|
/** 设置说话人类型 */
|
|
@@ -1322,17 +1379,18 @@ init_Context();
|
|
|
1322
1379
|
var styles_module_default3 = {
|
|
1323
1380
|
nsConversationListPanel: "styles_module_nsConversationListPanel",
|
|
1324
1381
|
nsConversations: "styles_module_nsConversations",
|
|
1382
|
+
favoriteCard: "styles_module_favoriteCard",
|
|
1383
|
+
favoriteCardActive: "styles_module_favoriteCardActive",
|
|
1384
|
+
favoriteCardTitle: "styles_module_favoriteCardTitle",
|
|
1385
|
+
favoriteCardActions: "styles_module_favoriteCardActions",
|
|
1386
|
+
favoriteCardDate: "styles_module_favoriteCardDate",
|
|
1325
1387
|
nsBubbleList: "styles_module_nsBubbleList",
|
|
1326
1388
|
nsChatHeader: "styles_module_nsChatHeader",
|
|
1327
1389
|
nsChatTitle: "styles_module_nsChatTitle",
|
|
1328
|
-
|
|
1390
|
+
nsPopover: "styles_module_nsPopover",
|
|
1329
1391
|
chatWelcomeWrap: "styles_module_chatWelcomeWrap",
|
|
1330
1392
|
chatWelcome: "styles_module_chatWelcome",
|
|
1331
1393
|
chatWelcomePrompts: "styles_module_chatWelcomePrompts",
|
|
1332
|
-
nsSenderListTitle: "styles_module_nsSenderListTitle",
|
|
1333
|
-
nsSenderList: "styles_module_nsSenderList",
|
|
1334
|
-
nsSenderListItem: "styles_module_nsSenderListItem",
|
|
1335
|
-
nsSenderListFooter: "styles_module_nsSenderListFooter",
|
|
1336
1394
|
nsChatUserName: "styles_module_nsChatUserName",
|
|
1337
1395
|
nsSenderReferenceHeaderTitle: "styles_module_nsSenderReferenceHeaderTitle",
|
|
1338
1396
|
nsSenderReferenceHeaderContent: "styles_module_nsSenderReferenceHeaderContent",
|
|
@@ -1682,6 +1740,73 @@ var AgentCharacter_default = () => {
|
|
|
1682
1740
|
] });
|
|
1683
1741
|
};
|
|
1684
1742
|
|
|
1743
|
+
// src/ui/common/ConversationFavoritesList.tsx
|
|
1744
|
+
init_Context();
|
|
1745
|
+
var ConversationFavoritesList_default = () => {
|
|
1746
|
+
const chatStore = useChatStore();
|
|
1747
|
+
const conversationState = useSnapshot(chatStore.conversation);
|
|
1748
|
+
const favoriteState = useSnapshot(chatStore.favorite);
|
|
1749
|
+
const getFavoriteList = useDebounce(() => {
|
|
1750
|
+
chatStore.getConversationFavorite();
|
|
1751
|
+
}, 300);
|
|
1752
|
+
const renderFavoriteList = useMemo(() => {
|
|
1753
|
+
return /* @__PURE__ */ jsx("div", { className: classNames11("height-full", "scroll-fade-in"), children: favoriteState.list.items.length ? favoriteState.list.items.map((item) => /* @__PURE__ */ jsxs(
|
|
1754
|
+
"div",
|
|
1755
|
+
{
|
|
1756
|
+
className: classNames11(styles_module_default3.favoriteCard, { [styles_module_default3.favoriteCardActive]: conversationState.active.id === item.id }),
|
|
1757
|
+
onClick: () => chatStore.switchConversation(item.id),
|
|
1758
|
+
children: [
|
|
1759
|
+
/* @__PURE__ */ jsxs(Flex, { gap: 8, align: "center", children: [
|
|
1760
|
+
/* @__PURE__ */ jsx(Flex, { flex: 1, className: classNames11(styles_module_default3.favoriteCardTitle, "text-ellipsis"), children: item.title }),
|
|
1761
|
+
/* @__PURE__ */ jsx(Flex, { gap: 8, align: "center", className: styles_module_default3.favoriteCardActions, children: /* @__PURE__ */ jsx(
|
|
1762
|
+
Popconfirm,
|
|
1763
|
+
{
|
|
1764
|
+
title: "\u63D0\u793A",
|
|
1765
|
+
okText: "\u786E\u5B9A",
|
|
1766
|
+
cancelText: "\u53D6\u6D88",
|
|
1767
|
+
description: "\u786E\u8BA4\u53D6\u6D88\u6536\u85CF\u8BE5\u4F1A\u8BDD\u5417\uFF1F",
|
|
1768
|
+
onConfirm: (e) => {
|
|
1769
|
+
e.stopPropagation();
|
|
1770
|
+
chatStore.collectConversation(item.id, false);
|
|
1771
|
+
},
|
|
1772
|
+
children: /* @__PURE__ */ jsx(
|
|
1773
|
+
Button,
|
|
1774
|
+
{
|
|
1775
|
+
icon: /* @__PURE__ */ jsx(DeleteOutlined, {}),
|
|
1776
|
+
title: "\u5220\u9664",
|
|
1777
|
+
type: "text",
|
|
1778
|
+
onClick: (e) => {
|
|
1779
|
+
e.stopPropagation();
|
|
1780
|
+
}
|
|
1781
|
+
}
|
|
1782
|
+
)
|
|
1783
|
+
}
|
|
1784
|
+
) })
|
|
1785
|
+
] }),
|
|
1786
|
+
/* @__PURE__ */ jsx("div", { className: styles_module_default3.favoriteCardDate, children: item.favoriteTime })
|
|
1787
|
+
]
|
|
1788
|
+
},
|
|
1789
|
+
item.id
|
|
1790
|
+
)) : /* @__PURE__ */ jsx(Empty, { description: "\u6682\u65E0\u6536\u85CF", image: Empty.PRESENTED_IMAGE_SIMPLE }) });
|
|
1791
|
+
}, [favoriteState.list.items, conversationState.active.id]);
|
|
1792
|
+
const handlePopoverVisibleChange = (visible) => {
|
|
1793
|
+
if (!visible) return;
|
|
1794
|
+
getFavoriteList();
|
|
1795
|
+
};
|
|
1796
|
+
return /* @__PURE__ */ jsx(
|
|
1797
|
+
Popover,
|
|
1798
|
+
{
|
|
1799
|
+
classNames: { body: styles_module_default3.nsPopover },
|
|
1800
|
+
getPopupContainer: (e) => e,
|
|
1801
|
+
placement: "bottom",
|
|
1802
|
+
content: renderFavoriteList,
|
|
1803
|
+
trigger: ["click"],
|
|
1804
|
+
onOpenChange: handlePopoverVisibleChange,
|
|
1805
|
+
children: /* @__PURE__ */ jsx(Button, { title: "\u6536\u85CF\u5939", type: "text", size: "large", icon: /* @__PURE__ */ jsx(StarOutlined, {}) })
|
|
1806
|
+
}
|
|
1807
|
+
);
|
|
1808
|
+
};
|
|
1809
|
+
|
|
1685
1810
|
// src/ui/common/ConversationList.tsx
|
|
1686
1811
|
init_Context();
|
|
1687
1812
|
var ConversationList_default = () => {
|
|
@@ -1690,7 +1815,7 @@ var ConversationList_default = () => {
|
|
|
1690
1815
|
const conversationsState = useSnapshot(chatStore.conversations);
|
|
1691
1816
|
const conversationState = useSnapshot(chatStore.conversation);
|
|
1692
1817
|
const getConversations = useDebounce(() => {
|
|
1693
|
-
chatStore.getConversations(receiverState.active.id,
|
|
1818
|
+
chatStore.getConversations(receiverState.active.id, receiverState.active.type);
|
|
1694
1819
|
}, 300);
|
|
1695
1820
|
useEffect(() => {
|
|
1696
1821
|
if (receiverState.active.id) {
|
|
@@ -1721,6 +1846,11 @@ var ConversationList_default = () => {
|
|
|
1721
1846
|
groupable: true,
|
|
1722
1847
|
menu: (conversation) => ({
|
|
1723
1848
|
items: [
|
|
1849
|
+
{
|
|
1850
|
+
label: `${conversation.isFavorite ? "\u53D6\u6D88\u6536\u85CF" : "\u6536\u85CF"}`,
|
|
1851
|
+
key: "collect",
|
|
1852
|
+
icon: conversation?.isFavorite ? /* @__PURE__ */ jsx(StarFilled, { className: "primary-text" }) : /* @__PURE__ */ jsx(StarOutlined, {})
|
|
1853
|
+
},
|
|
1724
1854
|
{
|
|
1725
1855
|
label: "\u5220\u9664\u4F1A\u8BDD",
|
|
1726
1856
|
key: "delete",
|
|
@@ -1732,6 +1862,8 @@ var ConversationList_default = () => {
|
|
|
1732
1862
|
menuInfo.domEvent.stopPropagation();
|
|
1733
1863
|
if (menuInfo.key === "delete") {
|
|
1734
1864
|
chatStore.delConversation(conversation.id);
|
|
1865
|
+
} else if (menuInfo.key === "collect") {
|
|
1866
|
+
chatStore.collectConversation(conversation.id, !conversation.isFavorite);
|
|
1735
1867
|
}
|
|
1736
1868
|
}
|
|
1737
1869
|
})
|
|
@@ -1746,7 +1878,8 @@ var ChatHeader_default = ({
|
|
|
1746
1878
|
closeBtn = false,
|
|
1747
1879
|
newConversationBtn = true,
|
|
1748
1880
|
agentCharacter = true,
|
|
1749
|
-
conversationListBtn = true
|
|
1881
|
+
conversationListBtn = true,
|
|
1882
|
+
conversationListFavoriteBtn = true
|
|
1750
1883
|
}) => {
|
|
1751
1884
|
const chatStore = useChatStore();
|
|
1752
1885
|
const receiverState = useSnapshot(chatStore.receiver);
|
|
@@ -1775,7 +1908,7 @@ var ChatHeader_default = ({
|
|
|
1775
1908
|
{
|
|
1776
1909
|
getPopupContainer: (e) => e,
|
|
1777
1910
|
placement: "bottom",
|
|
1778
|
-
classNames: { body: styles_module_default3.
|
|
1911
|
+
classNames: { body: styles_module_default3.nsPopover },
|
|
1779
1912
|
content: /* @__PURE__ */ jsx(ConversationList_default, {}),
|
|
1780
1913
|
trigger: ["click"],
|
|
1781
1914
|
children: /* @__PURE__ */ jsx(Button, { title: "\u5386\u53F2\u4F1A\u8BDD", type: "text", size: "large", icon: /* @__PURE__ */ jsx(CommentOutlined, {}) })
|
|
@@ -1783,6 +1916,7 @@ var ChatHeader_default = ({
|
|
|
1783
1916
|
)
|
|
1784
1917
|
}
|
|
1785
1918
|
),
|
|
1919
|
+
/* @__PURE__ */ jsx(RenderWrapper, { control: conversationListFavoriteBtn, DefaultComponent: /* @__PURE__ */ jsx(ConversationFavoritesList_default, {}) }),
|
|
1786
1920
|
/* @__PURE__ */ jsx(
|
|
1787
1921
|
RenderWrapper,
|
|
1788
1922
|
{
|
|
@@ -2424,47 +2558,8 @@ var FeaturesRenderer_default = () => {
|
|
|
2424
2558
|
)
|
|
2425
2559
|
] });
|
|
2426
2560
|
};
|
|
2427
|
-
|
|
2428
|
-
// src/ui/common/SenderPromptsItems.tsx
|
|
2429
|
-
init_Context();
|
|
2430
|
-
var SenderPromptsItems_default = () => {
|
|
2431
|
-
const chatStore = useChatStore();
|
|
2432
|
-
const receiverState = useSnapshot(chatStore.receiver);
|
|
2433
|
-
const component = useMemo(
|
|
2434
|
-
() => receiverState.active.config?.labels?.length > 0 && /* @__PURE__ */ jsxs(Flex, { gap: 4, wrap: true, children: [
|
|
2435
|
-
/* @__PURE__ */ jsx(Button, { disabled: true, color: "default", variant: "text", children: "\u968F\u4FBF\u804A\u804A" }),
|
|
2436
|
-
receiverState.active.config.labels.slice(0, 6).map((question) => /* @__PURE__ */ jsx(
|
|
2437
|
-
Popover,
|
|
2438
|
-
{
|
|
2439
|
-
content: /* @__PURE__ */ jsx(
|
|
2440
|
-
List,
|
|
2441
|
-
{
|
|
2442
|
-
itemLayout: "horizontal",
|
|
2443
|
-
split: false,
|
|
2444
|
-
className: styles_module_default3.nsSenderList,
|
|
2445
|
-
dataSource: question.items,
|
|
2446
|
-
renderItem: (item) => /* @__PURE__ */ jsx(List.Item, { onClick: () => chatStore.sendMessage(item.question), className: styles_module_default3.nsSenderListItem, children: /* @__PURE__ */ jsx("div", { className: "text-ellipsis", children: item.question }) }),
|
|
2447
|
-
footer: /* @__PURE__ */ jsx(Flex, { justify: "end", className: styles_module_default3.nsSenderListFooter, children: "(\u60A8\u53EF\u70B9\u51FB\u4EE5\u4E0A\u95EE\u9898\u5F00\u542FAI\u4F53\u9A8C)" })
|
|
2448
|
-
}
|
|
2449
|
-
),
|
|
2450
|
-
title: /* @__PURE__ */ jsx(
|
|
2451
|
-
"div",
|
|
2452
|
-
{
|
|
2453
|
-
className: classNames11(styles_module_default3.nsSenderListTitle, "text-ellipsis"),
|
|
2454
|
-
children: `${receiverState.active.name}\u5F00\u59CB\u5173\u6CE8${question.name}\u5185\u5BB9\uFF01`
|
|
2455
|
-
}
|
|
2456
|
-
),
|
|
2457
|
-
children: /* @__PURE__ */ jsx(Button, { color: "default", variant: "filled", children: question.name })
|
|
2458
|
-
},
|
|
2459
|
-
question.id
|
|
2460
|
-
))
|
|
2461
|
-
] }),
|
|
2462
|
-
[receiverState.active.config?.labels]
|
|
2463
|
-
);
|
|
2464
|
-
return component;
|
|
2465
|
-
};
|
|
2466
2561
|
var ChatSender_default2 = forwardRef(
|
|
2467
|
-
({ placeholder, extraBtn = false, referencesBtn = false, sendBtnProps, footerBelow = false
|
|
2562
|
+
({ placeholder, extraBtn = false, referencesBtn = false, sendBtnProps, footerBelow = false }, ref) => {
|
|
2468
2563
|
const chatStore = useChatStore();
|
|
2469
2564
|
const configState = useSnapshot(chatStore.config);
|
|
2470
2565
|
const receiverState = useSnapshot(chatStore.receiver);
|
|
@@ -2484,84 +2579,94 @@ var ChatSender_default2 = forwardRef(
|
|
|
2484
2579
|
chatStore.setContent(con);
|
|
2485
2580
|
chatStore.sendMessage();
|
|
2486
2581
|
};
|
|
2487
|
-
return /* @__PURE__ */
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
{
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
}
|
|
2540
|
-
)
|
|
2541
|
-
] });
|
|
2582
|
+
return /* @__PURE__ */ jsx(Flex, { vertical: true, gap: 8, className: "zero-chat-sender", children: /* @__PURE__ */ jsx(
|
|
2583
|
+
ChatSender_default,
|
|
2584
|
+
{
|
|
2585
|
+
ref,
|
|
2586
|
+
placeholder,
|
|
2587
|
+
content: chatMessage.content,
|
|
2588
|
+
fileList: chatMessage.files,
|
|
2589
|
+
headerOpen: chatMessage.headerOpen,
|
|
2590
|
+
loading: chatMessage.loading,
|
|
2591
|
+
onContentChange: chatStore.setContent,
|
|
2592
|
+
onFileListChange: chatStore.setFileList,
|
|
2593
|
+
onHeaderOpenChange: chatStore.setHeaderOpen,
|
|
2594
|
+
onSend: () => chatStore.sendMessage(),
|
|
2595
|
+
onCancel: chatStore.cancelReceive,
|
|
2596
|
+
onFocus: chatStore.config.hooks?.onSenderFocus,
|
|
2597
|
+
fileUpload: {
|
|
2598
|
+
request: configState.services.request?.fileUpload,
|
|
2599
|
+
config: receiverState.active.config?.fileUpload
|
|
2600
|
+
},
|
|
2601
|
+
sendBtnProps: isFunction(sendBtnProps) ? sendBtnProps() : {},
|
|
2602
|
+
extraFooterBelow: /* @__PURE__ */ jsx(RenderWrapper, { control: footerBelow }),
|
|
2603
|
+
extraFooter: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2604
|
+
/* @__PURE__ */ jsx(FeaturesRenderer_default, {}),
|
|
2605
|
+
/* @__PURE__ */ jsx(RenderWrapper, { control: extraBtn })
|
|
2606
|
+
] }),
|
|
2607
|
+
extraHeader: /* @__PURE__ */ jsx(
|
|
2608
|
+
Sender.Header,
|
|
2609
|
+
{
|
|
2610
|
+
title: /* @__PURE__ */ jsxs(Flex, { gap: 4, children: [
|
|
2611
|
+
/* @__PURE__ */ jsx(EnterOutlined, {}),
|
|
2612
|
+
/* @__PURE__ */ jsx(Typography.Text, { type: "secondary", ellipsis: true, children: referenceContent })
|
|
2613
|
+
] }),
|
|
2614
|
+
open: !!referenceContent,
|
|
2615
|
+
onOpenChange: () => chatStore.setReferences(),
|
|
2616
|
+
classNames: {
|
|
2617
|
+
header: styles_module_default3.nsSenderReferenceHeaderTitle,
|
|
2618
|
+
content: shouldRender(referencesBtn) ? "" : styles_module_default3.nsSenderReferenceHeaderContent
|
|
2619
|
+
},
|
|
2620
|
+
children: /* @__PURE__ */ jsx(
|
|
2621
|
+
RenderWrapper,
|
|
2622
|
+
{
|
|
2623
|
+
control: referencesBtn,
|
|
2624
|
+
DefaultComponent: /* @__PURE__ */ jsx(Flex, { gap: 8, children: ["\u6DF1\u5EA6\u89E3\u8BFB", "\u6982\u8981\u89E3\u8BFB"].map((con) => /* @__PURE__ */ jsxs(Button, { color: "primary", variant: "filled", onClick: () => referenceHandle(con), children: [
|
|
2625
|
+
con,
|
|
2626
|
+
" \u2192"
|
|
2627
|
+
] }, con)) })
|
|
2628
|
+
}
|
|
2629
|
+
)
|
|
2630
|
+
}
|
|
2631
|
+
)
|
|
2632
|
+
}
|
|
2633
|
+
) });
|
|
2542
2634
|
}
|
|
2543
2635
|
);
|
|
2544
2636
|
|
|
2545
2637
|
// src/ui/common/ConversationListHeader.tsx
|
|
2546
2638
|
init_Context();
|
|
2547
|
-
var ConversationListHeader_default = () => {
|
|
2639
|
+
var ConversationListHeader_default = ({ title = true, avatar = true, newConversationBtn = true, conversationListFavoriteBtn = true }) => {
|
|
2548
2640
|
const chatStore = useChatStore();
|
|
2549
2641
|
const receiverState = useSnapshot(chatStore.receiver);
|
|
2550
2642
|
return /* @__PURE__ */ jsxs("div", { className: "p-24", children: [
|
|
2551
2643
|
/* @__PURE__ */ jsxs(Flex, { align: "center", gap: 8, children: [
|
|
2552
|
-
/* @__PURE__ */ jsx(Avatar, { size: 36, src: receiverState.active.logo }),
|
|
2553
|
-
/* @__PURE__ */ jsx(
|
|
2644
|
+
/* @__PURE__ */ jsx(RenderWrapper, { control: avatar, DefaultComponent: /* @__PURE__ */ jsx(Avatar, { size: 36, src: receiverState.active.logo }) }),
|
|
2645
|
+
/* @__PURE__ */ jsx(
|
|
2646
|
+
RenderWrapper,
|
|
2647
|
+
{
|
|
2648
|
+
control: title,
|
|
2649
|
+
DefaultComponent: /* @__PURE__ */ jsx("span", { className: classNames11(styles_module_default3.nsChatUserName, "flex-1 text-ellipsis"), children: receiverState.active.name })
|
|
2650
|
+
}
|
|
2651
|
+
),
|
|
2652
|
+
/* @__PURE__ */ jsx(RenderWrapper, { control: conversationListFavoriteBtn, DefaultComponent: /* @__PURE__ */ jsx(ConversationFavoritesList_default, {}) })
|
|
2554
2653
|
] }),
|
|
2555
2654
|
/* @__PURE__ */ jsx(
|
|
2556
|
-
|
|
2655
|
+
RenderWrapper,
|
|
2557
2656
|
{
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2657
|
+
control: newConversationBtn,
|
|
2658
|
+
DefaultComponent: /* @__PURE__ */ jsx(
|
|
2659
|
+
Button,
|
|
2660
|
+
{
|
|
2661
|
+
block: true,
|
|
2662
|
+
type: "primary",
|
|
2663
|
+
shape: "round",
|
|
2664
|
+
onClick: () => chatStore.createConversation(),
|
|
2665
|
+
className: classNames11("m-t-16"),
|
|
2666
|
+
icon: /* @__PURE__ */ jsx(PlusOutlined, {}),
|
|
2667
|
+
children: "\u65B0\u5EFA\u4F1A\u8BDD"
|
|
2668
|
+
}
|
|
2669
|
+
)
|
|
2565
2670
|
}
|
|
2566
2671
|
)
|
|
2567
2672
|
] });
|