@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.cjs.js
CHANGED
|
@@ -19,7 +19,7 @@ var LexicalTypeaheadMenuPlugin = require('@lexical/react/LexicalTypeaheadMenuPlu
|
|
|
19
19
|
var utils = require('@lexical/utils');
|
|
20
20
|
var ReactDOM = require('react-dom');
|
|
21
21
|
var dayjs = require('dayjs');
|
|
22
|
-
var
|
|
22
|
+
var classNames = require('classnames');
|
|
23
23
|
var InfiniteScroll = require('react-infinite-scroll-component');
|
|
24
24
|
var xCard = require('@ant-design/x-card');
|
|
25
25
|
require('@ant-design/x-markdown/themes/light.css');
|
|
@@ -49,7 +49,7 @@ function _interopNamespace(e) {
|
|
|
49
49
|
var React10__namespace = /*#__PURE__*/_interopNamespace(React10);
|
|
50
50
|
var ReactDOM__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
|
|
51
51
|
var dayjs__default = /*#__PURE__*/_interopDefault(dayjs);
|
|
52
|
-
var
|
|
52
|
+
var classNames__default = /*#__PURE__*/_interopDefault(classNames);
|
|
53
53
|
var InfiniteScroll__default = /*#__PURE__*/_interopDefault(InfiniteScroll);
|
|
54
54
|
var XMarkdown__default = /*#__PURE__*/_interopDefault(XMarkdown);
|
|
55
55
|
var Latex__default = /*#__PURE__*/_interopDefault(Latex);
|
|
@@ -1027,6 +1027,9 @@ var createChatService = (request, config) => {
|
|
|
1027
1027
|
const getAgentAvatar = (path) => {
|
|
1028
1028
|
return request.get(`/files/access?path=${path}&workspaceType=${"global" /* GLOBAL */}`, void 0, { responseType: "blob" });
|
|
1029
1029
|
};
|
|
1030
|
+
const conversationFavorite = (conversationId, isFavorite) => {
|
|
1031
|
+
return request.put("/agents/conversations/favorite", { conversationIds: [conversationId], favorite: isFavorite });
|
|
1032
|
+
};
|
|
1030
1033
|
return {
|
|
1031
1034
|
fetchModelList,
|
|
1032
1035
|
fetchAgentInfo,
|
|
@@ -1045,7 +1048,8 @@ var createChatService = (request, config) => {
|
|
|
1045
1048
|
listLibrarys,
|
|
1046
1049
|
listDataSources,
|
|
1047
1050
|
listTags,
|
|
1048
|
-
getAgentAvatar
|
|
1051
|
+
getAgentAvatar,
|
|
1052
|
+
conversationFavorite
|
|
1049
1053
|
};
|
|
1050
1054
|
};
|
|
1051
1055
|
|
|
@@ -1235,6 +1239,7 @@ function createChatStore() {
|
|
|
1235
1239
|
id: "id",
|
|
1236
1240
|
label: "title",
|
|
1237
1241
|
spec: "spec",
|
|
1242
|
+
isFavorite: "isFavorite",
|
|
1238
1243
|
group: (c) => {
|
|
1239
1244
|
return classifyTime(c.updatedAt);
|
|
1240
1245
|
}
|
|
@@ -1319,6 +1324,45 @@ function createChatStore() {
|
|
|
1319
1324
|
});
|
|
1320
1325
|
await switchConversation(data);
|
|
1321
1326
|
};
|
|
1327
|
+
const favorite = valtio.proxy({
|
|
1328
|
+
/** 收藏列表数据 */
|
|
1329
|
+
list: {
|
|
1330
|
+
items: []
|
|
1331
|
+
},
|
|
1332
|
+
/** 收藏列表的加载状态 */
|
|
1333
|
+
loading: false
|
|
1334
|
+
});
|
|
1335
|
+
const getConversationFavorite = async () => {
|
|
1336
|
+
try {
|
|
1337
|
+
favorite.loading = true;
|
|
1338
|
+
const { data } = await config.services.request.fetchConversations({
|
|
1339
|
+
agentId: agent.agentInfo?.id || "",
|
|
1340
|
+
convMeta: {
|
|
1341
|
+
...config.params.convMeta,
|
|
1342
|
+
isFavorite: true
|
|
1343
|
+
}
|
|
1344
|
+
});
|
|
1345
|
+
favorite.list.items = data || [];
|
|
1346
|
+
} finally {
|
|
1347
|
+
favorite.loading = false;
|
|
1348
|
+
}
|
|
1349
|
+
};
|
|
1350
|
+
const collectConversation = async (conversationId, isFavorite) => {
|
|
1351
|
+
try {
|
|
1352
|
+
await config.services.request.conversationFavorite(conversationId, isFavorite);
|
|
1353
|
+
if (conversations.list.items.length) {
|
|
1354
|
+
const item = conversations.list.items.find((item2) => item2.id === conversationId);
|
|
1355
|
+
if (item) {
|
|
1356
|
+
item.isFavorite = isFavorite;
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
if (!isFavorite && favorite.list.items.length) {
|
|
1360
|
+
favorite.list.items = favorite.list.items.filter((item) => item.id !== conversationId);
|
|
1361
|
+
}
|
|
1362
|
+
antd.message.success(isFavorite ? "\u6536\u85CF\u6210\u529F" : "\u5DF2\u53D6\u6D88\u6536\u85CF");
|
|
1363
|
+
} finally {
|
|
1364
|
+
}
|
|
1365
|
+
};
|
|
1322
1366
|
const conversation = valtio.proxy({
|
|
1323
1367
|
/** 当前激活的会话信息 */
|
|
1324
1368
|
active: {
|
|
@@ -1623,9 +1667,7 @@ function createChatStore() {
|
|
|
1623
1667
|
messages.push(finalMsg);
|
|
1624
1668
|
} else {
|
|
1625
1669
|
const contents = messages[idx].content;
|
|
1626
|
-
let existingItemIndex = contents.findIndex(
|
|
1627
|
-
(item) => item.type === "toolCall" && item.toolCallId === contentItem.toolCallId
|
|
1628
|
-
);
|
|
1670
|
+
let existingItemIndex = contents.findIndex((item) => item.type === "toolCall" && item.toolCallId === contentItem.toolCallId);
|
|
1629
1671
|
if (existingItemIndex === -1 && contentItem.toolCallId) {
|
|
1630
1672
|
existingItemIndex = contents.findIndex(
|
|
1631
1673
|
(item) => item.type === "toolCall" && !item.toolCallId && item._streamingIndex !== void 0
|
|
@@ -1708,9 +1750,7 @@ function createChatStore() {
|
|
|
1708
1750
|
if (contentItem.type !== "toolCallDelta") return;
|
|
1709
1751
|
let idx = -1;
|
|
1710
1752
|
if (contentItem.toolCallId) {
|
|
1711
|
-
idx = messages.findLastIndex(
|
|
1712
|
-
(m) => m.content?.some((c) => c.type === "toolCall" && c.toolCallId === contentItem.toolCallId)
|
|
1713
|
-
);
|
|
1753
|
+
idx = messages.findLastIndex((m) => m.content?.some((c) => c.type === "toolCall" && c.toolCallId === contentItem.toolCallId));
|
|
1714
1754
|
}
|
|
1715
1755
|
if (idx === -1 && contentItem.index !== void 0) {
|
|
1716
1756
|
idx = messages.findLastIndex(
|
|
@@ -2108,7 +2148,13 @@ function createChatStore() {
|
|
|
2108
2148
|
/** 消息反馈 */
|
|
2109
2149
|
feedback,
|
|
2110
2150
|
/** 设置会话用户输入 */
|
|
2111
|
-
setConversationUserInput
|
|
2151
|
+
setConversationUserInput,
|
|
2152
|
+
/** 收藏管理 */
|
|
2153
|
+
favorite,
|
|
2154
|
+
/** 获取会话收藏列表 */
|
|
2155
|
+
getConversationFavorite,
|
|
2156
|
+
/** 收藏会话 */
|
|
2157
|
+
collectConversation
|
|
2112
2158
|
};
|
|
2113
2159
|
}
|
|
2114
2160
|
var AuthImage = ({ path, size, shape = "square" }) => {
|
|
@@ -2183,6 +2229,106 @@ window._iconfont_svg_string_5021436 = '<svg><symbol id="icon-Ollama" viewBox="0
|
|
|
2183
2229
|
// src/components/IconFont/index.ts
|
|
2184
2230
|
var IconFont = icons.createFromIconfontCN({});
|
|
2185
2231
|
var IconFont_default = IconFont;
|
|
2232
|
+
|
|
2233
|
+
// src/ui/common/FeatureComponents/style.module.less
|
|
2234
|
+
var style_module_default = {
|
|
2235
|
+
popover: "style_module_popover",
|
|
2236
|
+
resourceBtn: "style_module_resourceBtn",
|
|
2237
|
+
divider: "style_module_divider",
|
|
2238
|
+
count: "style_module_count",
|
|
2239
|
+
resourceBtnActive: "style_module_resourceBtnActive",
|
|
2240
|
+
customModal: "style_module_customModal",
|
|
2241
|
+
layout: "style_module_layout",
|
|
2242
|
+
sider: "style_module_sider",
|
|
2243
|
+
categoryName: "style_module_categoryName",
|
|
2244
|
+
siderContent: "style_module_siderContent",
|
|
2245
|
+
categoryItem: "style_module_categoryItem",
|
|
2246
|
+
categoryActive: "style_module_categoryActive",
|
|
2247
|
+
roundCheckbox: "style_module_roundCheckbox",
|
|
2248
|
+
content: "style_module_content",
|
|
2249
|
+
searchInput: "style_module_searchInput",
|
|
2250
|
+
selectedCount: "style_module_selectedCount",
|
|
2251
|
+
tagsArea: "style_module_tagsArea",
|
|
2252
|
+
tagContainer: "style_module_tagContainer",
|
|
2253
|
+
tag: "style_module_tag",
|
|
2254
|
+
expandBtnWrapper: "style_module_expandBtnWrapper",
|
|
2255
|
+
expandBtn: "style_module_expandBtn",
|
|
2256
|
+
tagsExpanded: "style_module_tagsExpanded",
|
|
2257
|
+
listArea: "style_module_listArea",
|
|
2258
|
+
listInner: "style_module_listInner",
|
|
2259
|
+
listItem: "style_module_listItem",
|
|
2260
|
+
listItemSelected: "style_module_listItemSelected",
|
|
2261
|
+
itemIconWrapper: "style_module_itemIconWrapper",
|
|
2262
|
+
itemInfo: "style_module_itemInfo",
|
|
2263
|
+
itemDesc: "style_module_itemDesc",
|
|
2264
|
+
footer: "style_module_footer",
|
|
2265
|
+
titleContainer: "style_module_titleContainer",
|
|
2266
|
+
favoriteCard: "style_module_favoriteCard",
|
|
2267
|
+
favoriteCardActive: "style_module_favoriteCardActive",
|
|
2268
|
+
favoriteCardTitle: "style_module_favoriteCardTitle",
|
|
2269
|
+
favoriteCardActions: "style_module_favoriteCardActions"};
|
|
2270
|
+
var ConversationFavoritesBtn_default = ({ icon, ...rest }) => {
|
|
2271
|
+
const chatStore = useChatStore();
|
|
2272
|
+
const conversationState = valtio.useSnapshot(chatStore.conversation);
|
|
2273
|
+
const favoriteState = valtio.useSnapshot(chatStore.favorite);
|
|
2274
|
+
const getFavoriteList = common.useDebounce(() => {
|
|
2275
|
+
chatStore.getConversationFavorite();
|
|
2276
|
+
}, 300);
|
|
2277
|
+
const renderFavoriteList = React10.useMemo(() => {
|
|
2278
|
+
return /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { vertical: true, gap: 4, className: classNames__default.default("height-full", "scroll-fade-in"), children: favoriteState.list.items.length ? favoriteState.list.items.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2279
|
+
"div",
|
|
2280
|
+
{
|
|
2281
|
+
className: classNames__default.default(style_module_default.favoriteCard, { [style_module_default.favoriteCardActive]: conversationState.active.id === item.id }),
|
|
2282
|
+
onClick: () => chatStore.switchConversation(item.id),
|
|
2283
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, align: "center", children: [
|
|
2284
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { flex: 1, className: classNames__default.default(style_module_default.favoriteCardTitle, "text-ellipsis"), children: item.title }),
|
|
2285
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { gap: 8, align: "center", className: style_module_default.favoriteCardActions, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2286
|
+
antd.Popconfirm,
|
|
2287
|
+
{
|
|
2288
|
+
title: "\u63D0\u793A",
|
|
2289
|
+
okText: "\u786E\u5B9A",
|
|
2290
|
+
cancelText: "\u53D6\u6D88",
|
|
2291
|
+
description: "\u786E\u8BA4\u53D6\u6D88\u6536\u85CF\u8BE5\u4F1A\u8BDD\u5417\uFF1F",
|
|
2292
|
+
onConfirm: (e) => {
|
|
2293
|
+
e.stopPropagation();
|
|
2294
|
+
chatStore.collectConversation(item.id, false);
|
|
2295
|
+
},
|
|
2296
|
+
onCancel: (e) => e.stopPropagation(),
|
|
2297
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2298
|
+
antd.Button,
|
|
2299
|
+
{
|
|
2300
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.DeleteOutlined, {}),
|
|
2301
|
+
title: "\u5220\u9664",
|
|
2302
|
+
type: "text",
|
|
2303
|
+
onClick: (e) => {
|
|
2304
|
+
e.stopPropagation();
|
|
2305
|
+
}
|
|
2306
|
+
}
|
|
2307
|
+
)
|
|
2308
|
+
}
|
|
2309
|
+
) })
|
|
2310
|
+
] })
|
|
2311
|
+
},
|
|
2312
|
+
item.id
|
|
2313
|
+
)) : /* @__PURE__ */ jsxRuntime.jsx(antd.Empty, { description: "\u6682\u65E0\u6536\u85CF", image: antd.Empty.PRESENTED_IMAGE_SIMPLE }) });
|
|
2314
|
+
}, [favoriteState.list.items, conversationState.active.id]);
|
|
2315
|
+
const handlePopoverVisibleChange = (visible) => {
|
|
2316
|
+
if (!visible) return;
|
|
2317
|
+
getFavoriteList();
|
|
2318
|
+
};
|
|
2319
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2320
|
+
antd.Popover,
|
|
2321
|
+
{
|
|
2322
|
+
classNames: { container: style_module_default.popover },
|
|
2323
|
+
getPopupContainer: (e) => e,
|
|
2324
|
+
placement: "bottom",
|
|
2325
|
+
content: renderFavoriteList,
|
|
2326
|
+
trigger: ["click"],
|
|
2327
|
+
onOpenChange: handlePopoverVisibleChange,
|
|
2328
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { title: "\u6536\u85CF\u5939", type: "text", size: "large", icon: icon?.() || /* @__PURE__ */ jsxRuntime.jsx(icons.StarOutlined, {}), ...rest })
|
|
2329
|
+
}
|
|
2330
|
+
);
|
|
2331
|
+
};
|
|
2186
2332
|
var CreateBtn_default = ({ icon, ...rest }) => {
|
|
2187
2333
|
const chatStore = useChatStore();
|
|
2188
2334
|
return /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { title: "\u65B0\u5EFA\u4F1A\u8BDD", size: "large", type: "text", icon: icon?.() || /* @__PURE__ */ jsxRuntime.jsx(icons.PlusOutlined, {}), onClick: () => chatStore.createConversation(), ...rest });
|
|
@@ -2223,6 +2369,11 @@ var ConversationList_default = () => {
|
|
|
2223
2369
|
}, [conversationsState.list.items]);
|
|
2224
2370
|
const menuConfig = (conversation) => ({
|
|
2225
2371
|
items: [
|
|
2372
|
+
{
|
|
2373
|
+
label: `${conversation.isFavorite ? "\u53D6\u6D88\u6536\u85CF" : "\u6536\u85CF"}`,
|
|
2374
|
+
key: "collect",
|
|
2375
|
+
icon: conversation?.isFavorite ? /* @__PURE__ */ jsxRuntime.jsx(icons.StarFilled, { className: "primary-text" }) : /* @__PURE__ */ jsxRuntime.jsx(icons.StarOutlined, {})
|
|
2376
|
+
},
|
|
2226
2377
|
{
|
|
2227
2378
|
label: "\u5220\u9664",
|
|
2228
2379
|
key: "deleteChat",
|
|
@@ -2234,6 +2385,8 @@ var ConversationList_default = () => {
|
|
|
2234
2385
|
itemInfo.domEvent.stopPropagation();
|
|
2235
2386
|
if (itemInfo.key === "deleteChat") {
|
|
2236
2387
|
chatStore.delConversation(conversation.key);
|
|
2388
|
+
} else if (itemInfo.key === "collect") {
|
|
2389
|
+
chatStore.collectConversation(conversation.id, !conversation.isFavorite);
|
|
2237
2390
|
}
|
|
2238
2391
|
}
|
|
2239
2392
|
});
|
|
@@ -2262,41 +2415,6 @@ var ConversationList_default = () => {
|
|
|
2262
2415
|
}
|
|
2263
2416
|
) : /* @__PURE__ */ jsxRuntime.jsx(antd.Empty, { description: "\u6682\u65E0\u4F1A\u8BDD\u8BB0\u5F55", image: antd.Empty.PRESENTED_IMAGE_SIMPLE }) }) });
|
|
2264
2417
|
};
|
|
2265
|
-
|
|
2266
|
-
// src/ui/common/FeatureComponents/style.module.less
|
|
2267
|
-
var style_module_default = {
|
|
2268
|
-
popover: "style_module_popover",
|
|
2269
|
-
resourceBtn: "style_module_resourceBtn",
|
|
2270
|
-
divider: "style_module_divider",
|
|
2271
|
-
count: "style_module_count",
|
|
2272
|
-
resourceBtnActive: "style_module_resourceBtnActive",
|
|
2273
|
-
customModal: "style_module_customModal",
|
|
2274
|
-
layout: "style_module_layout",
|
|
2275
|
-
sider: "style_module_sider",
|
|
2276
|
-
categoryName: "style_module_categoryName",
|
|
2277
|
-
siderContent: "style_module_siderContent",
|
|
2278
|
-
categoryItem: "style_module_categoryItem",
|
|
2279
|
-
categoryActive: "style_module_categoryActive",
|
|
2280
|
-
roundCheckbox: "style_module_roundCheckbox",
|
|
2281
|
-
content: "style_module_content",
|
|
2282
|
-
searchInput: "style_module_searchInput",
|
|
2283
|
-
selectedCount: "style_module_selectedCount",
|
|
2284
|
-
tagsArea: "style_module_tagsArea",
|
|
2285
|
-
tagContainer: "style_module_tagContainer",
|
|
2286
|
-
tag: "style_module_tag",
|
|
2287
|
-
expandBtnWrapper: "style_module_expandBtnWrapper",
|
|
2288
|
-
expandBtn: "style_module_expandBtn",
|
|
2289
|
-
tagsExpanded: "style_module_tagsExpanded",
|
|
2290
|
-
listArea: "style_module_listArea",
|
|
2291
|
-
listInner: "style_module_listInner",
|
|
2292
|
-
listItem: "style_module_listItem",
|
|
2293
|
-
listItemSelected: "style_module_listItemSelected",
|
|
2294
|
-
itemIconWrapper: "style_module_itemIconWrapper",
|
|
2295
|
-
itemInfo: "style_module_itemInfo",
|
|
2296
|
-
itemDesc: "style_module_itemDesc",
|
|
2297
|
-
footer: "style_module_footer",
|
|
2298
|
-
titleContainer: "style_module_titleContainer"
|
|
2299
|
-
};
|
|
2300
2418
|
var HistoryBtn_default = ({ icon, ...rest }) => {
|
|
2301
2419
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2302
2420
|
antd.Popover,
|
|
@@ -2310,11 +2428,18 @@ var HistoryBtn_default = ({ icon, ...rest }) => {
|
|
|
2310
2428
|
}
|
|
2311
2429
|
);
|
|
2312
2430
|
};
|
|
2313
|
-
var ChatHeader_default = ({
|
|
2431
|
+
var ChatHeader_default = ({
|
|
2432
|
+
title = true,
|
|
2433
|
+
avatar = true,
|
|
2434
|
+
closeBtn = false,
|
|
2435
|
+
newConversationBtn = true,
|
|
2436
|
+
conversationListBtn = true,
|
|
2437
|
+
conversationFavoriteBtn = true
|
|
2438
|
+
}) => {
|
|
2314
2439
|
const chatStore = useChatStore();
|
|
2315
2440
|
const agentState = valtio.useSnapshot(chatStore.agent);
|
|
2316
2441
|
const configState = valtio.useSnapshot(chatStore.config);
|
|
2317
|
-
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
2442
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classNames__default.default(styles_module_default2.chatHeader, "zero-chat-header"), children: [
|
|
2318
2443
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles_module_default2.chatHeaderContent, children: [
|
|
2319
2444
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2320
2445
|
common.RenderWrapper,
|
|
@@ -2329,7 +2454,8 @@ var ChatHeader_default = ({ title = true, avatar = true, closeBtn = false, newCo
|
|
|
2329
2454
|
/* @__PURE__ */ jsxRuntime.jsxs(antd.Space, { size: 2, children: [
|
|
2330
2455
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles_module_default2.chatHeaderBtnGroup, children: [
|
|
2331
2456
|
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: newConversationBtn, DefaultComponent: CreateBtn_default }),
|
|
2332
|
-
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: conversationListBtn, DefaultComponent: HistoryBtn_default })
|
|
2457
|
+
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: conversationListBtn, DefaultComponent: HistoryBtn_default }),
|
|
2458
|
+
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: conversationFavoriteBtn, DefaultComponent: ConversationFavoritesBtn_default })
|
|
2333
2459
|
] }),
|
|
2334
2460
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2335
2461
|
common.RenderWrapper,
|
|
@@ -2342,7 +2468,7 @@ var ChatHeader_default = ({ title = true, avatar = true, closeBtn = false, newCo
|
|
|
2342
2468
|
] }) });
|
|
2343
2469
|
};
|
|
2344
2470
|
var { Text } = antd.Typography;
|
|
2345
|
-
var ConversationListHeader_default = ({ title = true, avatar = true, newConversationBtn = true }) => {
|
|
2471
|
+
var ConversationListHeader_default = ({ title = true, avatar = true, newConversationBtn = true, conversationFavoriteBtn = true }) => {
|
|
2346
2472
|
const chatStore = useChatStore();
|
|
2347
2473
|
const agentState = valtio.useSnapshot(chatStore.agent);
|
|
2348
2474
|
return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { className: "p-24", gap: 16, vertical: true, children: [
|
|
@@ -2359,8 +2485,8 @@ var ConversationListHeader_default = ({ title = true, avatar = true, newConversa
|
|
|
2359
2485
|
{
|
|
2360
2486
|
control: title,
|
|
2361
2487
|
DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, gap: 4, flex: 1, style: { minWidth: 0 }, children: [
|
|
2362
|
-
/* @__PURE__ */ jsxRuntime.jsx(Text, { strong: true, className:
|
|
2363
|
-
/* @__PURE__ */ jsxRuntime.jsx(Text, { type: "secondary", ellipsis: true, className:
|
|
2488
|
+
/* @__PURE__ */ jsxRuntime.jsx(Text, { strong: true, className: classNames__default.default("fz-16"), children: agentState.agentInfo.name }),
|
|
2489
|
+
/* @__PURE__ */ jsxRuntime.jsx(Text, { type: "secondary", ellipsis: true, className: classNames__default.default("fz-12"), children: agentState.agentInfo.description })
|
|
2364
2490
|
] }) })
|
|
2365
2491
|
}
|
|
2366
2492
|
)
|
|
@@ -2375,7 +2501,7 @@ var ConversationListHeader_default = ({ title = true, avatar = true, newConversa
|
|
|
2375
2501
|
block: true,
|
|
2376
2502
|
type: "primary",
|
|
2377
2503
|
onClick: () => chatStore.createConversation(),
|
|
2378
|
-
className:
|
|
2504
|
+
className: classNames__default.default(styles_module_default2.createConversationButton),
|
|
2379
2505
|
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.PlusOutlined, {}),
|
|
2380
2506
|
children: "\u65B0\u5EFA\u4F1A\u8BDD"
|
|
2381
2507
|
}
|
|
@@ -2385,7 +2511,7 @@ var ConversationListHeader_default = ({ title = true, avatar = true, newConversa
|
|
|
2385
2511
|
] });
|
|
2386
2512
|
};
|
|
2387
2513
|
var ConversationListPanel = ({ header }) => {
|
|
2388
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className:
|
|
2514
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames__default.default("height-full", "zero-chat-conversations", styles_module_default2.conversationListPanel), children: [
|
|
2389
2515
|
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: header, DefaultComponent: ConversationListHeader_default }),
|
|
2390
2516
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsxRuntime.jsx(ConversationList_default, {}) })
|
|
2391
2517
|
] });
|
|
@@ -2854,7 +2980,7 @@ var CHART_COMPONENTS = Object.fromEntries(
|
|
|
2854
2980
|
);
|
|
2855
2981
|
var Charts_default = ({ data, loading }) => {
|
|
2856
2982
|
const { type, config } = data;
|
|
2857
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className:
|
|
2983
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames__default.default(styles_module_default3.chart, "scroll-fade-in"), children: loading ? (
|
|
2858
2984
|
// Antd 骨架屏
|
|
2859
2985
|
/* @__PURE__ */ jsxRuntime.jsx(antd.Skeleton.Node, { active: true, className: styles_module_default3.chartSkeleton, children: /* @__PURE__ */ jsxRuntime.jsx(icons.DotChartOutlined, { className: styles_module_default3.chartSkeletonIcon }) })
|
|
2860
2986
|
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3149,7 +3275,7 @@ var XMarkdown_default = React10.memo(({ message: message3, components = {}, cont
|
|
|
3149
3275
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3150
3276
|
XMarkdown__default.default,
|
|
3151
3277
|
{
|
|
3152
|
-
className:
|
|
3278
|
+
className: classNames__default.default("x-markdown-light", styles_module_default4.xMarkdownStyle),
|
|
3153
3279
|
config,
|
|
3154
3280
|
...rest,
|
|
3155
3281
|
content: processedContent,
|
|
@@ -3494,7 +3620,7 @@ var Switch = ({ id, label, value, bind_path_token, onChange, onDataChange }) =>
|
|
|
3494
3620
|
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 13, color: "#555" }, children: label })
|
|
3495
3621
|
] });
|
|
3496
3622
|
};
|
|
3497
|
-
var
|
|
3623
|
+
var Button10 = ({ label, variant = "default", onClick, action, onAction }) => {
|
|
3498
3624
|
const handleClick = () => {
|
|
3499
3625
|
if (onClick) {
|
|
3500
3626
|
onClick();
|
|
@@ -3524,7 +3650,7 @@ var A2uiComponents = {
|
|
|
3524
3650
|
TextField,
|
|
3525
3651
|
Select,
|
|
3526
3652
|
Switch,
|
|
3527
|
-
Button:
|
|
3653
|
+
Button: Button10,
|
|
3528
3654
|
Divider,
|
|
3529
3655
|
Tag: Tag3,
|
|
3530
3656
|
Progress,
|
|
@@ -5226,7 +5352,7 @@ var WelcomeItem_default = ({ icon = true, title = true, description = true, prom
|
|
|
5226
5352
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5227
5353
|
xV2.Welcome,
|
|
5228
5354
|
{
|
|
5229
|
-
className:
|
|
5355
|
+
className: classNames__default.default(styles_module_default2.chatWelcome, "p-t-32"),
|
|
5230
5356
|
variant: "borderless",
|
|
5231
5357
|
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5232
5358
|
common.RenderWrapper,
|
|
@@ -5252,7 +5378,7 @@ var WelcomeItem_default = ({ icon = true, title = true, description = true, prom
|
|
|
5252
5378
|
DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5253
5379
|
xV2.Prompts,
|
|
5254
5380
|
{
|
|
5255
|
-
className:
|
|
5381
|
+
className: classNames__default.default("m-t-16", styles_module_default2.promptItem),
|
|
5256
5382
|
wrap: true,
|
|
5257
5383
|
onItemClick: (info) => chatStore.sendMessage(info.data.description),
|
|
5258
5384
|
items: recommendQuestions
|
|
@@ -5461,7 +5587,7 @@ var BubbleListItems_default = ({
|
|
|
5461
5587
|
autoScroll: false,
|
|
5462
5588
|
ref: listRef,
|
|
5463
5589
|
items: bubbleListItems,
|
|
5464
|
-
className:
|
|
5590
|
+
className: classNames__default.default(styles_module_default2.bubbleList, "height-full", "scroll-fade-in"),
|
|
5465
5591
|
onScroll: handleScroll
|
|
5466
5592
|
},
|
|
5467
5593
|
conversationState.active.id
|
|
@@ -5612,7 +5738,7 @@ var ResourceSelectorModal_default = ({ open, type, onCancel }) => {
|
|
|
5612
5738
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5613
5739
|
antd.Flex,
|
|
5614
5740
|
{
|
|
5615
|
-
className:
|
|
5741
|
+
className: classNames__default.default(style_module_default.categoryItem, { [style_module_default.categoryActive]: isChecked }),
|
|
5616
5742
|
onClick: () => handleCategoryChange(cat.id, !isChecked),
|
|
5617
5743
|
children: [
|
|
5618
5744
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -5647,7 +5773,7 @@ var ResourceSelectorModal_default = ({ open, type, onCancel }) => {
|
|
|
5647
5773
|
"\u5DF2\u9009 ",
|
|
5648
5774
|
selectedIds.length
|
|
5649
5775
|
] }) }),
|
|
5650
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
5776
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: classNames__default.default(style_module_default.tagsArea, { [style_module_default.tagsExpanded]: tagsExpanded }), children: [
|
|
5651
5777
|
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, className: style_module_default.tagContainer, wrap: true, ref: tagsContainerRef, children: [
|
|
5652
5778
|
selectedIds.map((id) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
5653
5779
|
antd.Tag,
|
|
@@ -5677,7 +5803,7 @@ var ResourceSelectorModal_default = ({ open, type, onCancel }) => {
|
|
|
5677
5803
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5678
5804
|
"div",
|
|
5679
5805
|
{
|
|
5680
|
-
className:
|
|
5806
|
+
className: classNames__default.default(style_module_default.listItem, { [style_module_default.listItemSelected]: isSelected }),
|
|
5681
5807
|
onClick: () => toggleItemSelection(item.id),
|
|
5682
5808
|
children: [
|
|
5683
5809
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: style_module_default.itemIconWrapper, children: /* @__PURE__ */ jsxRuntime.jsx(IconFont_default, { type: iconType }) }),
|
|
@@ -5807,7 +5933,7 @@ var ReasonBtn_default = ({}) => {
|
|
|
5807
5933
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5808
5934
|
"div",
|
|
5809
5935
|
{
|
|
5810
|
-
className:
|
|
5936
|
+
className: classNames__default.default(style_module_default.resourceBtn, { [style_module_default.resourceBtnActive]: agentState.model.reasoning }),
|
|
5811
5937
|
onClick: () => chatStore.setAgentModel({ ...agentState.model, reasoning: !agentState.model.reasoning }),
|
|
5812
5938
|
children: [
|
|
5813
5939
|
/* @__PURE__ */ jsxRuntime.jsx(IconFont_default, { type: "icon-reason" }),
|
|
@@ -6280,9 +6406,9 @@ var ChatMainPanel = React10.memo(
|
|
|
6280
6406
|
);
|
|
6281
6407
|
const configState = valtio.useSnapshot(chatStore.config);
|
|
6282
6408
|
const agentState = valtio.useSnapshot(chatStore.agent);
|
|
6283
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className:
|
|
6409
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames__default.default("height-full"), children: [
|
|
6284
6410
|
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.chatHeader, DefaultComponent: ChatHeader_default }),
|
|
6285
|
-
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { align: "center", vertical: true, gap: 24, className:
|
|
6411
|
+
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { align: "center", vertical: true, gap: 24, className: classNames__default.default("height-full", styles_module_default5.bodyWidth), children: [
|
|
6286
6412
|
common.shouldRender(agentState.agentInfo.userInput && agentState.agentInfo.userInput.length > 0) && /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.userInput, DefaultComponent: UserInputPanel_default }),
|
|
6287
6413
|
common.shouldRender(configState.layout.messageList) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "full-scroll", style: { width: "100%" }, children: /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.messageList, DefaultComponent: BubbleListItems_default }) }),
|
|
6288
6414
|
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.senderHeader, DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(ChatSenderHeader_default, {}) }),
|
|
@@ -6317,7 +6443,7 @@ var ChatPreviewPanel = React10.memo(({ file }) => {
|
|
|
6317
6443
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
6318
6444
|
file.fileUrl && /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: "height-full", children: [
|
|
6319
6445
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles_module_default5.previewHeader, children: [
|
|
6320
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className:
|
|
6446
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames__default.default(styles_module_default5.previewHeaderTitle, "text-ellipsis"), title: file.fileName, children: file.fileName }),
|
|
6321
6447
|
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, justify: "center", align: "center", children: [
|
|
6322
6448
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6323
6449
|
antd.Button,
|
|
@@ -6453,12 +6579,12 @@ var layouts_default = React10.forwardRef(({ theme: theme5, params, hooks, layout
|
|
|
6453
6579
|
React10.useEffect(() => {
|
|
6454
6580
|
hooks?.onBeforeInit?.();
|
|
6455
6581
|
}, []);
|
|
6456
|
-
return /* @__PURE__ */ jsxRuntime.jsx(xV2.XProvider, { theme: { cssVar: {}, ...theme5 }, children: /* @__PURE__ */ jsxRuntime.jsx(ChatProvider, { store: chatStore, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { spinning: configState.loading, classNames: { root: "full-spin" }, children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className:
|
|
6582
|
+
return /* @__PURE__ */ jsxRuntime.jsx(xV2.XProvider, { theme: { cssVar: {}, ...theme5 }, children: /* @__PURE__ */ jsxRuntime.jsx(ChatProvider, { store: chatStore, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { spinning: configState.loading, classNames: { root: "full-spin" }, children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames__default.default(index_module_default3.chatLayout, "zero-chat-layout", "height-full"), children: [
|
|
6457
6583
|
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.globalHeader, DefaultComponent: ChatHeader_default }),
|
|
6458
6584
|
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { ref: containerRef, className: "full-scroll", children: [
|
|
6459
6585
|
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.leftPanel }),
|
|
6460
6586
|
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.conversationList, DefaultComponent: ConversationListPanel_default }),
|
|
6461
|
-
/* @__PURE__ */ jsxRuntime.jsxs(antd.Splitter, { className:
|
|
6587
|
+
/* @__PURE__ */ jsxRuntime.jsxs(antd.Splitter, { className: classNames__default.default("flex-1", index_module_default3.animatedSplitter, { [index_module_default3.hideSplitterBar]: !hasPreView }), children: [
|
|
6462
6588
|
/* @__PURE__ */ jsxRuntime.jsx(antd.Splitter.Panel, { collapsible: false, max: 800, min: 400, size: sizes[1], children: /* @__PURE__ */ jsxRuntime.jsx(ChatMainPanel_default, { ref: senderRef }) }),
|
|
6463
6589
|
/* @__PURE__ */ jsxRuntime.jsx(antd.Splitter.Panel, { collapsible: false, min: 600, size: sizes[0], children: /* @__PURE__ */ jsxRuntime.jsx(ChatPreviewPanel_default, { file: configState.preview.file }) })
|
|
6464
6590
|
] })
|