@zero-library/chat-copilot 3.1.18 → 3.1.20
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 +73 -78
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +9 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +8 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.esm.js +73 -78
- package/dist/index.esm.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs.js
CHANGED
|
@@ -74,7 +74,7 @@ var styles_module_default = {
|
|
|
74
74
|
chatAttachments: "styles_module_chatAttachments",
|
|
75
75
|
chatSender: "styles_module_chatSender"};
|
|
76
76
|
var Attachments_default = React10.forwardRef(({ fileUpload, fileUploadConfig, fileList = [], onChange, extraParams }, ref) => {
|
|
77
|
-
const { message:
|
|
77
|
+
const { message: message3 } = antd.App.useApp();
|
|
78
78
|
const chatStore = useChatStore();
|
|
79
79
|
const configState = valtio.useSnapshot(chatStore.config);
|
|
80
80
|
const fileListRef = React10.useRef([]);
|
|
@@ -102,7 +102,7 @@ var Attachments_default = React10.forwardRef(({ fileUpload, fileUploadConfig, fi
|
|
|
102
102
|
onChange(files);
|
|
103
103
|
}, [attachedFiles]);
|
|
104
104
|
const onErrorTip = common.useDebounce((errorMsg) => {
|
|
105
|
-
|
|
105
|
+
message3.error(errorMsg);
|
|
106
106
|
}, 300);
|
|
107
107
|
const findConfig = (file) => {
|
|
108
108
|
return fileUploadConfig?.allowedTypes?.find((type) => type === common.getFileSuffixName(file.name)) || "";
|
|
@@ -863,7 +863,7 @@ var ChatInput = React10__namespace.forwardRef(
|
|
|
863
863
|
}
|
|
864
864
|
}
|
|
865
865
|
),
|
|
866
|
-
placeholder: !stringValue ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: index_module_default.promptEditorPlaceholder, children: placeholder || "\u4ECA\u5929\u5E2E\u4F60\u505A\u4E9B\u4EC0\u4E48\uFF1F
|
|
866
|
+
placeholder: !stringValue ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: index_module_default.promptEditorPlaceholder, children: placeholder || "\u4ECA\u5929\u5E2E\u4F60\u505A\u4E9B\u4EC0\u4E48\uFF1F" }) : null,
|
|
867
867
|
ErrorBoundary: LexicalErrorBoundary.LexicalErrorBoundary
|
|
868
868
|
}
|
|
869
869
|
),
|
|
@@ -1047,7 +1047,7 @@ var createChatService = (request, config) => {
|
|
|
1047
1047
|
return request.put("/agents/conversations/favorite", { conversationIds: [conversationId], favorite: isFavorite });
|
|
1048
1048
|
};
|
|
1049
1049
|
const shareConversation = (conversationId) => {
|
|
1050
|
-
return request.
|
|
1050
|
+
return request.post(`/agents/conversations/${conversationId}/share/url`);
|
|
1051
1051
|
};
|
|
1052
1052
|
return {
|
|
1053
1053
|
fetchModelList,
|
|
@@ -1347,6 +1347,7 @@ function createChatStore() {
|
|
|
1347
1347
|
id: data || "",
|
|
1348
1348
|
title: "",
|
|
1349
1349
|
agentId: agent.agentInfo?.id || "",
|
|
1350
|
+
isFavorite: false,
|
|
1350
1351
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1351
1352
|
spec: newSpec
|
|
1352
1353
|
});
|
|
@@ -1647,7 +1648,7 @@ function createChatStore() {
|
|
|
1647
1648
|
}
|
|
1648
1649
|
if (isMain) config.hooks?.onStepMessage?.(msg);
|
|
1649
1650
|
}
|
|
1650
|
-
function doneCallback(msg,
|
|
1651
|
+
function doneCallback(msg, message3, isMain) {
|
|
1651
1652
|
conversation.messages[msg.conversationId].loading = false;
|
|
1652
1653
|
const messages = conversation.messages[msg.conversationId]?.message;
|
|
1653
1654
|
if (messages) {
|
|
@@ -1940,9 +1941,9 @@ function createChatStore() {
|
|
|
1940
1941
|
}
|
|
1941
1942
|
}
|
|
1942
1943
|
}
|
|
1943
|
-
function processMessageContent(
|
|
1944
|
+
function processMessageContent(message3, targetMessages) {
|
|
1944
1945
|
const newMessage = {
|
|
1945
|
-
...
|
|
1946
|
+
...message3,
|
|
1946
1947
|
agentId: agent.agentInfo.id
|
|
1947
1948
|
};
|
|
1948
1949
|
const isMain = !targetMessages;
|
|
@@ -2010,13 +2011,13 @@ function createChatStore() {
|
|
|
2010
2011
|
}
|
|
2011
2012
|
processMessageContent(newMessage);
|
|
2012
2013
|
};
|
|
2013
|
-
const sendMessage = async (
|
|
2014
|
+
const sendMessage = async (message3, msgFiles = [], params) => {
|
|
2014
2015
|
const conversationId = conversation.active.id;
|
|
2015
2016
|
if (conversation.messages[conversationId].loading) return;
|
|
2016
2017
|
let msgContent = "", files;
|
|
2017
2018
|
const references = conversation.messages[conversationId].references;
|
|
2018
|
-
if (
|
|
2019
|
-
msgContent =
|
|
2019
|
+
if (message3) {
|
|
2020
|
+
msgContent = message3;
|
|
2020
2021
|
files = [...msgFiles, ...conversation.messages[conversationId].files || []];
|
|
2021
2022
|
} else {
|
|
2022
2023
|
if (references?.type === 1 && references?.content?.msgContent) {
|
|
@@ -2063,9 +2064,9 @@ function createChatStore() {
|
|
|
2063
2064
|
};
|
|
2064
2065
|
const extraParams = common.deepCopy(config.params?.params || {});
|
|
2065
2066
|
const userInputParams = variablesToObject(conversation.active.userInput || []);
|
|
2066
|
-
Object.assign(extraParams,
|
|
2067
|
+
Object.assign(extraParams, message3 ? {} : { ...references?.params }, params, userInputParams);
|
|
2067
2068
|
sendParams.params = extraParams;
|
|
2068
|
-
if (!
|
|
2069
|
+
if (!message3) {
|
|
2069
2070
|
setContent("");
|
|
2070
2071
|
setContentParams();
|
|
2071
2072
|
setReferences();
|
|
@@ -2266,7 +2267,7 @@ var ConversationFavoritesBtn_default = ({ icon, ...rest }) => {
|
|
|
2266
2267
|
const activeConversation = React10.useMemo(() => {
|
|
2267
2268
|
return conversationsState.list.items.find((item) => item.id === conversationState.active.id);
|
|
2268
2269
|
}, [conversationsState.list.items, conversationState.active.id]);
|
|
2269
|
-
const isFavorite = activeConversation?.isFavorite
|
|
2270
|
+
const isFavorite = activeConversation?.isFavorite;
|
|
2270
2271
|
const handleToggleFavorite = () => {
|
|
2271
2272
|
if (!conversationState.active.id) return;
|
|
2272
2273
|
chatStore.collectConversation(conversationState.active.id, !isFavorite);
|
|
@@ -2289,14 +2290,9 @@ var ConversationShareBtn_default = ({ icon, ...rest }) => {
|
|
|
2289
2290
|
const conversationState = valtio.useSnapshot(chatStore.conversation);
|
|
2290
2291
|
const configState = valtio.useSnapshot(chatStore.config);
|
|
2291
2292
|
const handleShareConversation = async () => {
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
common.copyText(data);
|
|
2296
|
-
antd.message.success("\u5206\u4EAB\u94FE\u63A5\u5DF2\u590D\u5236\u5230\u526A\u8D34\u677F");
|
|
2297
|
-
}
|
|
2298
|
-
} catch (error) {
|
|
2299
|
-
antd.message.error("\u5206\u4EAB\u4F1A\u8BDD\u5931\u8D25");
|
|
2293
|
+
const { data } = await configState.services.request.shareConversation(conversationState.active.id);
|
|
2294
|
+
if (data) {
|
|
2295
|
+
common.copyText(data.url);
|
|
2300
2296
|
}
|
|
2301
2297
|
};
|
|
2302
2298
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2326,6 +2322,7 @@ var styles_module_default2 = {
|
|
|
2326
2322
|
chatHeaderBtnGroup: "styles_module_chatHeaderBtnGroup",
|
|
2327
2323
|
conversationListPanel: "styles_module_conversationListPanel",
|
|
2328
2324
|
createConversationButton: "styles_module_createConversationButton",
|
|
2325
|
+
conversationListContent: "styles_module_conversationListContent",
|
|
2329
2326
|
conversations: "styles_module_conversations",
|
|
2330
2327
|
conversationTabs: "styles_module_conversationTabs",
|
|
2331
2328
|
conversationTabPane: "styles_module_conversationTabPane",
|
|
@@ -2622,9 +2619,9 @@ var ConversationListHeader_default = ({ title = true, avatar = true, newConversa
|
|
|
2622
2619
|
] });
|
|
2623
2620
|
};
|
|
2624
2621
|
var ConversationListPanel = ({ header }) => {
|
|
2625
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames2__default.default("
|
|
2622
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames2__default.default("zero-chat-conversations", styles_module_default2.conversationListPanel), children: [
|
|
2626
2623
|
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: header, DefaultComponent: ConversationListHeader_default }),
|
|
2627
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className:
|
|
2624
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default2.conversationListContent, children: /* @__PURE__ */ jsxRuntime.jsx(ConversationList_default, {}) })
|
|
2628
2625
|
] });
|
|
2629
2626
|
};
|
|
2630
2627
|
var ConversationListPanel_default = ConversationListPanel;
|
|
@@ -3174,12 +3171,12 @@ var DocDrawer_default = ({ title, open, onClose, paramsStr }) => {
|
|
|
3174
3171
|
}, [paramsStr]);
|
|
3175
3172
|
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" }) }) });
|
|
3176
3173
|
};
|
|
3177
|
-
var IndexQuote_default = ({ data, loading, message:
|
|
3174
|
+
var IndexQuote_default = ({ data, loading, message: message3 }) => {
|
|
3178
3175
|
const [open, setOpen] = React10.useState(false);
|
|
3179
3176
|
const citation = React10.useMemo(() => {
|
|
3180
|
-
const citations =
|
|
3177
|
+
const citations = message3.content?.find((item) => item.type === "citation")?.citations ?? [];
|
|
3181
3178
|
return citations?.find((item) => String(item.citationId) === String(data.citationId));
|
|
3182
|
-
}, [data.citationId,
|
|
3179
|
+
}, [data.citationId, message3.content]);
|
|
3183
3180
|
const onClick = () => {
|
|
3184
3181
|
if (!citation?.citationUrl) return;
|
|
3185
3182
|
if (common.isExternal(citation.citationUrl)) {
|
|
@@ -3194,7 +3191,7 @@ var IndexQuote_default = ({ data, loading, message: message4 }) => {
|
|
|
3194
3191
|
open && /* @__PURE__ */ jsxRuntime.jsx(DocDrawer_default, { paramsStr: citation?.citationUrl, title: citation?.citationName, open, onClose: () => setOpen(false) })
|
|
3195
3192
|
] });
|
|
3196
3193
|
};
|
|
3197
|
-
var MarkImg_default = ({ data, loading, message:
|
|
3194
|
+
var MarkImg_default = ({ data, loading, message: message3, ...rest }) => {
|
|
3198
3195
|
const getPreviewFileUrl = (src) => {
|
|
3199
3196
|
return common.buildUrlParams({ [TOKEN_KEY]: tokenManager.get() || "" }, src);
|
|
3200
3197
|
};
|
|
@@ -3221,9 +3218,9 @@ var MdEdit_default = ({ data, loading }) => {
|
|
|
3221
3218
|
!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 }) })
|
|
3222
3219
|
] });
|
|
3223
3220
|
};
|
|
3224
|
-
var PreviewLink_default = ({ data, loading, message:
|
|
3221
|
+
var PreviewLink_default = ({ data, loading, message: message3, ...rest }) => {
|
|
3225
3222
|
const chatStore = useChatStore();
|
|
3226
|
-
const conversationWorkspacePrefix = "/workspace
|
|
3223
|
+
const conversationWorkspacePrefix = "/workspace";
|
|
3227
3224
|
const getLinkFileName = (path) => {
|
|
3228
3225
|
const lastSegment = path.split("/").pop();
|
|
3229
3226
|
if (!lastSegment) {
|
|
@@ -3242,9 +3239,6 @@ var PreviewLink_default = ({ data, loading, message: message4, ...rest }) => {
|
|
|
3242
3239
|
if (path.startsWith(conversationWorkspacePrefix)) {
|
|
3243
3240
|
return path;
|
|
3244
3241
|
}
|
|
3245
|
-
if (path.startsWith(conversationWorkspacePrefix.slice(1))) {
|
|
3246
|
-
return `/${path}`;
|
|
3247
|
-
}
|
|
3248
3242
|
const fileName = getLinkFileName(path);
|
|
3249
3243
|
return `${conversationWorkspacePrefix}${fileName}`;
|
|
3250
3244
|
};
|
|
@@ -3255,7 +3249,7 @@ var PreviewLink_default = ({ data, loading, message: message4, ...rest }) => {
|
|
|
3255
3249
|
chatStore.setPreview({
|
|
3256
3250
|
fileUrl: chatStore.config.services.request.getPreviewUrl({
|
|
3257
3251
|
path: normalizedPath,
|
|
3258
|
-
workspaceId:
|
|
3252
|
+
workspaceId: message3.conversationId
|
|
3259
3253
|
}),
|
|
3260
3254
|
fileName,
|
|
3261
3255
|
suffix
|
|
@@ -3368,7 +3362,7 @@ var adaptMarkdownComponent = (Component, payloadMapRef, messageRef) => {
|
|
|
3368
3362
|
return WrappedComponent;
|
|
3369
3363
|
};
|
|
3370
3364
|
var adaptMarkdownComponents = (components, payloadMapRef, messageRef) => Object.fromEntries(Object.entries(components ?? {}).map(([key, Component]) => [key, adaptMarkdownComponent(Component, payloadMapRef, messageRef)]));
|
|
3371
|
-
var XMarkdown_default = React10.memo(({ message:
|
|
3365
|
+
var XMarkdown_default = React10.memo(({ message: message3, components = {}, content = "", ...rest }) => {
|
|
3372
3366
|
const config = React10.useMemo(() => getMarkdownConfig(), []);
|
|
3373
3367
|
const formattedContent = React10.useMemo(() => formatMixedContent(content), [content]);
|
|
3374
3368
|
const newComponents = React10.useMemo(
|
|
@@ -3394,9 +3388,9 @@ var XMarkdown_default = React10.memo(({ message: message4, components = {}, cont
|
|
|
3394
3388
|
[formattedContent, payloadTagPattern]
|
|
3395
3389
|
);
|
|
3396
3390
|
const payloadMapRef = React10.useRef(payloadMap);
|
|
3397
|
-
const messageRef = React10.useRef(
|
|
3391
|
+
const messageRef = React10.useRef(message3);
|
|
3398
3392
|
payloadMapRef.current = payloadMap;
|
|
3399
|
-
messageRef.current =
|
|
3393
|
+
messageRef.current = message3;
|
|
3400
3394
|
const markdownComponents = React10.useMemo(() => adaptMarkdownComponents(newComponents, payloadMapRef, messageRef), [payloadTagPattern]);
|
|
3401
3395
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3402
3396
|
XMarkdown__default.default,
|
|
@@ -3823,10 +3817,10 @@ function extractDismissedSurfaceIdsFromMessages(messages) {
|
|
|
3823
3817
|
const lastCreateIndexBySurface = /* @__PURE__ */ new Map();
|
|
3824
3818
|
const lastActionIndexBySurface = /* @__PURE__ */ new Map();
|
|
3825
3819
|
for (let messageIndex = 0; messageIndex < messages.length; messageIndex++) {
|
|
3826
|
-
const
|
|
3827
|
-
const items = Array.isArray(
|
|
3820
|
+
const message3 = messages[messageIndex];
|
|
3821
|
+
const items = Array.isArray(message3?.content) ? message3.content : [];
|
|
3828
3822
|
for (const item of items) {
|
|
3829
|
-
if (
|
|
3823
|
+
if (message3?.role !== 1) {
|
|
3830
3824
|
if (item?.type === "a2uiCommand" && item.command) {
|
|
3831
3825
|
const surfaceId = String(item.command?.createSurface?.surfaceId || "").trim();
|
|
3832
3826
|
if (surfaceId) lastCreateIndexBySurface.set(surfaceId, messageIndex);
|
|
@@ -3842,7 +3836,7 @@ function extractDismissedSurfaceIdsFromMessages(messages) {
|
|
|
3842
3836
|
}
|
|
3843
3837
|
}
|
|
3844
3838
|
}
|
|
3845
|
-
if (
|
|
3839
|
+
if (message3?.role === 1 && item?.type === "text") {
|
|
3846
3840
|
const text = item.messageContent || item.text || "";
|
|
3847
3841
|
if (typeof text !== "string" || !text.includes("a2ui_action.v1")) continue;
|
|
3848
3842
|
try {
|
|
@@ -4425,9 +4419,9 @@ function diffConversationMessages(messages, prevCursors) {
|
|
|
4425
4419
|
const nextCursors = [];
|
|
4426
4420
|
const pendingItems = [];
|
|
4427
4421
|
for (let messageIndex = 0; messageIndex < messages.length; messageIndex += 1) {
|
|
4428
|
-
const
|
|
4429
|
-
const messageId = String(
|
|
4430
|
-
const items = Array.isArray(
|
|
4422
|
+
const message3 = messages[messageIndex];
|
|
4423
|
+
const messageId = String(message3?.messageId ?? messageIndex);
|
|
4424
|
+
const items = Array.isArray(message3?.content) ? message3.content : [];
|
|
4431
4425
|
const prevCursor = prevCursors[messageIndex];
|
|
4432
4426
|
const startIndex = prevCursor ? prevCursor.contentLength : 0;
|
|
4433
4427
|
if (prevCursor && (prevCursor.messageId !== messageId || items.length < prevCursor.contentLength)) {
|
|
@@ -4444,9 +4438,9 @@ function scanA2uiTagsFromMessages(messages, processedTagIds) {
|
|
|
4444
4438
|
const newTags = [];
|
|
4445
4439
|
const newTagIds = [];
|
|
4446
4440
|
for (let messageIndex = 0; messageIndex < messages.length; messageIndex += 1) {
|
|
4447
|
-
const
|
|
4448
|
-
const messageId = String(
|
|
4449
|
-
const items = Array.isArray(
|
|
4441
|
+
const message3 = messages[messageIndex];
|
|
4442
|
+
const messageId = String(message3?.messageId ?? messageIndex);
|
|
4443
|
+
const items = Array.isArray(message3?.content) ? message3.content : [];
|
|
4450
4444
|
for (const item of items) {
|
|
4451
4445
|
const text = extractItemTextForA2ui(item);
|
|
4452
4446
|
if (typeof text !== "string" || !text.includes("<A2UI")) continue;
|
|
@@ -4502,9 +4496,9 @@ function reduceA2uiRuntimeMessages(state, messages) {
|
|
|
4502
4496
|
processA2uiCommand(cmd, messageIndex, messageId, nextState, effects, deletedSurfaceIds, nextWizardSteps);
|
|
4503
4497
|
}
|
|
4504
4498
|
});
|
|
4505
|
-
nextState.processedMessageCursors = shouldReplayAll ? messages.map((
|
|
4506
|
-
messageId: String(
|
|
4507
|
-
contentLength: Array.isArray(
|
|
4499
|
+
nextState.processedMessageCursors = shouldReplayAll ? messages.map((message3, messageIndex) => ({
|
|
4500
|
+
messageId: String(message3?.messageId ?? messageIndex),
|
|
4501
|
+
contentLength: Array.isArray(message3?.content) ? message3.content.length : 0
|
|
4508
4502
|
})) : nextCursors;
|
|
4509
4503
|
nextState.wizardStepBySurface = { ...nextState.wizardStepBySurface, ...nextWizardSteps };
|
|
4510
4504
|
if (deletedSurfaceIds.size) {
|
|
@@ -4852,8 +4846,8 @@ function readContextModelPath(context) {
|
|
|
4852
4846
|
function buildLatestCommandIndexBySurface(messages) {
|
|
4853
4847
|
const indexBySurface = {};
|
|
4854
4848
|
let commandIndex = -1;
|
|
4855
|
-
for (const
|
|
4856
|
-
const items = Array.isArray(
|
|
4849
|
+
for (const message3 of messages) {
|
|
4850
|
+
const items = Array.isArray(message3?.content) ? message3.content : [];
|
|
4857
4851
|
for (const item of items) {
|
|
4858
4852
|
if (item?.type === "a2uiCommand" && item.command) {
|
|
4859
4853
|
commandIndex += 1;
|
|
@@ -5041,7 +5035,7 @@ var TextNode2 = React10__namespace.default.memo(
|
|
|
5041
5035
|
item,
|
|
5042
5036
|
role,
|
|
5043
5037
|
customComponents,
|
|
5044
|
-
message:
|
|
5038
|
+
message: message3
|
|
5045
5039
|
}) => {
|
|
5046
5040
|
const content = toA2uiDisplayText(role, item?.messageContent);
|
|
5047
5041
|
const markdownComponents = {
|
|
@@ -5054,7 +5048,7 @@ var TextNode2 = React10__namespace.default.memo(
|
|
|
5054
5048
|
const markdownContent = typeof content === "string" ? transformResourceText(content) : content;
|
|
5055
5049
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5056
5050
|
!!item.reasoningContent && /* @__PURE__ */ jsxRuntime.jsx(xV2.Think, { title: "\u6DF1\u5EA6\u601D\u8003", style: { marginBottom: "16px" }, children: item.reasoningContent }),
|
|
5057
|
-
!!markdownContent && /* @__PURE__ */ jsxRuntime.jsx(XMarkdown_default, { message:
|
|
5051
|
+
!!markdownContent && /* @__PURE__ */ jsxRuntime.jsx(XMarkdown_default, { message: message3, components: markdownComponents, content: markdownContent })
|
|
5058
5052
|
] });
|
|
5059
5053
|
}
|
|
5060
5054
|
);
|
|
@@ -5382,9 +5376,9 @@ var ToolCallItem = ({ item }) => {
|
|
|
5382
5376
|
};
|
|
5383
5377
|
var tool_call_item_default = ToolCallItem;
|
|
5384
5378
|
var RENDERABLE_MESSAGE_TYPES = ["runStarted", "toolCall", "toolResult", "text", "stepError", "runFailed", "files", "plan"];
|
|
5385
|
-
var MessageRender_default = React10__namespace.default.memo(({ role, message:
|
|
5379
|
+
var MessageRender_default = React10__namespace.default.memo(({ role, message: message3, messageIndex = -1, loading, containerRef, customComponents }) => {
|
|
5386
5380
|
const content = React10.useMemo(() => {
|
|
5387
|
-
return (
|
|
5381
|
+
return (message3.content || []).filter((item) => {
|
|
5388
5382
|
if (!RENDERABLE_MESSAGE_TYPES.includes(item.type)) {
|
|
5389
5383
|
return false;
|
|
5390
5384
|
}
|
|
@@ -5397,12 +5391,12 @@ var MessageRender_default = React10__namespace.default.memo(({ role, message: me
|
|
|
5397
5391
|
}
|
|
5398
5392
|
return true;
|
|
5399
5393
|
});
|
|
5400
|
-
}, [
|
|
5394
|
+
}, [message3.content]);
|
|
5401
5395
|
const quoteMsg = React10.useMemo(() => {
|
|
5402
5396
|
const quoteMsg2 = {};
|
|
5403
|
-
if (
|
|
5397
|
+
if (message3.params) {
|
|
5404
5398
|
try {
|
|
5405
|
-
const citation = JSON.parse(
|
|
5399
|
+
const citation = JSON.parse(message3.params).citation;
|
|
5406
5400
|
if (citation) {
|
|
5407
5401
|
quoteMsg2.messageContent = citation;
|
|
5408
5402
|
}
|
|
@@ -5410,7 +5404,7 @@ var MessageRender_default = React10__namespace.default.memo(({ role, message: me
|
|
|
5410
5404
|
}
|
|
5411
5405
|
}
|
|
5412
5406
|
return common.isEmptyObj(quoteMsg2) ? null : quoteMsg2;
|
|
5413
|
-
}, [
|
|
5407
|
+
}, [message3.params, message3.quoteMsg]);
|
|
5414
5408
|
const showPending = loading && (content.length === 0 || content[content.length - 1].type !== "text");
|
|
5415
5409
|
if (content.length === 0 && !showPending) return null;
|
|
5416
5410
|
const lastToolCallIndex = (() => {
|
|
@@ -5434,20 +5428,20 @@ var MessageRender_default = React10__namespace.default.memo(({ role, message: me
|
|
|
5434
5428
|
TextNode2,
|
|
5435
5429
|
{
|
|
5436
5430
|
item,
|
|
5437
|
-
role:
|
|
5431
|
+
role: message3.role,
|
|
5438
5432
|
customComponents,
|
|
5439
|
-
message:
|
|
5433
|
+
message: message3,
|
|
5440
5434
|
messageIndex
|
|
5441
5435
|
},
|
|
5442
5436
|
`message-${index}`
|
|
5443
5437
|
),
|
|
5444
|
-
(item.type === "stepError" || item.type === "runFailed") && (item.errorMessage ? /* @__PURE__ */ jsxRuntime.jsx(XMarkdown_default, { message:
|
|
5438
|
+
(item.type === "stepError" || item.type === "runFailed") && (item.errorMessage ? /* @__PURE__ */ jsxRuntime.jsx(XMarkdown_default, { message: message3, components: customComponents, content: item.errorMessage }) : null),
|
|
5445
5439
|
item.type === "files" && /* @__PURE__ */ jsxRuntime.jsx(FilesNode, { item }, `files-${index}`),
|
|
5446
5440
|
item.type === "plan" && /* @__PURE__ */ jsxRuntime.jsx(A2uiPlanNode, { item }, `plan-${index}`)
|
|
5447
5441
|
] })
|
|
5448
5442
|
}
|
|
5449
5443
|
),
|
|
5450
|
-
index === lastToolCallIndex && messageIndex >= 0 ? /* @__PURE__ */ jsxRuntime.jsx(A2uiMessageCards, { messageIndex, message:
|
|
5444
|
+
index === lastToolCallIndex && messageIndex >= 0 ? /* @__PURE__ */ jsxRuntime.jsx(A2uiMessageCards, { messageIndex, message: message3 }) : null
|
|
5451
5445
|
] }, `message-${index}`)),
|
|
5452
5446
|
showPending && role.user === "agent" && /* @__PURE__ */ jsxRuntime.jsx(xV2.Bubble, { role: role.user, placement: role.placement, content: /* @__PURE__ */ jsxRuntime.jsx(RunStartedNode, {}) }),
|
|
5453
5447
|
quoteMsg && /* @__PURE__ */ jsxRuntime.jsx(QuoteMsgNode, { quoteMsg, role })
|
|
@@ -5543,13 +5537,13 @@ var BubbleListItems_default = ({
|
|
|
5543
5537
|
const messageRefs = React10.useRef({});
|
|
5544
5538
|
const chatRecords = React10.useMemo(() => {
|
|
5545
5539
|
const chatRecords2 = [];
|
|
5546
|
-
conversationMessages.forEach((
|
|
5547
|
-
const role = getRole(
|
|
5540
|
+
conversationMessages.forEach((message3, messageIndex) => {
|
|
5541
|
+
const role = getRole(message3.role);
|
|
5548
5542
|
const isLeftBubble = role.user === "agent";
|
|
5549
|
-
const isMessageLoading = !!
|
|
5550
|
-
const baseKey = `${
|
|
5543
|
+
const isMessageLoading = !!message3.generating;
|
|
5544
|
+
const baseKey = `${message3.executionId}-${messageIndex}`;
|
|
5551
5545
|
const footerNode = !isMessageLoading ? /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { align: "center", gap: 8, children: [
|
|
5552
|
-
|
|
5546
|
+
message3.stopFlag && isLeftBubble && /* @__PURE__ */ jsxRuntime.jsx(Text3, { type: "secondary", style: { flex: "none" }, children: "\u5DF2\u505C\u6B62" }),
|
|
5553
5547
|
/* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { align: "center", gap: 4, children: role.user === "agent" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5554
5548
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5555
5549
|
antd.Button,
|
|
@@ -5569,21 +5563,21 @@ var BubbleListItems_default = ({
|
|
|
5569
5563
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5570
5564
|
antd.Button,
|
|
5571
5565
|
{
|
|
5572
|
-
color:
|
|
5566
|
+
color: message3.feedback === 1 ? "primary" : "default",
|
|
5573
5567
|
size: "small",
|
|
5574
5568
|
variant: "text",
|
|
5575
5569
|
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.LikeOutlined, {}),
|
|
5576
|
-
onClick: () => chatStore.feedback(
|
|
5570
|
+
onClick: () => chatStore.feedback(message3.executionId, 1, messageIndex)
|
|
5577
5571
|
}
|
|
5578
5572
|
),
|
|
5579
5573
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5580
5574
|
antd.Button,
|
|
5581
5575
|
{
|
|
5582
|
-
color:
|
|
5576
|
+
color: message3.feedback === 2 ? "primary" : "default",
|
|
5583
5577
|
size: "small",
|
|
5584
5578
|
variant: "text",
|
|
5585
5579
|
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.DislikeOutlined, {}),
|
|
5586
|
-
onClick: () => chatStore.feedback(
|
|
5580
|
+
onClick: () => chatStore.feedback(message3.executionId, 2, messageIndex)
|
|
5587
5581
|
}
|
|
5588
5582
|
),
|
|
5589
5583
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -5591,7 +5585,7 @@ var BubbleListItems_default = ({
|
|
|
5591
5585
|
{
|
|
5592
5586
|
control: agentActions,
|
|
5593
5587
|
ctx: {
|
|
5594
|
-
message:
|
|
5588
|
+
message: message3,
|
|
5595
5589
|
get dom() {
|
|
5596
5590
|
return messageRefs.current[baseKey];
|
|
5597
5591
|
}
|
|
@@ -5609,7 +5603,7 @@ var BubbleListItems_default = ({
|
|
|
5609
5603
|
MessageRender_default,
|
|
5610
5604
|
{
|
|
5611
5605
|
role,
|
|
5612
|
-
message:
|
|
5606
|
+
message: message3,
|
|
5613
5607
|
messageIndex,
|
|
5614
5608
|
customComponents,
|
|
5615
5609
|
loading: isMessageLoading,
|
|
@@ -6085,7 +6079,8 @@ var ChatSender_default2 = React10.forwardRef(
|
|
|
6085
6079
|
skillsBtn = false,
|
|
6086
6080
|
knowledgeBtn = false,
|
|
6087
6081
|
modelSelect = false,
|
|
6088
|
-
commandConfig
|
|
6082
|
+
commandConfig,
|
|
6083
|
+
uploadConfig
|
|
6089
6084
|
}, ref) => {
|
|
6090
6085
|
const chatStore = useChatStore();
|
|
6091
6086
|
const configState = valtio.useSnapshot(chatStore.config);
|
|
@@ -6132,7 +6127,7 @@ var ChatSender_default2 = React10.forwardRef(
|
|
|
6132
6127
|
onFocus: chatStore.config.hooks?.onSenderFocus,
|
|
6133
6128
|
fileUpload: {
|
|
6134
6129
|
request: fileUploadRequest,
|
|
6135
|
-
config: agentState.agentInfo.config?.options?.fileUpload
|
|
6130
|
+
config: uploadConfig || agentState.agentInfo.config?.options?.fileUpload
|
|
6136
6131
|
},
|
|
6137
6132
|
sendBtnProps: common.isFunction(sendBtnProps) ? sendBtnProps() : {},
|
|
6138
6133
|
extraFooterBelow: /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: footerBelow }),
|
|
@@ -6682,13 +6677,13 @@ var layouts_default = React10.forwardRef(({ theme: theme5, params, hooks, layout
|
|
|
6682
6677
|
}, [hasPreView]);
|
|
6683
6678
|
common.useWebSocket({
|
|
6684
6679
|
url: configState.services.websocketUrls?.[0],
|
|
6685
|
-
onMessage: (
|
|
6680
|
+
onMessage: (message3) => chatStore.acceptMessage(message3.payload),
|
|
6686
6681
|
clientHeartbeat: false,
|
|
6687
6682
|
reconnectInterval: 1e4
|
|
6688
6683
|
});
|
|
6689
6684
|
common.useWebSocket({
|
|
6690
6685
|
url: configState.services.websocketUrls?.[1],
|
|
6691
|
-
onMessage: (
|
|
6686
|
+
onMessage: (message3) => chatStore.acceptMessage(message3.payload),
|
|
6692
6687
|
clientHeartbeat: false,
|
|
6693
6688
|
reconnectInterval: 1e4
|
|
6694
6689
|
});
|