@zero-library/chat-copilot 3.1.14 → 3.1.16
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 +324 -206
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +325 -245
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.esm.js +324 -207
- package/dist/index.esm.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs.js
CHANGED
|
@@ -19,7 +19,8 @@ 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 classNames2 = require('classnames');
|
|
23
|
+
var console2 = require('console');
|
|
23
24
|
var InfiniteScroll = require('react-infinite-scroll-component');
|
|
24
25
|
var xCard = require('@ant-design/x-card');
|
|
25
26
|
require('@ant-design/x-markdown/themes/light.css');
|
|
@@ -49,7 +50,8 @@ function _interopNamespace(e) {
|
|
|
49
50
|
var React10__namespace = /*#__PURE__*/_interopNamespace(React10);
|
|
50
51
|
var ReactDOM__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
|
|
51
52
|
var dayjs__default = /*#__PURE__*/_interopDefault(dayjs);
|
|
52
|
-
var
|
|
53
|
+
var classNames2__default = /*#__PURE__*/_interopDefault(classNames2);
|
|
54
|
+
var console2__default = /*#__PURE__*/_interopDefault(console2);
|
|
53
55
|
var InfiniteScroll__default = /*#__PURE__*/_interopDefault(InfiniteScroll);
|
|
54
56
|
var XMarkdown__default = /*#__PURE__*/_interopDefault(XMarkdown);
|
|
55
57
|
var Latex__default = /*#__PURE__*/_interopDefault(Latex);
|
|
@@ -72,7 +74,7 @@ var styles_module_default = {
|
|
|
72
74
|
chatAttachments: "styles_module_chatAttachments",
|
|
73
75
|
chatSender: "styles_module_chatSender"};
|
|
74
76
|
var Attachments_default = React10.forwardRef(({ fileUpload, fileUploadConfig, fileList = [], onChange, extraParams }, ref) => {
|
|
75
|
-
const { message:
|
|
77
|
+
const { message: message4 } = antd.App.useApp();
|
|
76
78
|
const chatStore = useChatStore();
|
|
77
79
|
const configState = valtio.useSnapshot(chatStore.config);
|
|
78
80
|
const fileListRef = React10.useRef([]);
|
|
@@ -100,7 +102,7 @@ var Attachments_default = React10.forwardRef(({ fileUpload, fileUploadConfig, fi
|
|
|
100
102
|
onChange(files);
|
|
101
103
|
}, [attachedFiles]);
|
|
102
104
|
const onErrorTip = common.useDebounce((errorMsg) => {
|
|
103
|
-
|
|
105
|
+
message4.error(errorMsg);
|
|
104
106
|
}, 300);
|
|
105
107
|
const findConfig = (file) => {
|
|
106
108
|
return fileUploadConfig?.allowedTypes?.find((type) => type === common.getFileSuffixName(file.name)) || "";
|
|
@@ -268,6 +270,7 @@ var index_module_default = {
|
|
|
268
270
|
var CONV_MODE = {
|
|
269
271
|
PROD: 1};
|
|
270
272
|
var TOKEN_KEY = "NS-TOKEN";
|
|
273
|
+
var SHARE_KEY = "SHARE-TOKEN";
|
|
271
274
|
var tokenManager = common.createTokenManager({
|
|
272
275
|
key: TOKEN_KEY
|
|
273
276
|
});
|
|
@@ -359,8 +362,9 @@ var getFileIcon = (extension, fontSize = 24) => {
|
|
|
359
362
|
return createIcon(icons.FileUnknownOutlined, "#94a3b8");
|
|
360
363
|
};
|
|
361
364
|
var getFileUrl = (params, baseUrl, url) => {
|
|
365
|
+
const authParams = baseUrl === "/luya/share" ? { [SHARE_KEY]: localStorage.getItem(SHARE_KEY) || "" } : { [TOKEN_KEY]: tokenManager.get() };
|
|
362
366
|
const data = {
|
|
363
|
-
|
|
367
|
+
...authParams,
|
|
364
368
|
workspaceType: "conversation" /* CONVERSATION */,
|
|
365
369
|
...params
|
|
366
370
|
};
|
|
@@ -849,7 +853,7 @@ var ChatInput = React10__namespace.forwardRef(
|
|
|
849
853
|
}
|
|
850
854
|
}
|
|
851
855
|
),
|
|
852
|
-
placeholder: !stringValue
|
|
856
|
+
placeholder: !stringValue ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: index_module_default.promptEditorPlaceholder, children: placeholder || "\u4ECA\u5929\u5E2E\u4F60\u505A\u4E9B\u4EC0\u4E48\uFF1F\u8F93\u5165 '/' \u8C03\u7528\u6280\u80FD\u4E0E\u77E5\u8BC6\u5E93" }) : null,
|
|
853
857
|
ErrorBoundary: LexicalErrorBoundary.LexicalErrorBoundary
|
|
854
858
|
}
|
|
855
859
|
),
|
|
@@ -863,6 +867,7 @@ var ChatInput = React10__namespace.forwardRef(
|
|
|
863
867
|
var ChatInput_default = ChatInput;
|
|
864
868
|
var ChatSender_default = React10.forwardRef(
|
|
865
869
|
({
|
|
870
|
+
placeholder,
|
|
866
871
|
content,
|
|
867
872
|
commandConfig = {},
|
|
868
873
|
fileList = [],
|
|
@@ -935,6 +940,7 @@ var ChatSender_default = React10.forwardRef(
|
|
|
935
940
|
className: styles_module_default.chatSender,
|
|
936
941
|
ref: senderRef,
|
|
937
942
|
value: inputValue,
|
|
943
|
+
placeholder,
|
|
938
944
|
header: senderHeader,
|
|
939
945
|
onSubmit,
|
|
940
946
|
onChange: setInputValue,
|
|
@@ -1030,6 +1036,9 @@ var createChatService = (request, config) => {
|
|
|
1030
1036
|
const conversationFavorite = (conversationId, isFavorite) => {
|
|
1031
1037
|
return request.put("/agents/conversations/favorite", { conversationIds: [conversationId], favorite: isFavorite });
|
|
1032
1038
|
};
|
|
1039
|
+
const shareConversation = (conversationId) => {
|
|
1040
|
+
return request.get(`/agents/conversations/${conversationId}/share/url`);
|
|
1041
|
+
};
|
|
1033
1042
|
return {
|
|
1034
1043
|
fetchModelList,
|
|
1035
1044
|
fetchAgentInfo,
|
|
@@ -1049,7 +1058,8 @@ var createChatService = (request, config) => {
|
|
|
1049
1058
|
listDataSources,
|
|
1050
1059
|
listTags,
|
|
1051
1060
|
getAgentAvatar,
|
|
1052
|
-
conversationFavorite
|
|
1061
|
+
conversationFavorite,
|
|
1062
|
+
shareConversation
|
|
1053
1063
|
};
|
|
1054
1064
|
};
|
|
1055
1065
|
|
|
@@ -1095,7 +1105,13 @@ function createChatStore() {
|
|
|
1095
1105
|
return await config.services.request.fetchModelList();
|
|
1096
1106
|
};
|
|
1097
1107
|
const setServices = ({ http, websocket } = {}) => {
|
|
1098
|
-
const
|
|
1108
|
+
const baseURL = http?.config?.baseURL || "/luya/v1";
|
|
1109
|
+
const headers = baseURL === "/luya/share" ? { [SHARE_KEY]: localStorage.getItem(SHARE_KEY) || "" } : { [TOKEN_KEY]: tokenManager.get() };
|
|
1110
|
+
const httpConfig = {
|
|
1111
|
+
baseURL,
|
|
1112
|
+
headers,
|
|
1113
|
+
...http?.config
|
|
1114
|
+
};
|
|
1099
1115
|
const request = common.createRequest(httpConfig);
|
|
1100
1116
|
if (config.hooks?.onRequestInterceptor) {
|
|
1101
1117
|
request.instance.interceptors.request.use(...config.hooks.onRequestInterceptor);
|
|
@@ -1116,9 +1132,9 @@ function createChatStore() {
|
|
|
1116
1132
|
config.services.request = { ...createChatService(request, httpConfig), ...http?.request };
|
|
1117
1133
|
config.services.websocketUrls = ["", ""];
|
|
1118
1134
|
if (common.isArray(websocket?.baseURLs)) {
|
|
1119
|
-
websocket.baseURLs.forEach((
|
|
1120
|
-
if (common.isString(
|
|
1121
|
-
config.services.websocketUrls[index] = getChatSocketUrl(
|
|
1135
|
+
websocket.baseURLs.forEach((baseURL2, index) => {
|
|
1136
|
+
if (common.isString(baseURL2)) {
|
|
1137
|
+
config.services.websocketUrls[index] = getChatSocketUrl(baseURL2, websocket?.params || httpConfig.headers);
|
|
1122
1138
|
}
|
|
1123
1139
|
});
|
|
1124
1140
|
} else {
|
|
@@ -1257,6 +1273,7 @@ function createChatStore() {
|
|
|
1257
1273
|
await config.services.request.deleteConversation(conversationId);
|
|
1258
1274
|
antd.message.success("\u5220\u9664\u6210\u529F");
|
|
1259
1275
|
conversations.list.items = conversations.list.items.filter((item) => item.key !== conversationId);
|
|
1276
|
+
favorite.list.items = favorite.list.items.filter((item) => item.id !== conversationId);
|
|
1260
1277
|
delete conversation.messages[conversationId];
|
|
1261
1278
|
if (conversation.active.id === conversationId) {
|
|
1262
1279
|
createConversation();
|
|
@@ -1302,6 +1319,7 @@ function createChatStore() {
|
|
|
1302
1319
|
id: "id",
|
|
1303
1320
|
label: "title",
|
|
1304
1321
|
spec: "spec",
|
|
1322
|
+
isFavorite: "isFavorite",
|
|
1305
1323
|
group: (c) => {
|
|
1306
1324
|
return classifyTime(c.updatedAt);
|
|
1307
1325
|
}
|
|
@@ -1356,7 +1374,9 @@ function createChatStore() {
|
|
|
1356
1374
|
item.isFavorite = isFavorite;
|
|
1357
1375
|
}
|
|
1358
1376
|
}
|
|
1359
|
-
if (
|
|
1377
|
+
if (isFavorite) {
|
|
1378
|
+
await getConversationFavorite();
|
|
1379
|
+
} else if (favorite.list.items.length) {
|
|
1360
1380
|
favorite.list.items = favorite.list.items.filter((item) => item.id !== conversationId);
|
|
1361
1381
|
}
|
|
1362
1382
|
antd.message.success(isFavorite ? "\u6536\u85CF\u6210\u529F" : "\u5DF2\u53D6\u6D88\u6536\u85CF");
|
|
@@ -1617,7 +1637,7 @@ function createChatStore() {
|
|
|
1617
1637
|
}
|
|
1618
1638
|
if (isMain) config.hooks?.onStepMessage?.(msg);
|
|
1619
1639
|
}
|
|
1620
|
-
function doneCallback(msg,
|
|
1640
|
+
function doneCallback(msg, message4, isMain) {
|
|
1621
1641
|
conversation.messages[msg.conversationId].loading = false;
|
|
1622
1642
|
const messages = conversation.messages[msg.conversationId]?.message;
|
|
1623
1643
|
if (messages) {
|
|
@@ -1910,9 +1930,9 @@ function createChatStore() {
|
|
|
1910
1930
|
}
|
|
1911
1931
|
}
|
|
1912
1932
|
}
|
|
1913
|
-
function processMessageContent(
|
|
1933
|
+
function processMessageContent(message4, targetMessages) {
|
|
1914
1934
|
const newMessage = {
|
|
1915
|
-
...
|
|
1935
|
+
...message4,
|
|
1916
1936
|
agentId: agent.agentInfo.id
|
|
1917
1937
|
};
|
|
1918
1938
|
const isMain = !targetMessages;
|
|
@@ -1980,13 +2000,13 @@ function createChatStore() {
|
|
|
1980
2000
|
}
|
|
1981
2001
|
processMessageContent(newMessage);
|
|
1982
2002
|
};
|
|
1983
|
-
const sendMessage = async (
|
|
2003
|
+
const sendMessage = async (message4, msgFiles = [], params) => {
|
|
1984
2004
|
const conversationId = conversation.active.id;
|
|
1985
2005
|
if (conversation.messages[conversationId].loading) return;
|
|
1986
2006
|
let msgContent = "", files;
|
|
1987
2007
|
const references = conversation.messages[conversationId].references;
|
|
1988
|
-
if (
|
|
1989
|
-
msgContent =
|
|
2008
|
+
if (message4) {
|
|
2009
|
+
msgContent = message4;
|
|
1990
2010
|
files = [...msgFiles, ...conversation.messages[conversationId].files || []];
|
|
1991
2011
|
} else {
|
|
1992
2012
|
if (references?.type === 1 && references?.content?.msgContent) {
|
|
@@ -2033,9 +2053,9 @@ function createChatStore() {
|
|
|
2033
2053
|
};
|
|
2034
2054
|
const extraParams = common.deepCopy(config.params?.params || {});
|
|
2035
2055
|
const userInputParams = variablesToObject(conversation.active.userInput || []);
|
|
2036
|
-
Object.assign(extraParams,
|
|
2056
|
+
Object.assign(extraParams, message4 ? {} : { ...references?.params }, params, userInputParams);
|
|
2037
2057
|
sendParams.params = extraParams;
|
|
2038
|
-
if (!
|
|
2058
|
+
if (!message4) {
|
|
2039
2059
|
setContent("");
|
|
2040
2060
|
setContentParams();
|
|
2041
2061
|
setReferences();
|
|
@@ -2229,103 +2249,56 @@ window._iconfont_svg_string_5021436 = '<svg><symbol id="icon-Ollama" viewBox="0
|
|
|
2229
2249
|
// src/components/IconFont/index.ts
|
|
2230
2250
|
var IconFont = icons.createFromIconfontCN({});
|
|
2231
2251
|
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
2252
|
var ConversationFavoritesBtn_default = ({ icon, ...rest }) => {
|
|
2271
2253
|
const chatStore = useChatStore();
|
|
2254
|
+
const conversationsState = valtio.useSnapshot(chatStore.conversations);
|
|
2272
2255
|
const conversationState = valtio.useSnapshot(chatStore.conversation);
|
|
2273
|
-
const
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
const
|
|
2278
|
-
|
|
2279
|
-
|
|
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();
|
|
2256
|
+
const activeConversation = React10.useMemo(() => {
|
|
2257
|
+
return conversationsState.list.items.find((item) => item.id === conversationState.active.id);
|
|
2258
|
+
}, [conversationsState.list.items, conversationState.active.id]);
|
|
2259
|
+
const isFavorite = activeConversation?.isFavorite === true;
|
|
2260
|
+
const handleToggleFavorite = () => {
|
|
2261
|
+
if (!conversationState.active.id) return;
|
|
2262
|
+
chatStore.collectConversation(conversationState.active.id, !isFavorite);
|
|
2318
2263
|
};
|
|
2319
2264
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2320
|
-
antd.
|
|
2265
|
+
antd.Button,
|
|
2321
2266
|
{
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2267
|
+
title: isFavorite ? "\u53D6\u6D88\u6536\u85CF" : "\u6536\u85CF",
|
|
2268
|
+
type: "text",
|
|
2269
|
+
size: "large",
|
|
2270
|
+
disabled: !conversationState.active.id,
|
|
2271
|
+
icon: icon?.() || (isFavorite ? /* @__PURE__ */ jsxRuntime.jsx(icons.StarFilled, { className: "primary-text" }) : /* @__PURE__ */ jsxRuntime.jsx(icons.StarOutlined, {})),
|
|
2272
|
+
onClick: handleToggleFavorite,
|
|
2273
|
+
...rest
|
|
2274
|
+
}
|
|
2275
|
+
);
|
|
2276
|
+
};
|
|
2277
|
+
var ConversationShareBtn_default = ({ icon, ...rest }) => {
|
|
2278
|
+
const chatStore = useChatStore();
|
|
2279
|
+
const conversationState = valtio.useSnapshot(chatStore.conversation);
|
|
2280
|
+
const configState = valtio.useSnapshot(chatStore.config);
|
|
2281
|
+
const handleShareConversation = async () => {
|
|
2282
|
+
try {
|
|
2283
|
+
const { data } = await configState.services.request.shareConversation(conversationState.active.id);
|
|
2284
|
+
if (data) {
|
|
2285
|
+
common.copyText(data);
|
|
2286
|
+
antd.message.success("\u5206\u4EAB\u94FE\u63A5\u5DF2\u590D\u5236\u5230\u526A\u8D34\u677F");
|
|
2287
|
+
}
|
|
2288
|
+
} catch (error) {
|
|
2289
|
+
antd.message.error("\u5206\u4EAB\u4F1A\u8BDD\u5931\u8D25");
|
|
2290
|
+
}
|
|
2291
|
+
};
|
|
2292
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2293
|
+
antd.Button,
|
|
2294
|
+
{
|
|
2295
|
+
title: "\u5206\u4EAB",
|
|
2296
|
+
type: "text",
|
|
2297
|
+
size: "large",
|
|
2298
|
+
disabled: !conversationState.active.id,
|
|
2299
|
+
icon: icon?.() || /* @__PURE__ */ jsxRuntime.jsx(icons.ShareAltOutlined, {}),
|
|
2300
|
+
...rest,
|
|
2301
|
+
onClick: handleShareConversation
|
|
2329
2302
|
}
|
|
2330
2303
|
);
|
|
2331
2304
|
};
|
|
@@ -2344,6 +2317,10 @@ var styles_module_default2 = {
|
|
|
2344
2317
|
conversationListPanel: "styles_module_conversationListPanel",
|
|
2345
2318
|
createConversationButton: "styles_module_createConversationButton",
|
|
2346
2319
|
conversations: "styles_module_conversations",
|
|
2320
|
+
conversationTabs: "styles_module_conversationTabs",
|
|
2321
|
+
conversationTabPane: "styles_module_conversationTabPane",
|
|
2322
|
+
conversationEmpty: "styles_module_conversationEmpty",
|
|
2323
|
+
conversationScrollArea: "styles_module_conversationScrollArea",
|
|
2347
2324
|
chatWelcomeWrap: "styles_module_chatWelcomeWrap",
|
|
2348
2325
|
chatWelcome: "styles_module_chatWelcome",
|
|
2349
2326
|
promptItem: "styles_module_promptItem",
|
|
@@ -2362,12 +2339,30 @@ var styles_module_default2 = {
|
|
|
2362
2339
|
};
|
|
2363
2340
|
var ConversationList_default = () => {
|
|
2364
2341
|
const chatStore = useChatStore();
|
|
2342
|
+
const agentState = valtio.useSnapshot(chatStore.agent);
|
|
2365
2343
|
const conversationsState = valtio.useSnapshot(chatStore.conversations);
|
|
2366
2344
|
const conversationState = valtio.useSnapshot(chatStore.conversation);
|
|
2345
|
+
const favoriteState = valtio.useSnapshot(chatStore.favorite);
|
|
2346
|
+
const [activeTabKey, setActiveTabKey] = React10.useState("history");
|
|
2347
|
+
React10.useEffect(() => {
|
|
2348
|
+
if (!agentState.agentInfo.id) return;
|
|
2349
|
+
chatStore.getConversationFavorite();
|
|
2350
|
+
}, [agentState.agentInfo.id, chatStore]);
|
|
2367
2351
|
const conversationList = React10.useMemo(() => {
|
|
2368
2352
|
return conversationsState.list.items.filter((item) => item.label);
|
|
2369
2353
|
}, [conversationsState.list.items]);
|
|
2370
|
-
const
|
|
2354
|
+
const favoriteConversationList = React10.useMemo(() => {
|
|
2355
|
+
return favoriteState.list.items.filter((item) => item.title).map((item) => ({
|
|
2356
|
+
...item,
|
|
2357
|
+
key: item.id,
|
|
2358
|
+
id: item.id,
|
|
2359
|
+
label: item.title,
|
|
2360
|
+
spec: item.spec,
|
|
2361
|
+
isFavorite: true,
|
|
2362
|
+
group: classifyTime(item.updatedAt)
|
|
2363
|
+
}));
|
|
2364
|
+
}, [favoriteState.list.items]);
|
|
2365
|
+
const historyMenuConfig = (conversation) => ({
|
|
2371
2366
|
items: [
|
|
2372
2367
|
{
|
|
2373
2368
|
label: `${conversation.isFavorite ? "\u53D6\u6D88\u6536\u85CF" : "\u6536\u85CF"}`,
|
|
@@ -2390,31 +2385,135 @@ var ConversationList_default = () => {
|
|
|
2390
2385
|
}
|
|
2391
2386
|
}
|
|
2392
2387
|
});
|
|
2393
|
-
|
|
2394
|
-
|
|
2388
|
+
const favoriteMenuConfig = (conversation) => ({
|
|
2389
|
+
trigger: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2390
|
+
antd.Popconfirm,
|
|
2391
|
+
{
|
|
2392
|
+
title: "\u63D0\u793A",
|
|
2393
|
+
okText: "\u786E\u5B9A",
|
|
2394
|
+
cancelText: "\u53D6\u6D88",
|
|
2395
|
+
description: "\u786E\u8BA4\u53D6\u6D88\u6536\u85CF\u8BE5\u4F1A\u8BDD\u5417\uFF1F",
|
|
2396
|
+
onConfirm: (e) => {
|
|
2397
|
+
e.stopPropagation();
|
|
2398
|
+
chatStore.collectConversation(conversation.id, false);
|
|
2399
|
+
},
|
|
2400
|
+
onCancel: (e) => e.stopPropagation(),
|
|
2401
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2402
|
+
antd.Button,
|
|
2403
|
+
{
|
|
2404
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.DeleteOutlined, {}),
|
|
2405
|
+
title: "\u53D6\u6D88\u6536\u85CF",
|
|
2406
|
+
type: "text",
|
|
2407
|
+
onClick: (e) => {
|
|
2408
|
+
e.stopPropagation();
|
|
2409
|
+
}
|
|
2410
|
+
}
|
|
2411
|
+
)
|
|
2412
|
+
}
|
|
2413
|
+
),
|
|
2414
|
+
items: []
|
|
2415
|
+
});
|
|
2416
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default2.conversationTabs, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2417
|
+
antd.Tabs,
|
|
2395
2418
|
{
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
},
|
|
2401
|
-
loader: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center", children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { indicator: /* @__PURE__ */ jsxRuntime.jsx(icons.RedoOutlined, { spin: true }), size: "small" }) }),
|
|
2402
|
-
style: { overflow: "hidden" },
|
|
2403
|
-
scrollableTarget: "scrollableDiv",
|
|
2404
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2405
|
-
xV2.Conversations,
|
|
2419
|
+
activeKey: activeTabKey,
|
|
2420
|
+
centered: true,
|
|
2421
|
+
onChange: setActiveTabKey,
|
|
2422
|
+
items: [
|
|
2406
2423
|
{
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2424
|
+
key: "history",
|
|
2425
|
+
label: "\u5386\u53F2\u4F1A\u8BDD",
|
|
2426
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default2.conversationTabPane, children: conversationList.length ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default2.conversationScrollArea, id: "historyConversationScrollableDiv", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2427
|
+
InfiniteScroll__default.default,
|
|
2428
|
+
{
|
|
2429
|
+
dataLength: conversationList.length,
|
|
2430
|
+
hasMore: false,
|
|
2431
|
+
next: () => {
|
|
2432
|
+
console2__default.default.log("next");
|
|
2433
|
+
},
|
|
2434
|
+
loader: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center", children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { indicator: /* @__PURE__ */ jsxRuntime.jsx(icons.RedoOutlined, { spin: true }), size: "small" }) }),
|
|
2435
|
+
style: { overflow: "hidden" },
|
|
2436
|
+
scrollableTarget: "historyConversationScrollableDiv",
|
|
2437
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2438
|
+
xV2.Conversations,
|
|
2439
|
+
{
|
|
2440
|
+
className: styles_module_default2.conversations,
|
|
2441
|
+
items: conversationList,
|
|
2442
|
+
activeKey: conversationState.active.id,
|
|
2443
|
+
onActiveChange: async (id) => chatStore.switchConversation(id),
|
|
2444
|
+
groupable: true,
|
|
2445
|
+
menu: historyMenuConfig
|
|
2446
|
+
}
|
|
2447
|
+
)
|
|
2448
|
+
}
|
|
2449
|
+
) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default2.conversationEmpty, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Empty, { description: "\u6682\u65E0\u4F1A\u8BDD\u8BB0\u5F55", image: antd.Empty.PRESENTED_IMAGE_SIMPLE }) }) })
|
|
2450
|
+
},
|
|
2451
|
+
{
|
|
2452
|
+
key: "favorite",
|
|
2453
|
+
label: "\u6536\u85CF\u4F1A\u8BDD",
|
|
2454
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default2.conversationTabPane, children: favoriteConversationList.length ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default2.conversationScrollArea, id: "favoriteConversationScrollableDiv", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2455
|
+
InfiniteScroll__default.default,
|
|
2456
|
+
{
|
|
2457
|
+
dataLength: favoriteConversationList.length,
|
|
2458
|
+
hasMore: false,
|
|
2459
|
+
next: () => {
|
|
2460
|
+
console2__default.default.log("next");
|
|
2461
|
+
},
|
|
2462
|
+
loader: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center", children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { indicator: /* @__PURE__ */ jsxRuntime.jsx(icons.RedoOutlined, { spin: true }), size: "small" }) }),
|
|
2463
|
+
style: { overflow: "hidden" },
|
|
2464
|
+
scrollableTarget: "favoriteConversationScrollableDiv",
|
|
2465
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2466
|
+
xV2.Conversations,
|
|
2467
|
+
{
|
|
2468
|
+
className: styles_module_default2.conversations,
|
|
2469
|
+
items: favoriteConversationList,
|
|
2470
|
+
activeKey: conversationState.active.id,
|
|
2471
|
+
onActiveChange: async (id) => chatStore.switchConversation(id),
|
|
2472
|
+
groupable: true,
|
|
2473
|
+
menu: favoriteMenuConfig
|
|
2474
|
+
}
|
|
2475
|
+
)
|
|
2476
|
+
}
|
|
2477
|
+
) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default2.conversationEmpty, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Empty, { description: "\u6682\u65E0\u6536\u85CF\u4F1A\u8BDD", image: antd.Empty.PRESENTED_IMAGE_SIMPLE }) }) })
|
|
2413
2478
|
}
|
|
2414
|
-
|
|
2479
|
+
]
|
|
2415
2480
|
}
|
|
2416
|
-
)
|
|
2481
|
+
) });
|
|
2417
2482
|
};
|
|
2483
|
+
|
|
2484
|
+
// src/ui/common/FeatureComponents/style.module.less
|
|
2485
|
+
var style_module_default = {
|
|
2486
|
+
popover: "style_module_popover",
|
|
2487
|
+
resourceBtn: "style_module_resourceBtn",
|
|
2488
|
+
divider: "style_module_divider",
|
|
2489
|
+
count: "style_module_count",
|
|
2490
|
+
resourceBtnActive: "style_module_resourceBtnActive",
|
|
2491
|
+
customModal: "style_module_customModal",
|
|
2492
|
+
layout: "style_module_layout",
|
|
2493
|
+
sider: "style_module_sider",
|
|
2494
|
+
categoryName: "style_module_categoryName",
|
|
2495
|
+
siderContent: "style_module_siderContent",
|
|
2496
|
+
categoryItem: "style_module_categoryItem",
|
|
2497
|
+
categoryActive: "style_module_categoryActive",
|
|
2498
|
+
roundCheckbox: "style_module_roundCheckbox",
|
|
2499
|
+
content: "style_module_content",
|
|
2500
|
+
searchInput: "style_module_searchInput",
|
|
2501
|
+
selectedCount: "style_module_selectedCount",
|
|
2502
|
+
tagsArea: "style_module_tagsArea",
|
|
2503
|
+
tagContainer: "style_module_tagContainer",
|
|
2504
|
+
tag: "style_module_tag",
|
|
2505
|
+
expandBtnWrapper: "style_module_expandBtnWrapper",
|
|
2506
|
+
expandBtn: "style_module_expandBtn",
|
|
2507
|
+
tagsExpanded: "style_module_tagsExpanded",
|
|
2508
|
+
listArea: "style_module_listArea",
|
|
2509
|
+
listInner: "style_module_listInner",
|
|
2510
|
+
listItem: "style_module_listItem",
|
|
2511
|
+
listItemSelected: "style_module_listItemSelected",
|
|
2512
|
+
itemIconWrapper: "style_module_itemIconWrapper",
|
|
2513
|
+
itemInfo: "style_module_itemInfo",
|
|
2514
|
+
itemDesc: "style_module_itemDesc",
|
|
2515
|
+
footer: "style_module_footer",
|
|
2516
|
+
titleContainer: "style_module_titleContainer"};
|
|
2418
2517
|
var HistoryBtn_default = ({ icon, ...rest }) => {
|
|
2419
2518
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2420
2519
|
antd.Popover,
|
|
@@ -2434,12 +2533,13 @@ var ChatHeader_default = ({
|
|
|
2434
2533
|
closeBtn = false,
|
|
2435
2534
|
newConversationBtn = true,
|
|
2436
2535
|
conversationListBtn = true,
|
|
2437
|
-
conversationFavoriteBtn = true
|
|
2536
|
+
conversationFavoriteBtn = true,
|
|
2537
|
+
conversationShareBtn = true
|
|
2438
2538
|
}) => {
|
|
2439
2539
|
const chatStore = useChatStore();
|
|
2440
2540
|
const agentState = valtio.useSnapshot(chatStore.agent);
|
|
2441
2541
|
const configState = valtio.useSnapshot(chatStore.config);
|
|
2442
|
-
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
2542
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classNames2__default.default(styles_module_default2.chatHeader, "zero-chat-header"), children: [
|
|
2443
2543
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles_module_default2.chatHeaderContent, children: [
|
|
2444
2544
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2445
2545
|
common.RenderWrapper,
|
|
@@ -2455,7 +2555,8 @@ var ChatHeader_default = ({
|
|
|
2455
2555
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles_module_default2.chatHeaderBtnGroup, children: [
|
|
2456
2556
|
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: newConversationBtn, DefaultComponent: CreateBtn_default }),
|
|
2457
2557
|
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: conversationListBtn, DefaultComponent: HistoryBtn_default }),
|
|
2458
|
-
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: conversationFavoriteBtn, DefaultComponent: ConversationFavoritesBtn_default })
|
|
2558
|
+
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: conversationFavoriteBtn, DefaultComponent: ConversationFavoritesBtn_default }),
|
|
2559
|
+
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: conversationShareBtn, DefaultComponent: ConversationShareBtn_default })
|
|
2459
2560
|
] }),
|
|
2460
2561
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2461
2562
|
common.RenderWrapper,
|
|
@@ -2485,8 +2586,8 @@ var ConversationListHeader_default = ({ title = true, avatar = true, newConversa
|
|
|
2485
2586
|
{
|
|
2486
2587
|
control: title,
|
|
2487
2588
|
DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, gap: 4, flex: 1, style: { minWidth: 0 }, children: [
|
|
2488
|
-
/* @__PURE__ */ jsxRuntime.jsx(Text, { strong: true, className:
|
|
2489
|
-
/* @__PURE__ */ jsxRuntime.jsx(Text, { type: "secondary", ellipsis: true, className:
|
|
2589
|
+
/* @__PURE__ */ jsxRuntime.jsx(Text, { strong: true, className: classNames2__default.default("fz-16"), children: agentState.agentInfo.name }),
|
|
2590
|
+
/* @__PURE__ */ jsxRuntime.jsx(Text, { type: "secondary", ellipsis: true, className: classNames2__default.default("fz-12"), children: agentState.agentInfo.description })
|
|
2490
2591
|
] }) })
|
|
2491
2592
|
}
|
|
2492
2593
|
)
|
|
@@ -2501,7 +2602,7 @@ var ConversationListHeader_default = ({ title = true, avatar = true, newConversa
|
|
|
2501
2602
|
block: true,
|
|
2502
2603
|
type: "primary",
|
|
2503
2604
|
onClick: () => chatStore.createConversation(),
|
|
2504
|
-
className:
|
|
2605
|
+
className: classNames2__default.default(styles_module_default2.createConversationButton),
|
|
2505
2606
|
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.PlusOutlined, {}),
|
|
2506
2607
|
children: "\u65B0\u5EFA\u4F1A\u8BDD"
|
|
2507
2608
|
}
|
|
@@ -2511,7 +2612,7 @@ var ConversationListHeader_default = ({ title = true, avatar = true, newConversa
|
|
|
2511
2612
|
] });
|
|
2512
2613
|
};
|
|
2513
2614
|
var ConversationListPanel = ({ header }) => {
|
|
2514
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className:
|
|
2615
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames2__default.default("height-full", "zero-chat-conversations", styles_module_default2.conversationListPanel), children: [
|
|
2515
2616
|
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: header, DefaultComponent: ConversationListHeader_default }),
|
|
2516
2617
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsxRuntime.jsx(ConversationList_default, {}) })
|
|
2517
2618
|
] });
|
|
@@ -2980,7 +3081,7 @@ var CHART_COMPONENTS = Object.fromEntries(
|
|
|
2980
3081
|
);
|
|
2981
3082
|
var Charts_default = ({ data, loading }) => {
|
|
2982
3083
|
const { type, config } = data;
|
|
2983
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className:
|
|
3084
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames2__default.default(styles_module_default3.chart, "scroll-fade-in"), children: loading ? (
|
|
2984
3085
|
// Antd 骨架屏
|
|
2985
3086
|
/* @__PURE__ */ jsxRuntime.jsx(antd.Skeleton.Node, { active: true, className: styles_module_default3.chartSkeleton, children: /* @__PURE__ */ jsxRuntime.jsx(icons.DotChartOutlined, { className: styles_module_default3.chartSkeletonIcon }) })
|
|
2986
3087
|
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3063,12 +3164,12 @@ var DocDrawer_default = ({ title, open, onClose, paramsStr }) => {
|
|
|
3063
3164
|
}, [paramsStr]);
|
|
3064
3165
|
return /* @__PURE__ */ jsxRuntime.jsx(antd.Drawer, { title, push: false, size: "100%", open, onClose, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { spinning: loading, children: content ? /* @__PURE__ */ jsxRuntime.jsx(XMarkdown__default.default, { content }) : /* @__PURE__ */ jsxRuntime.jsx(antd.Empty, { className: "m-t-32" }) }) });
|
|
3065
3166
|
};
|
|
3066
|
-
var IndexQuote_default = ({ data, loading, message:
|
|
3167
|
+
var IndexQuote_default = ({ data, loading, message: message4 }) => {
|
|
3067
3168
|
const [open, setOpen] = React10.useState(false);
|
|
3068
3169
|
const citation = React10.useMemo(() => {
|
|
3069
|
-
const citations =
|
|
3170
|
+
const citations = message4.content?.find((item) => item.type === "citation")?.citations ?? [];
|
|
3070
3171
|
return citations?.find((item) => String(item.citationId) === String(data.citationId));
|
|
3071
|
-
}, [data.citationId,
|
|
3172
|
+
}, [data.citationId, message4.content]);
|
|
3072
3173
|
const onClick = () => {
|
|
3073
3174
|
if (!citation?.citationUrl) return;
|
|
3074
3175
|
if (common.isExternal(citation.citationUrl)) {
|
|
@@ -3083,7 +3184,7 @@ var IndexQuote_default = ({ data, loading, message: message3 }) => {
|
|
|
3083
3184
|
open && /* @__PURE__ */ jsxRuntime.jsx(DocDrawer_default, { paramsStr: citation?.citationUrl, title: citation?.citationName, open, onClose: () => setOpen(false) })
|
|
3084
3185
|
] });
|
|
3085
3186
|
};
|
|
3086
|
-
var MarkImg_default = ({ data, loading, message:
|
|
3187
|
+
var MarkImg_default = ({ data, loading, message: message4, ...rest }) => {
|
|
3087
3188
|
const getPreviewFileUrl = (src) => {
|
|
3088
3189
|
return common.buildUrlParams({ [TOKEN_KEY]: tokenManager.get() || "" }, src);
|
|
3089
3190
|
};
|
|
@@ -3110,8 +3211,9 @@ var MdEdit_default = ({ data, loading }) => {
|
|
|
3110
3211
|
!loading && /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { justify: "end", className: "m-t-16", children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { color: "primary", variant: "outlined", onClick: onOk, children: btnText }) })
|
|
3111
3212
|
] });
|
|
3112
3213
|
};
|
|
3113
|
-
var PreviewLink_default = ({ data, loading, message:
|
|
3214
|
+
var PreviewLink_default = ({ data, loading, message: message4, ...rest }) => {
|
|
3114
3215
|
const chatStore = useChatStore();
|
|
3216
|
+
const conversationWorkspacePrefix = "/workspace/conversation/";
|
|
3115
3217
|
const getLinkFileName = (path) => {
|
|
3116
3218
|
const lastSegment = path.split("/").pop();
|
|
3117
3219
|
if (!lastSegment) {
|
|
@@ -3123,13 +3225,27 @@ var PreviewLink_default = ({ data, loading, message: message3, ...rest }) => {
|
|
|
3123
3225
|
return lastSegment;
|
|
3124
3226
|
}
|
|
3125
3227
|
};
|
|
3126
|
-
const
|
|
3228
|
+
const normalizePreviewPath = (path) => {
|
|
3229
|
+
if (!path) {
|
|
3230
|
+
return path;
|
|
3231
|
+
}
|
|
3232
|
+
if (path.startsWith(conversationWorkspacePrefix)) {
|
|
3233
|
+
return path;
|
|
3234
|
+
}
|
|
3235
|
+
if (path.startsWith(conversationWorkspacePrefix.slice(1))) {
|
|
3236
|
+
return `/${path}`;
|
|
3237
|
+
}
|
|
3127
3238
|
const fileName = getLinkFileName(path);
|
|
3239
|
+
return `${conversationWorkspacePrefix}${fileName}`;
|
|
3240
|
+
};
|
|
3241
|
+
const handlePreviewByPath = (path) => {
|
|
3242
|
+
const normalizedPath = normalizePreviewPath(path);
|
|
3243
|
+
const fileName = getLinkFileName(normalizedPath);
|
|
3128
3244
|
const suffix = common.getFileSuffixName(fileName);
|
|
3129
3245
|
chatStore.setPreview({
|
|
3130
3246
|
fileUrl: chatStore.config.services.request.getPreviewUrl({
|
|
3131
|
-
path,
|
|
3132
|
-
workspaceId:
|
|
3247
|
+
path: normalizedPath,
|
|
3248
|
+
workspaceId: message4.conversationId
|
|
3133
3249
|
}),
|
|
3134
3250
|
fileName,
|
|
3135
3251
|
suffix
|
|
@@ -3242,7 +3358,7 @@ var adaptMarkdownComponent = (Component, payloadMapRef, messageRef) => {
|
|
|
3242
3358
|
return WrappedComponent;
|
|
3243
3359
|
};
|
|
3244
3360
|
var adaptMarkdownComponents = (components, payloadMapRef, messageRef) => Object.fromEntries(Object.entries(components ?? {}).map(([key, Component]) => [key, adaptMarkdownComponent(Component, payloadMapRef, messageRef)]));
|
|
3245
|
-
var XMarkdown_default = React10.memo(({ message:
|
|
3361
|
+
var XMarkdown_default = React10.memo(({ message: message4, components = {}, content = "", ...rest }) => {
|
|
3246
3362
|
const config = React10.useMemo(() => getMarkdownConfig(), []);
|
|
3247
3363
|
const formattedContent = React10.useMemo(() => formatMixedContent(content), [content]);
|
|
3248
3364
|
const newComponents = React10.useMemo(
|
|
@@ -3268,14 +3384,14 @@ var XMarkdown_default = React10.memo(({ message: message3, components = {}, cont
|
|
|
3268
3384
|
[formattedContent, payloadTagPattern]
|
|
3269
3385
|
);
|
|
3270
3386
|
const payloadMapRef = React10.useRef(payloadMap);
|
|
3271
|
-
const messageRef = React10.useRef(
|
|
3387
|
+
const messageRef = React10.useRef(message4);
|
|
3272
3388
|
payloadMapRef.current = payloadMap;
|
|
3273
|
-
messageRef.current =
|
|
3389
|
+
messageRef.current = message4;
|
|
3274
3390
|
const markdownComponents = React10.useMemo(() => adaptMarkdownComponents(newComponents, payloadMapRef, messageRef), [payloadTagPattern]);
|
|
3275
3391
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3276
3392
|
XMarkdown__default.default,
|
|
3277
3393
|
{
|
|
3278
|
-
className:
|
|
3394
|
+
className: classNames2__default.default("x-markdown-light", styles_module_default4.xMarkdownStyle),
|
|
3279
3395
|
config,
|
|
3280
3396
|
...rest,
|
|
3281
3397
|
content: processedContent,
|
|
@@ -3620,7 +3736,7 @@ var Switch = ({ id, label, value, bind_path_token, onChange, onDataChange }) =>
|
|
|
3620
3736
|
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 13, color: "#555" }, children: label })
|
|
3621
3737
|
] });
|
|
3622
3738
|
};
|
|
3623
|
-
var
|
|
3739
|
+
var Button12 = ({ label, variant = "default", onClick, action, onAction }) => {
|
|
3624
3740
|
const handleClick = () => {
|
|
3625
3741
|
if (onClick) {
|
|
3626
3742
|
onClick();
|
|
@@ -3650,7 +3766,7 @@ var A2uiComponents = {
|
|
|
3650
3766
|
TextField,
|
|
3651
3767
|
Select,
|
|
3652
3768
|
Switch,
|
|
3653
|
-
Button:
|
|
3769
|
+
Button: Button12,
|
|
3654
3770
|
Divider,
|
|
3655
3771
|
Tag: Tag3,
|
|
3656
3772
|
Progress,
|
|
@@ -3697,10 +3813,10 @@ function extractDismissedSurfaceIdsFromMessages(messages) {
|
|
|
3697
3813
|
const lastCreateIndexBySurface = /* @__PURE__ */ new Map();
|
|
3698
3814
|
const lastActionIndexBySurface = /* @__PURE__ */ new Map();
|
|
3699
3815
|
for (let messageIndex = 0; messageIndex < messages.length; messageIndex++) {
|
|
3700
|
-
const
|
|
3701
|
-
const items = Array.isArray(
|
|
3816
|
+
const message4 = messages[messageIndex];
|
|
3817
|
+
const items = Array.isArray(message4?.content) ? message4.content : [];
|
|
3702
3818
|
for (const item of items) {
|
|
3703
|
-
if (
|
|
3819
|
+
if (message4?.role !== 1) {
|
|
3704
3820
|
if (item?.type === "a2uiCommand" && item.command) {
|
|
3705
3821
|
const surfaceId = String(item.command?.createSurface?.surfaceId || "").trim();
|
|
3706
3822
|
if (surfaceId) lastCreateIndexBySurface.set(surfaceId, messageIndex);
|
|
@@ -3716,7 +3832,7 @@ function extractDismissedSurfaceIdsFromMessages(messages) {
|
|
|
3716
3832
|
}
|
|
3717
3833
|
}
|
|
3718
3834
|
}
|
|
3719
|
-
if (
|
|
3835
|
+
if (message4?.role === 1 && item?.type === "text") {
|
|
3720
3836
|
const text = item.messageContent || item.text || "";
|
|
3721
3837
|
if (typeof text !== "string" || !text.includes("a2ui_action.v1")) continue;
|
|
3722
3838
|
try {
|
|
@@ -4299,9 +4415,9 @@ function diffConversationMessages(messages, prevCursors) {
|
|
|
4299
4415
|
const nextCursors = [];
|
|
4300
4416
|
const pendingItems = [];
|
|
4301
4417
|
for (let messageIndex = 0; messageIndex < messages.length; messageIndex += 1) {
|
|
4302
|
-
const
|
|
4303
|
-
const messageId = String(
|
|
4304
|
-
const items = Array.isArray(
|
|
4418
|
+
const message4 = messages[messageIndex];
|
|
4419
|
+
const messageId = String(message4?.messageId ?? messageIndex);
|
|
4420
|
+
const items = Array.isArray(message4?.content) ? message4.content : [];
|
|
4305
4421
|
const prevCursor = prevCursors[messageIndex];
|
|
4306
4422
|
const startIndex = prevCursor ? prevCursor.contentLength : 0;
|
|
4307
4423
|
if (prevCursor && (prevCursor.messageId !== messageId || items.length < prevCursor.contentLength)) {
|
|
@@ -4318,9 +4434,9 @@ function scanA2uiTagsFromMessages(messages, processedTagIds) {
|
|
|
4318
4434
|
const newTags = [];
|
|
4319
4435
|
const newTagIds = [];
|
|
4320
4436
|
for (let messageIndex = 0; messageIndex < messages.length; messageIndex += 1) {
|
|
4321
|
-
const
|
|
4322
|
-
const messageId = String(
|
|
4323
|
-
const items = Array.isArray(
|
|
4437
|
+
const message4 = messages[messageIndex];
|
|
4438
|
+
const messageId = String(message4?.messageId ?? messageIndex);
|
|
4439
|
+
const items = Array.isArray(message4?.content) ? message4.content : [];
|
|
4324
4440
|
for (const item of items) {
|
|
4325
4441
|
const text = extractItemTextForA2ui(item);
|
|
4326
4442
|
if (typeof text !== "string" || !text.includes("<A2UI")) continue;
|
|
@@ -4376,9 +4492,9 @@ function reduceA2uiRuntimeMessages(state, messages) {
|
|
|
4376
4492
|
processA2uiCommand(cmd, messageIndex, messageId, nextState, effects, deletedSurfaceIds, nextWizardSteps);
|
|
4377
4493
|
}
|
|
4378
4494
|
});
|
|
4379
|
-
nextState.processedMessageCursors = shouldReplayAll ? messages.map((
|
|
4380
|
-
messageId: String(
|
|
4381
|
-
contentLength: Array.isArray(
|
|
4495
|
+
nextState.processedMessageCursors = shouldReplayAll ? messages.map((message4, messageIndex) => ({
|
|
4496
|
+
messageId: String(message4?.messageId ?? messageIndex),
|
|
4497
|
+
contentLength: Array.isArray(message4?.content) ? message4.content.length : 0
|
|
4382
4498
|
})) : nextCursors;
|
|
4383
4499
|
nextState.wizardStepBySurface = { ...nextState.wizardStepBySurface, ...nextWizardSteps };
|
|
4384
4500
|
if (deletedSurfaceIds.size) {
|
|
@@ -4726,8 +4842,8 @@ function readContextModelPath(context) {
|
|
|
4726
4842
|
function buildLatestCommandIndexBySurface(messages) {
|
|
4727
4843
|
const indexBySurface = {};
|
|
4728
4844
|
let commandIndex = -1;
|
|
4729
|
-
for (const
|
|
4730
|
-
const items = Array.isArray(
|
|
4845
|
+
for (const message4 of messages) {
|
|
4846
|
+
const items = Array.isArray(message4?.content) ? message4.content : [];
|
|
4731
4847
|
for (const item of items) {
|
|
4732
4848
|
if (item?.type === "a2uiCommand" && item.command) {
|
|
4733
4849
|
commandIndex += 1;
|
|
@@ -4915,7 +5031,7 @@ var TextNode2 = React10__namespace.default.memo(
|
|
|
4915
5031
|
item,
|
|
4916
5032
|
role,
|
|
4917
5033
|
customComponents,
|
|
4918
|
-
message:
|
|
5034
|
+
message: message4
|
|
4919
5035
|
}) => {
|
|
4920
5036
|
const content = toA2uiDisplayText(role, item?.messageContent);
|
|
4921
5037
|
const markdownComponents = {
|
|
@@ -4928,7 +5044,7 @@ var TextNode2 = React10__namespace.default.memo(
|
|
|
4928
5044
|
const markdownContent = typeof content === "string" ? transformResourceText(content) : content;
|
|
4929
5045
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4930
5046
|
!!item.reasoningContent && /* @__PURE__ */ jsxRuntime.jsx(xV2.Think, { title: "\u6DF1\u5EA6\u601D\u8003", style: { marginBottom: "16px" }, children: item.reasoningContent }),
|
|
4931
|
-
!!markdownContent && /* @__PURE__ */ jsxRuntime.jsx(XMarkdown_default, { message:
|
|
5047
|
+
!!markdownContent && /* @__PURE__ */ jsxRuntime.jsx(XMarkdown_default, { message: message4, components: markdownComponents, content: markdownContent })
|
|
4932
5048
|
] });
|
|
4933
5049
|
}
|
|
4934
5050
|
);
|
|
@@ -5256,9 +5372,9 @@ var ToolCallItem = ({ item }) => {
|
|
|
5256
5372
|
};
|
|
5257
5373
|
var tool_call_item_default = ToolCallItem;
|
|
5258
5374
|
var RENDERABLE_MESSAGE_TYPES = ["runStarted", "toolCall", "toolResult", "text", "stepError", "runFailed", "files", "plan"];
|
|
5259
|
-
var MessageRender_default = React10__namespace.default.memo(({ role, message:
|
|
5375
|
+
var MessageRender_default = React10__namespace.default.memo(({ role, message: message4, messageIndex = -1, loading, containerRef, customComponents }) => {
|
|
5260
5376
|
const content = React10.useMemo(() => {
|
|
5261
|
-
return (
|
|
5377
|
+
return (message4.content || []).filter((item) => {
|
|
5262
5378
|
if (!RENDERABLE_MESSAGE_TYPES.includes(item.type)) {
|
|
5263
5379
|
return false;
|
|
5264
5380
|
}
|
|
@@ -5271,12 +5387,12 @@ var MessageRender_default = React10__namespace.default.memo(({ role, message: me
|
|
|
5271
5387
|
}
|
|
5272
5388
|
return true;
|
|
5273
5389
|
});
|
|
5274
|
-
}, [
|
|
5390
|
+
}, [message4.content]);
|
|
5275
5391
|
const quoteMsg = React10.useMemo(() => {
|
|
5276
5392
|
const quoteMsg2 = {};
|
|
5277
|
-
if (
|
|
5393
|
+
if (message4.params) {
|
|
5278
5394
|
try {
|
|
5279
|
-
const citation = JSON.parse(
|
|
5395
|
+
const citation = JSON.parse(message4.params).citation;
|
|
5280
5396
|
if (citation) {
|
|
5281
5397
|
quoteMsg2.messageContent = citation;
|
|
5282
5398
|
}
|
|
@@ -5284,7 +5400,7 @@ var MessageRender_default = React10__namespace.default.memo(({ role, message: me
|
|
|
5284
5400
|
}
|
|
5285
5401
|
}
|
|
5286
5402
|
return common.isEmptyObj(quoteMsg2) ? null : quoteMsg2;
|
|
5287
|
-
}, [
|
|
5403
|
+
}, [message4.params, message4.quoteMsg]);
|
|
5288
5404
|
const showPending = loading && (content.length === 0 || content[content.length - 1].type !== "text");
|
|
5289
5405
|
if (content.length === 0 && !showPending) return null;
|
|
5290
5406
|
const lastToolCallIndex = (() => {
|
|
@@ -5308,20 +5424,20 @@ var MessageRender_default = React10__namespace.default.memo(({ role, message: me
|
|
|
5308
5424
|
TextNode2,
|
|
5309
5425
|
{
|
|
5310
5426
|
item,
|
|
5311
|
-
role:
|
|
5427
|
+
role: message4.role,
|
|
5312
5428
|
customComponents,
|
|
5313
|
-
message:
|
|
5429
|
+
message: message4,
|
|
5314
5430
|
messageIndex
|
|
5315
5431
|
},
|
|
5316
5432
|
`message-${index}`
|
|
5317
5433
|
),
|
|
5318
|
-
(item.type === "stepError" || item.type === "runFailed") && (item.errorMessage ? /* @__PURE__ */ jsxRuntime.jsx(XMarkdown_default, { message:
|
|
5434
|
+
(item.type === "stepError" || item.type === "runFailed") && (item.errorMessage ? /* @__PURE__ */ jsxRuntime.jsx(XMarkdown_default, { message: message4, components: customComponents, content: item.errorMessage }) : null),
|
|
5319
5435
|
item.type === "files" && /* @__PURE__ */ jsxRuntime.jsx(FilesNode, { item }, `files-${index}`),
|
|
5320
5436
|
item.type === "plan" && /* @__PURE__ */ jsxRuntime.jsx(A2uiPlanNode, { item }, `plan-${index}`)
|
|
5321
5437
|
] })
|
|
5322
5438
|
}
|
|
5323
5439
|
),
|
|
5324
|
-
index === lastToolCallIndex && messageIndex >= 0 ? /* @__PURE__ */ jsxRuntime.jsx(A2uiMessageCards, { messageIndex, message:
|
|
5440
|
+
index === lastToolCallIndex && messageIndex >= 0 ? /* @__PURE__ */ jsxRuntime.jsx(A2uiMessageCards, { messageIndex, message: message4 }) : null
|
|
5325
5441
|
] }, `message-${index}`)),
|
|
5326
5442
|
showPending && role.user === "agent" && /* @__PURE__ */ jsxRuntime.jsx(xV2.Bubble, { role: role.user, placement: role.placement, content: /* @__PURE__ */ jsxRuntime.jsx(RunStartedNode, {}) }),
|
|
5327
5443
|
quoteMsg && /* @__PURE__ */ jsxRuntime.jsx(QuoteMsgNode, { quoteMsg, role })
|
|
@@ -5340,7 +5456,7 @@ var WelcomeItem_default = ({ icon = true, title = true, description = true, prom
|
|
|
5340
5456
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5341
5457
|
xV2.Welcome,
|
|
5342
5458
|
{
|
|
5343
|
-
className:
|
|
5459
|
+
className: classNames2__default.default(styles_module_default2.chatWelcome, "p-t-32"),
|
|
5344
5460
|
variant: "borderless",
|
|
5345
5461
|
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5346
5462
|
common.RenderWrapper,
|
|
@@ -5366,7 +5482,7 @@ var WelcomeItem_default = ({ icon = true, title = true, description = true, prom
|
|
|
5366
5482
|
DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5367
5483
|
xV2.Prompts,
|
|
5368
5484
|
{
|
|
5369
|
-
className:
|
|
5485
|
+
className: classNames2__default.default("m-t-16", styles_module_default2.promptItem),
|
|
5370
5486
|
wrap: true,
|
|
5371
5487
|
onItemClick: (info) => chatStore.sendMessage(info.data.description),
|
|
5372
5488
|
items: recommendQuestions
|
|
@@ -5417,13 +5533,13 @@ var BubbleListItems_default = ({
|
|
|
5417
5533
|
const messageRefs = React10.useRef({});
|
|
5418
5534
|
const chatRecords = React10.useMemo(() => {
|
|
5419
5535
|
const chatRecords2 = [];
|
|
5420
|
-
conversationMessages.forEach((
|
|
5421
|
-
const role = getRole(
|
|
5536
|
+
conversationMessages.forEach((message4, messageIndex) => {
|
|
5537
|
+
const role = getRole(message4.role);
|
|
5422
5538
|
const isLeftBubble = role.user === "agent";
|
|
5423
|
-
const isMessageLoading = !!
|
|
5424
|
-
const baseKey = `${
|
|
5539
|
+
const isMessageLoading = !!message4.generating;
|
|
5540
|
+
const baseKey = `${message4.executionId}-${messageIndex}`;
|
|
5425
5541
|
const footerNode = !isMessageLoading ? /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { align: "center", gap: 8, children: [
|
|
5426
|
-
|
|
5542
|
+
message4.stopFlag && isLeftBubble && /* @__PURE__ */ jsxRuntime.jsx(Text3, { type: "secondary", style: { flex: "none" }, children: "\u5DF2\u505C\u6B62" }),
|
|
5427
5543
|
/* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { align: "center", gap: 4, children: role.user === "agent" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5428
5544
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5429
5545
|
antd.Button,
|
|
@@ -5443,21 +5559,21 @@ var BubbleListItems_default = ({
|
|
|
5443
5559
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5444
5560
|
antd.Button,
|
|
5445
5561
|
{
|
|
5446
|
-
color:
|
|
5562
|
+
color: message4.feedback === 1 ? "primary" : "default",
|
|
5447
5563
|
size: "small",
|
|
5448
5564
|
variant: "text",
|
|
5449
5565
|
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.LikeOutlined, {}),
|
|
5450
|
-
onClick: () => chatStore.feedback(
|
|
5566
|
+
onClick: () => chatStore.feedback(message4.executionId, 1, messageIndex)
|
|
5451
5567
|
}
|
|
5452
5568
|
),
|
|
5453
5569
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5454
5570
|
antd.Button,
|
|
5455
5571
|
{
|
|
5456
|
-
color:
|
|
5572
|
+
color: message4.feedback === 2 ? "primary" : "default",
|
|
5457
5573
|
size: "small",
|
|
5458
5574
|
variant: "text",
|
|
5459
5575
|
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.DislikeOutlined, {}),
|
|
5460
|
-
onClick: () => chatStore.feedback(
|
|
5576
|
+
onClick: () => chatStore.feedback(message4.executionId, 2, messageIndex)
|
|
5461
5577
|
}
|
|
5462
5578
|
),
|
|
5463
5579
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -5465,7 +5581,7 @@ var BubbleListItems_default = ({
|
|
|
5465
5581
|
{
|
|
5466
5582
|
control: agentActions,
|
|
5467
5583
|
ctx: {
|
|
5468
|
-
message:
|
|
5584
|
+
message: message4,
|
|
5469
5585
|
get dom() {
|
|
5470
5586
|
return messageRefs.current[baseKey];
|
|
5471
5587
|
}
|
|
@@ -5483,7 +5599,7 @@ var BubbleListItems_default = ({
|
|
|
5483
5599
|
MessageRender_default,
|
|
5484
5600
|
{
|
|
5485
5601
|
role,
|
|
5486
|
-
message:
|
|
5602
|
+
message: message4,
|
|
5487
5603
|
messageIndex,
|
|
5488
5604
|
customComponents,
|
|
5489
5605
|
loading: isMessageLoading,
|
|
@@ -5575,7 +5691,7 @@ var BubbleListItems_default = ({
|
|
|
5575
5691
|
autoScroll: false,
|
|
5576
5692
|
ref: listRef,
|
|
5577
5693
|
items: bubbleListItems,
|
|
5578
|
-
className:
|
|
5694
|
+
className: classNames2__default.default(styles_module_default2.bubbleList, "height-full", "scroll-fade-in"),
|
|
5579
5695
|
onScroll: handleScroll
|
|
5580
5696
|
},
|
|
5581
5697
|
conversationState.active.id
|
|
@@ -5726,7 +5842,7 @@ var ResourceSelectorModal_default = ({ open, type, onCancel }) => {
|
|
|
5726
5842
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5727
5843
|
antd.Flex,
|
|
5728
5844
|
{
|
|
5729
|
-
className:
|
|
5845
|
+
className: classNames2__default.default(style_module_default.categoryItem, { [style_module_default.categoryActive]: isChecked }),
|
|
5730
5846
|
onClick: () => handleCategoryChange(cat.id, !isChecked),
|
|
5731
5847
|
children: [
|
|
5732
5848
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -5761,7 +5877,7 @@ var ResourceSelectorModal_default = ({ open, type, onCancel }) => {
|
|
|
5761
5877
|
"\u5DF2\u9009 ",
|
|
5762
5878
|
selectedIds.length
|
|
5763
5879
|
] }) }),
|
|
5764
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
5880
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: classNames2__default.default(style_module_default.tagsArea, { [style_module_default.tagsExpanded]: tagsExpanded }), children: [
|
|
5765
5881
|
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, className: style_module_default.tagContainer, wrap: true, ref: tagsContainerRef, children: [
|
|
5766
5882
|
selectedIds.map((id) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
5767
5883
|
antd.Tag,
|
|
@@ -5791,7 +5907,7 @@ var ResourceSelectorModal_default = ({ open, type, onCancel }) => {
|
|
|
5791
5907
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5792
5908
|
"div",
|
|
5793
5909
|
{
|
|
5794
|
-
className:
|
|
5910
|
+
className: classNames2__default.default(style_module_default.listItem, { [style_module_default.listItemSelected]: isSelected }),
|
|
5795
5911
|
onClick: () => toggleItemSelection(item.id),
|
|
5796
5912
|
children: [
|
|
5797
5913
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: style_module_default.itemIconWrapper, children: /* @__PURE__ */ jsxRuntime.jsx(IconFont_default, { type: iconType }) }),
|
|
@@ -5921,7 +6037,7 @@ var ReasonBtn_default = ({}) => {
|
|
|
5921
6037
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5922
6038
|
"div",
|
|
5923
6039
|
{
|
|
5924
|
-
className:
|
|
6040
|
+
className: classNames2__default.default(style_module_default.resourceBtn, { [style_module_default.resourceBtnActive]: agentState.model.reasoning }),
|
|
5925
6041
|
onClick: () => chatStore.setAgentModel({ ...agentState.model, reasoning: !agentState.model.reasoning }),
|
|
5926
6042
|
children: [
|
|
5927
6043
|
/* @__PURE__ */ jsxRuntime.jsx(IconFont_default, { type: "icon-reason" }),
|
|
@@ -6394,9 +6510,9 @@ var ChatMainPanel = React10.memo(
|
|
|
6394
6510
|
);
|
|
6395
6511
|
const configState = valtio.useSnapshot(chatStore.config);
|
|
6396
6512
|
const agentState = valtio.useSnapshot(chatStore.agent);
|
|
6397
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className:
|
|
6513
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames2__default.default("height-full"), children: [
|
|
6398
6514
|
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.chatHeader, DefaultComponent: ChatHeader_default }),
|
|
6399
|
-
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { align: "center", vertical: true, gap: 24, className:
|
|
6515
|
+
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { align: "center", vertical: true, gap: 24, className: classNames2__default.default("height-full", styles_module_default5.bodyWidth), children: [
|
|
6400
6516
|
common.shouldRender(agentState.agentInfo.userInput && agentState.agentInfo.userInput.length > 0) && /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.userInput, DefaultComponent: UserInputPanel_default }),
|
|
6401
6517
|
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 }) }),
|
|
6402
6518
|
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.senderHeader, DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(ChatSenderHeader_default, {}) }),
|
|
@@ -6431,7 +6547,7 @@ var ChatPreviewPanel = React10.memo(({ file }) => {
|
|
|
6431
6547
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
6432
6548
|
file.fileUrl && /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: "height-full", children: [
|
|
6433
6549
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles_module_default5.previewHeader, children: [
|
|
6434
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className:
|
|
6550
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames2__default.default(styles_module_default5.previewHeaderTitle, "text-ellipsis"), title: file.fileName, children: file.fileName }),
|
|
6435
6551
|
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, justify: "center", align: "center", children: [
|
|
6436
6552
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6437
6553
|
antd.Button,
|
|
@@ -6536,6 +6652,8 @@ var layouts_default = React10.forwardRef(({ theme: theme5, params, hooks, layout
|
|
|
6536
6652
|
common.useDeepEffect(() => {
|
|
6537
6653
|
if (agentState.agentInfo.id) {
|
|
6538
6654
|
chatStore.initConversation(config);
|
|
6655
|
+
} else if (config.conversationId) {
|
|
6656
|
+
chatStore.switchConversation(config.conversationId);
|
|
6539
6657
|
}
|
|
6540
6658
|
}, [agentState.agentInfo.id, config.conversationId]);
|
|
6541
6659
|
const hasPreView = React10.useMemo(() => {
|
|
@@ -6554,25 +6672,25 @@ var layouts_default = React10.forwardRef(({ theme: theme5, params, hooks, layout
|
|
|
6554
6672
|
}, [hasPreView]);
|
|
6555
6673
|
common.useWebSocket({
|
|
6556
6674
|
url: configState.services.websocketUrls?.[0],
|
|
6557
|
-
onMessage: (
|
|
6675
|
+
onMessage: (message4) => chatStore.acceptMessage(message4.payload),
|
|
6558
6676
|
clientHeartbeat: false,
|
|
6559
6677
|
reconnectInterval: 1e4
|
|
6560
6678
|
});
|
|
6561
6679
|
common.useWebSocket({
|
|
6562
6680
|
url: configState.services.websocketUrls?.[1],
|
|
6563
|
-
onMessage: (
|
|
6681
|
+
onMessage: (message4) => chatStore.acceptMessage(message4.payload),
|
|
6564
6682
|
clientHeartbeat: false,
|
|
6565
6683
|
reconnectInterval: 1e4
|
|
6566
6684
|
});
|
|
6567
6685
|
React10.useEffect(() => {
|
|
6568
6686
|
hooks?.onBeforeInit?.();
|
|
6569
6687
|
}, []);
|
|
6570
|
-
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:
|
|
6688
|
+
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: classNames2__default.default(index_module_default3.chatLayout, "zero-chat-layout", "height-full"), children: [
|
|
6571
6689
|
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.globalHeader, DefaultComponent: ChatHeader_default }),
|
|
6572
6690
|
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { ref: containerRef, className: "full-scroll", children: [
|
|
6573
6691
|
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.leftPanel }),
|
|
6574
6692
|
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.conversationList, DefaultComponent: ConversationListPanel_default }),
|
|
6575
|
-
/* @__PURE__ */ jsxRuntime.jsxs(antd.Splitter, { className:
|
|
6693
|
+
/* @__PURE__ */ jsxRuntime.jsxs(antd.Splitter, { className: classNames2__default.default("flex-1", index_module_default3.animatedSplitter, { [index_module_default3.hideSplitterBar]: !hasPreView }), children: [
|
|
6576
6694
|
/* @__PURE__ */ jsxRuntime.jsx(antd.Splitter.Panel, { collapsible: false, max: 800, min: 400, size: sizes[1], children: /* @__PURE__ */ jsxRuntime.jsx(ChatMainPanel_default, { ref: senderRef }) }),
|
|
6577
6695
|
/* @__PURE__ */ jsxRuntime.jsx(antd.Splitter.Panel, { collapsible: false, min: 600, size: sizes[0], children: /* @__PURE__ */ jsxRuntime.jsx(ChatPreviewPanel_default, { file: configState.preview.file }) })
|
|
6578
6696
|
] })
|