@zero-library/chat-copilot 3.1.12 → 3.1.13
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 +195 -69
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +255 -228
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +11 -4
- package/dist/index.d.ts +11 -4
- package/dist/index.esm.js +196 -70
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { CloudUploadOutlined, PaperClipOutlined, createFromIconfontCN, EnterOutlined, DownloadOutlined, CloseOutlined, PlayCircleOutlined, CopyOutlined, DotChartOutlined, LoadingOutlined, RightOutlined, LikeOutlined, DislikeOutlined, ToolOutlined, SearchOutlined, UpOutlined, DownOutlined, PlusOutlined, CommentOutlined, RedoOutlined,
|
|
1
|
+
import { CloudUploadOutlined, PaperClipOutlined, createFromIconfontCN, EnterOutlined, DownloadOutlined, CloseOutlined, PlayCircleOutlined, CopyOutlined, DotChartOutlined, LoadingOutlined, RightOutlined, LikeOutlined, DislikeOutlined, ToolOutlined, SearchOutlined, UpOutlined, DownOutlined, PlusOutlined, CommentOutlined, DeleteOutlined, StarOutlined, RedoOutlined, StarFilled, ClockCircleOutlined, CheckCircleOutlined, FileImageOutlined, FilePdfOutlined, FileWordOutlined, FileExcelOutlined, FilePptOutlined, FileZipOutlined, FileTextOutlined, FileUnknownOutlined } from '@ant-design/icons';
|
|
2
2
|
import { Attachments, Sender, FileCard, Bubble, Think, XProvider, Mermaid, CodeHighlighter, Welcome, Prompts, Conversations } from '@ant-design/x-v2';
|
|
3
3
|
import { useRefState, useDebounce, createTokenManager, useSyncInput, isEmptyObj, markdownToText, RenderWrapper, shouldRender, isFunction, downloadFile, LuyaFilePreview, MarkdownEditor, useDeepEffect, isObject, useWebSocket, isNullOrUnDef, isNumber, getFileSuffixName, emit, FileIcon, copyText, LazyComponent, isBoolean, UserAvatar, htmlToMarkdown, buildUrlParams, isExternal, deepCopy, transforms, deepMerge, createRequest, HttpStatus, isArray, isString, isDef, isNull, transform, getWebSocketUrl, safeParseJson } from '@zero-library/common';
|
|
4
|
-
import { App, Badge, Button, Flex, Typography, Tooltip, Layout, Tag, Spin, Splitter, Image as Image$1, Popover, Skeleton, Alert, theme, Collapse, Divider as Divider$1, Select as Select$1, Avatar, Space, Form, Drawer, Empty, Modal, Checkbox, Input, InputNumber, Switch as Switch$1, message, Upload, List, Card, Table, Progress as Progress$1 } from 'antd';
|
|
4
|
+
import { App, Badge, Button, Flex, Typography, Tooltip, Layout, Tag, Spin, Splitter, Image as Image$1, Popover, Skeleton, Alert, theme, Collapse, Divider as Divider$1, Select as Select$1, Avatar, Space, Form, Drawer, Empty, Modal, Checkbox, Input, Popconfirm, InputNumber, Switch as Switch$1, message, Upload, List, Card, Table, Progress as Progress$1 } from 'antd';
|
|
5
5
|
import * as React10 from 'react';
|
|
6
6
|
import React10__default, { createContext, forwardRef, useRef, useEffect, useImperativeHandle, useMemo, memo, useState, useContext, useCallback, useLayoutEffect } from 'react';
|
|
7
7
|
import { useSnapshot, proxy } from 'valtio';
|
|
@@ -18,7 +18,7 @@ import { LexicalTypeaheadMenuPlugin, MenuOption } from '@lexical/react/LexicalTy
|
|
|
18
18
|
import { mergeRegister } from '@lexical/utils';
|
|
19
19
|
import * as ReactDOM from 'react-dom';
|
|
20
20
|
import dayjs from 'dayjs';
|
|
21
|
-
import
|
|
21
|
+
import classNames from 'classnames';
|
|
22
22
|
import InfiniteScroll from 'react-infinite-scroll-component';
|
|
23
23
|
import { XCard as XCard$1 } from '@ant-design/x-card';
|
|
24
24
|
import '@ant-design/x-markdown/themes/light.css';
|
|
@@ -998,6 +998,9 @@ var createChatService = (request, config) => {
|
|
|
998
998
|
const getAgentAvatar = (path) => {
|
|
999
999
|
return request.get(`/files/access?path=${path}&workspaceType=${"global" /* GLOBAL */}`, void 0, { responseType: "blob" });
|
|
1000
1000
|
};
|
|
1001
|
+
const conversationFavorite = (conversationId, isFavorite) => {
|
|
1002
|
+
return request.put("/agents/conversations/favorite", { conversationIds: [conversationId], favorite: isFavorite });
|
|
1003
|
+
};
|
|
1001
1004
|
return {
|
|
1002
1005
|
fetchModelList,
|
|
1003
1006
|
fetchAgentInfo,
|
|
@@ -1016,7 +1019,8 @@ var createChatService = (request, config) => {
|
|
|
1016
1019
|
listLibrarys,
|
|
1017
1020
|
listDataSources,
|
|
1018
1021
|
listTags,
|
|
1019
|
-
getAgentAvatar
|
|
1022
|
+
getAgentAvatar,
|
|
1023
|
+
conversationFavorite
|
|
1020
1024
|
};
|
|
1021
1025
|
};
|
|
1022
1026
|
|
|
@@ -1206,6 +1210,7 @@ function createChatStore() {
|
|
|
1206
1210
|
id: "id",
|
|
1207
1211
|
label: "title",
|
|
1208
1212
|
spec: "spec",
|
|
1213
|
+
isFavorite: "isFavorite",
|
|
1209
1214
|
group: (c) => {
|
|
1210
1215
|
return classifyTime(c.updatedAt);
|
|
1211
1216
|
}
|
|
@@ -1290,6 +1295,45 @@ function createChatStore() {
|
|
|
1290
1295
|
});
|
|
1291
1296
|
await switchConversation(data);
|
|
1292
1297
|
};
|
|
1298
|
+
const favorite = proxy({
|
|
1299
|
+
/** 收藏列表数据 */
|
|
1300
|
+
list: {
|
|
1301
|
+
items: []
|
|
1302
|
+
},
|
|
1303
|
+
/** 收藏列表的加载状态 */
|
|
1304
|
+
loading: false
|
|
1305
|
+
});
|
|
1306
|
+
const getConversationFavorite = async () => {
|
|
1307
|
+
try {
|
|
1308
|
+
favorite.loading = true;
|
|
1309
|
+
const { data } = await config.services.request.fetchConversations({
|
|
1310
|
+
agentId: agent.agentInfo?.id || "",
|
|
1311
|
+
convMeta: {
|
|
1312
|
+
...config.params.convMeta,
|
|
1313
|
+
isFavorite: true
|
|
1314
|
+
}
|
|
1315
|
+
});
|
|
1316
|
+
favorite.list.items = data || [];
|
|
1317
|
+
} finally {
|
|
1318
|
+
favorite.loading = false;
|
|
1319
|
+
}
|
|
1320
|
+
};
|
|
1321
|
+
const collectConversation = async (conversationId, isFavorite) => {
|
|
1322
|
+
try {
|
|
1323
|
+
await config.services.request.conversationFavorite(conversationId, isFavorite);
|
|
1324
|
+
if (conversations.list.items.length) {
|
|
1325
|
+
const item = conversations.list.items.find((item2) => item2.id === conversationId);
|
|
1326
|
+
if (item) {
|
|
1327
|
+
item.isFavorite = isFavorite;
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1330
|
+
if (!isFavorite && favorite.list.items.length) {
|
|
1331
|
+
favorite.list.items = favorite.list.items.filter((item) => item.id !== conversationId);
|
|
1332
|
+
}
|
|
1333
|
+
message.success(isFavorite ? "\u6536\u85CF\u6210\u529F" : "\u5DF2\u53D6\u6D88\u6536\u85CF");
|
|
1334
|
+
} finally {
|
|
1335
|
+
}
|
|
1336
|
+
};
|
|
1293
1337
|
const conversation = proxy({
|
|
1294
1338
|
/** 当前激活的会话信息 */
|
|
1295
1339
|
active: {
|
|
@@ -1594,9 +1638,7 @@ function createChatStore() {
|
|
|
1594
1638
|
messages.push(finalMsg);
|
|
1595
1639
|
} else {
|
|
1596
1640
|
const contents = messages[idx].content;
|
|
1597
|
-
let existingItemIndex = contents.findIndex(
|
|
1598
|
-
(item) => item.type === "toolCall" && item.toolCallId === contentItem.toolCallId
|
|
1599
|
-
);
|
|
1641
|
+
let existingItemIndex = contents.findIndex((item) => item.type === "toolCall" && item.toolCallId === contentItem.toolCallId);
|
|
1600
1642
|
if (existingItemIndex === -1 && contentItem.toolCallId) {
|
|
1601
1643
|
existingItemIndex = contents.findIndex(
|
|
1602
1644
|
(item) => item.type === "toolCall" && !item.toolCallId && item._streamingIndex !== void 0
|
|
@@ -1679,9 +1721,7 @@ function createChatStore() {
|
|
|
1679
1721
|
if (contentItem.type !== "toolCallDelta") return;
|
|
1680
1722
|
let idx = -1;
|
|
1681
1723
|
if (contentItem.toolCallId) {
|
|
1682
|
-
idx = messages.findLastIndex(
|
|
1683
|
-
(m) => m.content?.some((c) => c.type === "toolCall" && c.toolCallId === contentItem.toolCallId)
|
|
1684
|
-
);
|
|
1724
|
+
idx = messages.findLastIndex((m) => m.content?.some((c) => c.type === "toolCall" && c.toolCallId === contentItem.toolCallId));
|
|
1685
1725
|
}
|
|
1686
1726
|
if (idx === -1 && contentItem.index !== void 0) {
|
|
1687
1727
|
idx = messages.findLastIndex(
|
|
@@ -2079,7 +2119,13 @@ function createChatStore() {
|
|
|
2079
2119
|
/** 消息反馈 */
|
|
2080
2120
|
feedback,
|
|
2081
2121
|
/** 设置会话用户输入 */
|
|
2082
|
-
setConversationUserInput
|
|
2122
|
+
setConversationUserInput,
|
|
2123
|
+
/** 收藏管理 */
|
|
2124
|
+
favorite,
|
|
2125
|
+
/** 获取会话收藏列表 */
|
|
2126
|
+
getConversationFavorite,
|
|
2127
|
+
/** 收藏会话 */
|
|
2128
|
+
collectConversation
|
|
2083
2129
|
};
|
|
2084
2130
|
}
|
|
2085
2131
|
var AuthImage = ({ path, size, shape = "square" }) => {
|
|
@@ -2154,6 +2200,106 @@ window._iconfont_svg_string_5021436 = '<svg><symbol id="icon-Ollama" viewBox="0
|
|
|
2154
2200
|
// src/components/IconFont/index.ts
|
|
2155
2201
|
var IconFont = createFromIconfontCN({});
|
|
2156
2202
|
var IconFont_default = IconFont;
|
|
2203
|
+
|
|
2204
|
+
// src/ui/common/FeatureComponents/style.module.less
|
|
2205
|
+
var style_module_default = {
|
|
2206
|
+
popover: "style_module_popover",
|
|
2207
|
+
resourceBtn: "style_module_resourceBtn",
|
|
2208
|
+
divider: "style_module_divider",
|
|
2209
|
+
count: "style_module_count",
|
|
2210
|
+
resourceBtnActive: "style_module_resourceBtnActive",
|
|
2211
|
+
customModal: "style_module_customModal",
|
|
2212
|
+
layout: "style_module_layout",
|
|
2213
|
+
sider: "style_module_sider",
|
|
2214
|
+
categoryName: "style_module_categoryName",
|
|
2215
|
+
siderContent: "style_module_siderContent",
|
|
2216
|
+
categoryItem: "style_module_categoryItem",
|
|
2217
|
+
categoryActive: "style_module_categoryActive",
|
|
2218
|
+
roundCheckbox: "style_module_roundCheckbox",
|
|
2219
|
+
content: "style_module_content",
|
|
2220
|
+
searchInput: "style_module_searchInput",
|
|
2221
|
+
selectedCount: "style_module_selectedCount",
|
|
2222
|
+
tagsArea: "style_module_tagsArea",
|
|
2223
|
+
tagContainer: "style_module_tagContainer",
|
|
2224
|
+
tag: "style_module_tag",
|
|
2225
|
+
expandBtnWrapper: "style_module_expandBtnWrapper",
|
|
2226
|
+
expandBtn: "style_module_expandBtn",
|
|
2227
|
+
tagsExpanded: "style_module_tagsExpanded",
|
|
2228
|
+
listArea: "style_module_listArea",
|
|
2229
|
+
listInner: "style_module_listInner",
|
|
2230
|
+
listItem: "style_module_listItem",
|
|
2231
|
+
listItemSelected: "style_module_listItemSelected",
|
|
2232
|
+
itemIconWrapper: "style_module_itemIconWrapper",
|
|
2233
|
+
itemInfo: "style_module_itemInfo",
|
|
2234
|
+
itemDesc: "style_module_itemDesc",
|
|
2235
|
+
footer: "style_module_footer",
|
|
2236
|
+
titleContainer: "style_module_titleContainer",
|
|
2237
|
+
favoriteCard: "style_module_favoriteCard",
|
|
2238
|
+
favoriteCardActive: "style_module_favoriteCardActive",
|
|
2239
|
+
favoriteCardTitle: "style_module_favoriteCardTitle",
|
|
2240
|
+
favoriteCardActions: "style_module_favoriteCardActions"};
|
|
2241
|
+
var ConversationFavoritesBtn_default = ({ icon, ...rest }) => {
|
|
2242
|
+
const chatStore = useChatStore();
|
|
2243
|
+
const conversationState = useSnapshot(chatStore.conversation);
|
|
2244
|
+
const favoriteState = useSnapshot(chatStore.favorite);
|
|
2245
|
+
const getFavoriteList = useDebounce(() => {
|
|
2246
|
+
chatStore.getConversationFavorite();
|
|
2247
|
+
}, 300);
|
|
2248
|
+
const renderFavoriteList = useMemo(() => {
|
|
2249
|
+
return /* @__PURE__ */ jsx(Flex, { vertical: true, gap: 4, className: classNames("height-full", "scroll-fade-in"), children: favoriteState.list.items.length ? favoriteState.list.items.map((item) => /* @__PURE__ */ jsx(
|
|
2250
|
+
"div",
|
|
2251
|
+
{
|
|
2252
|
+
className: classNames(style_module_default.favoriteCard, { [style_module_default.favoriteCardActive]: conversationState.active.id === item.id }),
|
|
2253
|
+
onClick: () => chatStore.switchConversation(item.id),
|
|
2254
|
+
children: /* @__PURE__ */ jsxs(Flex, { gap: 8, align: "center", children: [
|
|
2255
|
+
/* @__PURE__ */ jsx(Flex, { flex: 1, className: classNames(style_module_default.favoriteCardTitle, "text-ellipsis"), children: item.title }),
|
|
2256
|
+
/* @__PURE__ */ jsx(Flex, { gap: 8, align: "center", className: style_module_default.favoriteCardActions, children: /* @__PURE__ */ jsx(
|
|
2257
|
+
Popconfirm,
|
|
2258
|
+
{
|
|
2259
|
+
title: "\u63D0\u793A",
|
|
2260
|
+
okText: "\u786E\u5B9A",
|
|
2261
|
+
cancelText: "\u53D6\u6D88",
|
|
2262
|
+
description: "\u786E\u8BA4\u53D6\u6D88\u6536\u85CF\u8BE5\u4F1A\u8BDD\u5417\uFF1F",
|
|
2263
|
+
onConfirm: (e) => {
|
|
2264
|
+
e.stopPropagation();
|
|
2265
|
+
chatStore.collectConversation(item.id, false);
|
|
2266
|
+
},
|
|
2267
|
+
onCancel: (e) => e.stopPropagation(),
|
|
2268
|
+
children: /* @__PURE__ */ jsx(
|
|
2269
|
+
Button,
|
|
2270
|
+
{
|
|
2271
|
+
icon: /* @__PURE__ */ jsx(DeleteOutlined, {}),
|
|
2272
|
+
title: "\u5220\u9664",
|
|
2273
|
+
type: "text",
|
|
2274
|
+
onClick: (e) => {
|
|
2275
|
+
e.stopPropagation();
|
|
2276
|
+
}
|
|
2277
|
+
}
|
|
2278
|
+
)
|
|
2279
|
+
}
|
|
2280
|
+
) })
|
|
2281
|
+
] })
|
|
2282
|
+
},
|
|
2283
|
+
item.id
|
|
2284
|
+
)) : /* @__PURE__ */ jsx(Empty, { description: "\u6682\u65E0\u6536\u85CF", image: Empty.PRESENTED_IMAGE_SIMPLE }) });
|
|
2285
|
+
}, [favoriteState.list.items, conversationState.active.id]);
|
|
2286
|
+
const handlePopoverVisibleChange = (visible) => {
|
|
2287
|
+
if (!visible) return;
|
|
2288
|
+
getFavoriteList();
|
|
2289
|
+
};
|
|
2290
|
+
return /* @__PURE__ */ jsx(
|
|
2291
|
+
Popover,
|
|
2292
|
+
{
|
|
2293
|
+
classNames: { container: style_module_default.popover },
|
|
2294
|
+
getPopupContainer: (e) => e,
|
|
2295
|
+
placement: "bottom",
|
|
2296
|
+
content: renderFavoriteList,
|
|
2297
|
+
trigger: ["click"],
|
|
2298
|
+
onOpenChange: handlePopoverVisibleChange,
|
|
2299
|
+
children: /* @__PURE__ */ jsx(Button, { title: "\u6536\u85CF\u5939", type: "text", size: "large", icon: icon?.() || /* @__PURE__ */ jsx(StarOutlined, {}), ...rest })
|
|
2300
|
+
}
|
|
2301
|
+
);
|
|
2302
|
+
};
|
|
2157
2303
|
var CreateBtn_default = ({ icon, ...rest }) => {
|
|
2158
2304
|
const chatStore = useChatStore();
|
|
2159
2305
|
return /* @__PURE__ */ jsx(Button, { title: "\u65B0\u5EFA\u4F1A\u8BDD", size: "large", type: "text", icon: icon?.() || /* @__PURE__ */ jsx(PlusOutlined, {}), onClick: () => chatStore.createConversation(), ...rest });
|
|
@@ -2194,6 +2340,11 @@ var ConversationList_default = () => {
|
|
|
2194
2340
|
}, [conversationsState.list.items]);
|
|
2195
2341
|
const menuConfig = (conversation) => ({
|
|
2196
2342
|
items: [
|
|
2343
|
+
{
|
|
2344
|
+
label: `${conversation.isFavorite ? "\u53D6\u6D88\u6536\u85CF" : "\u6536\u85CF"}`,
|
|
2345
|
+
key: "collect",
|
|
2346
|
+
icon: conversation?.isFavorite ? /* @__PURE__ */ jsx(StarFilled, { className: "primary-text" }) : /* @__PURE__ */ jsx(StarOutlined, {})
|
|
2347
|
+
},
|
|
2197
2348
|
{
|
|
2198
2349
|
label: "\u5220\u9664",
|
|
2199
2350
|
key: "deleteChat",
|
|
@@ -2205,6 +2356,8 @@ var ConversationList_default = () => {
|
|
|
2205
2356
|
itemInfo.domEvent.stopPropagation();
|
|
2206
2357
|
if (itemInfo.key === "deleteChat") {
|
|
2207
2358
|
chatStore.delConversation(conversation.key);
|
|
2359
|
+
} else if (itemInfo.key === "collect") {
|
|
2360
|
+
chatStore.collectConversation(conversation.id, !conversation.isFavorite);
|
|
2208
2361
|
}
|
|
2209
2362
|
}
|
|
2210
2363
|
});
|
|
@@ -2233,41 +2386,6 @@ var ConversationList_default = () => {
|
|
|
2233
2386
|
}
|
|
2234
2387
|
) : /* @__PURE__ */ jsx(Empty, { description: "\u6682\u65E0\u4F1A\u8BDD\u8BB0\u5F55", image: Empty.PRESENTED_IMAGE_SIMPLE }) }) });
|
|
2235
2388
|
};
|
|
2236
|
-
|
|
2237
|
-
// src/ui/common/FeatureComponents/style.module.less
|
|
2238
|
-
var style_module_default = {
|
|
2239
|
-
popover: "style_module_popover",
|
|
2240
|
-
resourceBtn: "style_module_resourceBtn",
|
|
2241
|
-
divider: "style_module_divider",
|
|
2242
|
-
count: "style_module_count",
|
|
2243
|
-
resourceBtnActive: "style_module_resourceBtnActive",
|
|
2244
|
-
customModal: "style_module_customModal",
|
|
2245
|
-
layout: "style_module_layout",
|
|
2246
|
-
sider: "style_module_sider",
|
|
2247
|
-
categoryName: "style_module_categoryName",
|
|
2248
|
-
siderContent: "style_module_siderContent",
|
|
2249
|
-
categoryItem: "style_module_categoryItem",
|
|
2250
|
-
categoryActive: "style_module_categoryActive",
|
|
2251
|
-
roundCheckbox: "style_module_roundCheckbox",
|
|
2252
|
-
content: "style_module_content",
|
|
2253
|
-
searchInput: "style_module_searchInput",
|
|
2254
|
-
selectedCount: "style_module_selectedCount",
|
|
2255
|
-
tagsArea: "style_module_tagsArea",
|
|
2256
|
-
tagContainer: "style_module_tagContainer",
|
|
2257
|
-
tag: "style_module_tag",
|
|
2258
|
-
expandBtnWrapper: "style_module_expandBtnWrapper",
|
|
2259
|
-
expandBtn: "style_module_expandBtn",
|
|
2260
|
-
tagsExpanded: "style_module_tagsExpanded",
|
|
2261
|
-
listArea: "style_module_listArea",
|
|
2262
|
-
listInner: "style_module_listInner",
|
|
2263
|
-
listItem: "style_module_listItem",
|
|
2264
|
-
listItemSelected: "style_module_listItemSelected",
|
|
2265
|
-
itemIconWrapper: "style_module_itemIconWrapper",
|
|
2266
|
-
itemInfo: "style_module_itemInfo",
|
|
2267
|
-
itemDesc: "style_module_itemDesc",
|
|
2268
|
-
footer: "style_module_footer",
|
|
2269
|
-
titleContainer: "style_module_titleContainer"
|
|
2270
|
-
};
|
|
2271
2389
|
var HistoryBtn_default = ({ icon, ...rest }) => {
|
|
2272
2390
|
return /* @__PURE__ */ jsx(
|
|
2273
2391
|
Popover,
|
|
@@ -2281,11 +2399,18 @@ var HistoryBtn_default = ({ icon, ...rest }) => {
|
|
|
2281
2399
|
}
|
|
2282
2400
|
);
|
|
2283
2401
|
};
|
|
2284
|
-
var ChatHeader_default = ({
|
|
2402
|
+
var ChatHeader_default = ({
|
|
2403
|
+
title = true,
|
|
2404
|
+
avatar = true,
|
|
2405
|
+
closeBtn = false,
|
|
2406
|
+
newConversationBtn = true,
|
|
2407
|
+
conversationListBtn = true,
|
|
2408
|
+
conversationFavoriteBtn = true
|
|
2409
|
+
}) => {
|
|
2285
2410
|
const chatStore = useChatStore();
|
|
2286
2411
|
const agentState = useSnapshot(chatStore.agent);
|
|
2287
2412
|
const configState = useSnapshot(chatStore.config);
|
|
2288
|
-
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className:
|
|
2413
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: classNames(styles_module_default2.chatHeader, "zero-chat-header"), children: [
|
|
2289
2414
|
/* @__PURE__ */ jsxs("div", { className: styles_module_default2.chatHeaderContent, children: [
|
|
2290
2415
|
/* @__PURE__ */ jsx(
|
|
2291
2416
|
RenderWrapper,
|
|
@@ -2300,7 +2425,8 @@ var ChatHeader_default = ({ title = true, avatar = true, closeBtn = false, newCo
|
|
|
2300
2425
|
/* @__PURE__ */ jsxs(Space, { size: 2, children: [
|
|
2301
2426
|
/* @__PURE__ */ jsxs("div", { className: styles_module_default2.chatHeaderBtnGroup, children: [
|
|
2302
2427
|
/* @__PURE__ */ jsx(RenderWrapper, { control: newConversationBtn, DefaultComponent: CreateBtn_default }),
|
|
2303
|
-
/* @__PURE__ */ jsx(RenderWrapper, { control: conversationListBtn, DefaultComponent: HistoryBtn_default })
|
|
2428
|
+
/* @__PURE__ */ jsx(RenderWrapper, { control: conversationListBtn, DefaultComponent: HistoryBtn_default }),
|
|
2429
|
+
/* @__PURE__ */ jsx(RenderWrapper, { control: conversationFavoriteBtn, DefaultComponent: ConversationFavoritesBtn_default })
|
|
2304
2430
|
] }),
|
|
2305
2431
|
/* @__PURE__ */ jsx(
|
|
2306
2432
|
RenderWrapper,
|
|
@@ -2313,7 +2439,7 @@ var ChatHeader_default = ({ title = true, avatar = true, closeBtn = false, newCo
|
|
|
2313
2439
|
] }) });
|
|
2314
2440
|
};
|
|
2315
2441
|
var { Text } = Typography;
|
|
2316
|
-
var ConversationListHeader_default = ({ title = true, avatar = true, newConversationBtn = true }) => {
|
|
2442
|
+
var ConversationListHeader_default = ({ title = true, avatar = true, newConversationBtn = true, conversationFavoriteBtn = true }) => {
|
|
2317
2443
|
const chatStore = useChatStore();
|
|
2318
2444
|
const agentState = useSnapshot(chatStore.agent);
|
|
2319
2445
|
return /* @__PURE__ */ jsxs(Flex, { className: "p-24", gap: 16, vertical: true, children: [
|
|
@@ -2330,8 +2456,8 @@ var ConversationListHeader_default = ({ title = true, avatar = true, newConversa
|
|
|
2330
2456
|
{
|
|
2331
2457
|
control: title,
|
|
2332
2458
|
DefaultComponent: /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Flex, { vertical: true, gap: 4, flex: 1, style: { minWidth: 0 }, children: [
|
|
2333
|
-
/* @__PURE__ */ jsx(Text, { strong: true, className:
|
|
2334
|
-
/* @__PURE__ */ jsx(Text, { type: "secondary", ellipsis: true, className:
|
|
2459
|
+
/* @__PURE__ */ jsx(Text, { strong: true, className: classNames("fz-16"), children: agentState.agentInfo.name }),
|
|
2460
|
+
/* @__PURE__ */ jsx(Text, { type: "secondary", ellipsis: true, className: classNames("fz-12"), children: agentState.agentInfo.description })
|
|
2335
2461
|
] }) })
|
|
2336
2462
|
}
|
|
2337
2463
|
)
|
|
@@ -2346,7 +2472,7 @@ var ConversationListHeader_default = ({ title = true, avatar = true, newConversa
|
|
|
2346
2472
|
block: true,
|
|
2347
2473
|
type: "primary",
|
|
2348
2474
|
onClick: () => chatStore.createConversation(),
|
|
2349
|
-
className:
|
|
2475
|
+
className: classNames(styles_module_default2.createConversationButton),
|
|
2350
2476
|
icon: /* @__PURE__ */ jsx(PlusOutlined, {}),
|
|
2351
2477
|
children: "\u65B0\u5EFA\u4F1A\u8BDD"
|
|
2352
2478
|
}
|
|
@@ -2356,7 +2482,7 @@ var ConversationListHeader_default = ({ title = true, avatar = true, newConversa
|
|
|
2356
2482
|
] });
|
|
2357
2483
|
};
|
|
2358
2484
|
var ConversationListPanel = ({ header }) => {
|
|
2359
|
-
return /* @__PURE__ */ jsxs(Flex, { vertical: true, className:
|
|
2485
|
+
return /* @__PURE__ */ jsxs(Flex, { vertical: true, className: classNames("height-full", "zero-chat-conversations", styles_module_default2.conversationListPanel), children: [
|
|
2360
2486
|
/* @__PURE__ */ jsx(RenderWrapper, { control: header, DefaultComponent: ConversationListHeader_default }),
|
|
2361
2487
|
/* @__PURE__ */ jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsx(ConversationList_default, {}) })
|
|
2362
2488
|
] });
|
|
@@ -2825,7 +2951,7 @@ var CHART_COMPONENTS = Object.fromEntries(
|
|
|
2825
2951
|
);
|
|
2826
2952
|
var Charts_default = ({ data, loading }) => {
|
|
2827
2953
|
const { type, config } = data;
|
|
2828
|
-
return /* @__PURE__ */ jsx("div", { className:
|
|
2954
|
+
return /* @__PURE__ */ jsx("div", { className: classNames(styles_module_default3.chart, "scroll-fade-in"), children: loading ? (
|
|
2829
2955
|
// Antd 骨架屏
|
|
2830
2956
|
/* @__PURE__ */ jsx(Skeleton.Node, { active: true, className: styles_module_default3.chartSkeleton, children: /* @__PURE__ */ jsx(DotChartOutlined, { className: styles_module_default3.chartSkeletonIcon }) })
|
|
2831
2957
|
) : /* @__PURE__ */ jsx(
|
|
@@ -3120,7 +3246,7 @@ var XMarkdown_default = memo(({ message: message3, components = {}, content = ""
|
|
|
3120
3246
|
return /* @__PURE__ */ jsx(
|
|
3121
3247
|
XMarkdown,
|
|
3122
3248
|
{
|
|
3123
|
-
className:
|
|
3249
|
+
className: classNames("x-markdown-light", styles_module_default4.xMarkdownStyle),
|
|
3124
3250
|
config,
|
|
3125
3251
|
...rest,
|
|
3126
3252
|
content: processedContent,
|
|
@@ -3465,7 +3591,7 @@ var Switch = ({ id, label, value, bind_path_token, onChange, onDataChange }) =>
|
|
|
3465
3591
|
/* @__PURE__ */ jsx("span", { style: { fontSize: 13, color: "#555" }, children: label })
|
|
3466
3592
|
] });
|
|
3467
3593
|
};
|
|
3468
|
-
var
|
|
3594
|
+
var Button10 = ({ label, variant = "default", onClick, action, onAction }) => {
|
|
3469
3595
|
const handleClick = () => {
|
|
3470
3596
|
if (onClick) {
|
|
3471
3597
|
onClick();
|
|
@@ -3495,7 +3621,7 @@ var A2uiComponents = {
|
|
|
3495
3621
|
TextField,
|
|
3496
3622
|
Select,
|
|
3497
3623
|
Switch,
|
|
3498
|
-
Button:
|
|
3624
|
+
Button: Button10,
|
|
3499
3625
|
Divider,
|
|
3500
3626
|
Tag: Tag3,
|
|
3501
3627
|
Progress,
|
|
@@ -5197,7 +5323,7 @@ var WelcomeItem_default = ({ icon = true, title = true, description = true, prom
|
|
|
5197
5323
|
/* @__PURE__ */ jsx(
|
|
5198
5324
|
Welcome,
|
|
5199
5325
|
{
|
|
5200
|
-
className:
|
|
5326
|
+
className: classNames(styles_module_default2.chatWelcome, "p-t-32"),
|
|
5201
5327
|
variant: "borderless",
|
|
5202
5328
|
icon: /* @__PURE__ */ jsx(
|
|
5203
5329
|
RenderWrapper,
|
|
@@ -5223,7 +5349,7 @@ var WelcomeItem_default = ({ icon = true, title = true, description = true, prom
|
|
|
5223
5349
|
DefaultComponent: /* @__PURE__ */ jsx(
|
|
5224
5350
|
Prompts,
|
|
5225
5351
|
{
|
|
5226
|
-
className:
|
|
5352
|
+
className: classNames("m-t-16", styles_module_default2.promptItem),
|
|
5227
5353
|
wrap: true,
|
|
5228
5354
|
onItemClick: (info) => chatStore.sendMessage(info.data.description),
|
|
5229
5355
|
items: recommendQuestions
|
|
@@ -5432,7 +5558,7 @@ var BubbleListItems_default = ({
|
|
|
5432
5558
|
autoScroll: false,
|
|
5433
5559
|
ref: listRef,
|
|
5434
5560
|
items: bubbleListItems,
|
|
5435
|
-
className:
|
|
5561
|
+
className: classNames(styles_module_default2.bubbleList, "height-full", "scroll-fade-in"),
|
|
5436
5562
|
onScroll: handleScroll
|
|
5437
5563
|
},
|
|
5438
5564
|
conversationState.active.id
|
|
@@ -5583,7 +5709,7 @@ var ResourceSelectorModal_default = ({ open, type, onCancel }) => {
|
|
|
5583
5709
|
return /* @__PURE__ */ jsxs(
|
|
5584
5710
|
Flex,
|
|
5585
5711
|
{
|
|
5586
|
-
className:
|
|
5712
|
+
className: classNames(style_module_default.categoryItem, { [style_module_default.categoryActive]: isChecked }),
|
|
5587
5713
|
onClick: () => handleCategoryChange(cat.id, !isChecked),
|
|
5588
5714
|
children: [
|
|
5589
5715
|
/* @__PURE__ */ jsx(
|
|
@@ -5618,7 +5744,7 @@ var ResourceSelectorModal_default = ({ open, type, onCancel }) => {
|
|
|
5618
5744
|
"\u5DF2\u9009 ",
|
|
5619
5745
|
selectedIds.length
|
|
5620
5746
|
] }) }),
|
|
5621
|
-
/* @__PURE__ */ jsxs("div", { className:
|
|
5747
|
+
/* @__PURE__ */ jsxs("div", { className: classNames(style_module_default.tagsArea, { [style_module_default.tagsExpanded]: tagsExpanded }), children: [
|
|
5622
5748
|
/* @__PURE__ */ jsxs(Flex, { gap: 8, className: style_module_default.tagContainer, wrap: true, ref: tagsContainerRef, children: [
|
|
5623
5749
|
selectedIds.map((id) => /* @__PURE__ */ jsx(
|
|
5624
5750
|
Tag,
|
|
@@ -5648,7 +5774,7 @@ var ResourceSelectorModal_default = ({ open, type, onCancel }) => {
|
|
|
5648
5774
|
return /* @__PURE__ */ jsxs(
|
|
5649
5775
|
"div",
|
|
5650
5776
|
{
|
|
5651
|
-
className:
|
|
5777
|
+
className: classNames(style_module_default.listItem, { [style_module_default.listItemSelected]: isSelected }),
|
|
5652
5778
|
onClick: () => toggleItemSelection(item.id),
|
|
5653
5779
|
children: [
|
|
5654
5780
|
/* @__PURE__ */ jsx("div", { className: style_module_default.itemIconWrapper, children: /* @__PURE__ */ jsx(IconFont_default, { type: iconType }) }),
|
|
@@ -5778,7 +5904,7 @@ var ReasonBtn_default = ({}) => {
|
|
|
5778
5904
|
return /* @__PURE__ */ jsxs(
|
|
5779
5905
|
"div",
|
|
5780
5906
|
{
|
|
5781
|
-
className:
|
|
5907
|
+
className: classNames(style_module_default.resourceBtn, { [style_module_default.resourceBtnActive]: agentState.model.reasoning }),
|
|
5782
5908
|
onClick: () => chatStore.setAgentModel({ ...agentState.model, reasoning: !agentState.model.reasoning }),
|
|
5783
5909
|
children: [
|
|
5784
5910
|
/* @__PURE__ */ jsx(IconFont_default, { type: "icon-reason" }),
|
|
@@ -6251,9 +6377,9 @@ var ChatMainPanel = memo(
|
|
|
6251
6377
|
);
|
|
6252
6378
|
const configState = useSnapshot(chatStore.config);
|
|
6253
6379
|
const agentState = useSnapshot(chatStore.agent);
|
|
6254
|
-
return /* @__PURE__ */ jsxs(Flex, { vertical: true, className:
|
|
6380
|
+
return /* @__PURE__ */ jsxs(Flex, { vertical: true, className: classNames("height-full"), children: [
|
|
6255
6381
|
/* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.chatHeader, DefaultComponent: ChatHeader_default }),
|
|
6256
|
-
/* @__PURE__ */ jsxs(Flex, { align: "center", vertical: true, gap: 24, className:
|
|
6382
|
+
/* @__PURE__ */ jsxs(Flex, { align: "center", vertical: true, gap: 24, className: classNames("height-full", styles_module_default5.bodyWidth), children: [
|
|
6257
6383
|
shouldRender(agentState.agentInfo.userInput && agentState.agentInfo.userInput.length > 0) && /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.userInput, DefaultComponent: UserInputPanel_default }),
|
|
6258
6384
|
shouldRender(configState.layout.messageList) && /* @__PURE__ */ jsx("div", { className: "full-scroll", style: { width: "100%" }, children: /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.messageList, DefaultComponent: BubbleListItems_default }) }),
|
|
6259
6385
|
/* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.senderHeader, DefaultComponent: /* @__PURE__ */ jsx(ChatSenderHeader_default, {}) }),
|
|
@@ -6288,7 +6414,7 @@ var ChatPreviewPanel = memo(({ file }) => {
|
|
|
6288
6414
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6289
6415
|
file.fileUrl && /* @__PURE__ */ jsxs(Flex, { vertical: true, className: "height-full", children: [
|
|
6290
6416
|
/* @__PURE__ */ jsxs("div", { className: styles_module_default5.previewHeader, children: [
|
|
6291
|
-
/* @__PURE__ */ jsx("div", { className:
|
|
6417
|
+
/* @__PURE__ */ jsx("div", { className: classNames(styles_module_default5.previewHeaderTitle, "text-ellipsis"), title: file.fileName, children: file.fileName }),
|
|
6292
6418
|
/* @__PURE__ */ jsxs(Flex, { gap: 8, justify: "center", align: "center", children: [
|
|
6293
6419
|
/* @__PURE__ */ jsx(
|
|
6294
6420
|
Button,
|
|
@@ -6424,12 +6550,12 @@ var layouts_default = forwardRef(({ theme: theme5, params, hooks, layout, config
|
|
|
6424
6550
|
useEffect(() => {
|
|
6425
6551
|
hooks?.onBeforeInit?.();
|
|
6426
6552
|
}, []);
|
|
6427
|
-
return /* @__PURE__ */ jsx(XProvider, { theme: { cssVar: {}, ...theme5 }, children: /* @__PURE__ */ jsx(ChatProvider, { store: chatStore, children: /* @__PURE__ */ jsx(Spin, { spinning: configState.loading, classNames: { root: "full-spin" }, children: /* @__PURE__ */ jsxs(Flex, { vertical: true, className:
|
|
6553
|
+
return /* @__PURE__ */ jsx(XProvider, { theme: { cssVar: {}, ...theme5 }, children: /* @__PURE__ */ jsx(ChatProvider, { store: chatStore, children: /* @__PURE__ */ jsx(Spin, { spinning: configState.loading, classNames: { root: "full-spin" }, children: /* @__PURE__ */ jsxs(Flex, { vertical: true, className: classNames(index_module_default3.chatLayout, "zero-chat-layout", "height-full"), children: [
|
|
6428
6554
|
/* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.globalHeader, DefaultComponent: ChatHeader_default }),
|
|
6429
6555
|
/* @__PURE__ */ jsxs(Flex, { ref: containerRef, className: "full-scroll", children: [
|
|
6430
6556
|
/* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.leftPanel }),
|
|
6431
6557
|
/* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.conversationList, DefaultComponent: ConversationListPanel_default }),
|
|
6432
|
-
/* @__PURE__ */ jsxs(Splitter, { className:
|
|
6558
|
+
/* @__PURE__ */ jsxs(Splitter, { className: classNames("flex-1", index_module_default3.animatedSplitter, { [index_module_default3.hideSplitterBar]: !hasPreView }), children: [
|
|
6433
6559
|
/* @__PURE__ */ jsx(Splitter.Panel, { collapsible: false, max: 800, min: 400, size: sizes[1], children: /* @__PURE__ */ jsx(ChatMainPanel_default, { ref: senderRef }) }),
|
|
6434
6560
|
/* @__PURE__ */ jsx(Splitter.Panel, { collapsible: false, min: 600, size: sizes[0], children: /* @__PURE__ */ jsx(ChatPreviewPanel_default, { file: configState.preview.file }) })
|
|
6435
6561
|
] })
|