@zero-library/chat-copilot 3.1.17 → 3.1.19
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 +67 -74
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +3 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +8 -3
- package/dist/index.d.ts +8 -3
- package/dist/index.esm.js +67 -74
- 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)) || "";
|
|
@@ -159,10 +159,11 @@ var Attachments_default = React10.forwardRef(({ fileUpload, fileUploadConfig, fi
|
|
|
159
159
|
const { data } = await fileUpload(formData, abortController.signal);
|
|
160
160
|
const uploadedFile = data[0];
|
|
161
161
|
let previewUrl = uploadedFile.id;
|
|
162
|
-
if (uploadedFile.
|
|
162
|
+
if (uploadedFile.workspaceId && uploadedFile.path) {
|
|
163
163
|
previewUrl = chatStore.config.services.request.getPreviewUrl({
|
|
164
164
|
path: uploadedFile.path,
|
|
165
|
-
workspaceId: uploadedFile.
|
|
165
|
+
workspaceId: uploadedFile.workspaceId,
|
|
166
|
+
workspaceType: uploadedFile.workspaceType
|
|
166
167
|
});
|
|
167
168
|
}
|
|
168
169
|
setAttachedFiles(
|
|
@@ -1046,7 +1047,7 @@ var createChatService = (request, config) => {
|
|
|
1046
1047
|
return request.put("/agents/conversations/favorite", { conversationIds: [conversationId], favorite: isFavorite });
|
|
1047
1048
|
};
|
|
1048
1049
|
const shareConversation = (conversationId) => {
|
|
1049
|
-
return request.
|
|
1050
|
+
return request.post(`/agents/conversations/${conversationId}/share/url`);
|
|
1050
1051
|
};
|
|
1051
1052
|
return {
|
|
1052
1053
|
fetchModelList,
|
|
@@ -1646,7 +1647,7 @@ function createChatStore() {
|
|
|
1646
1647
|
}
|
|
1647
1648
|
if (isMain) config.hooks?.onStepMessage?.(msg);
|
|
1648
1649
|
}
|
|
1649
|
-
function doneCallback(msg,
|
|
1650
|
+
function doneCallback(msg, message3, isMain) {
|
|
1650
1651
|
conversation.messages[msg.conversationId].loading = false;
|
|
1651
1652
|
const messages = conversation.messages[msg.conversationId]?.message;
|
|
1652
1653
|
if (messages) {
|
|
@@ -1939,9 +1940,9 @@ function createChatStore() {
|
|
|
1939
1940
|
}
|
|
1940
1941
|
}
|
|
1941
1942
|
}
|
|
1942
|
-
function processMessageContent(
|
|
1943
|
+
function processMessageContent(message3, targetMessages) {
|
|
1943
1944
|
const newMessage = {
|
|
1944
|
-
...
|
|
1945
|
+
...message3,
|
|
1945
1946
|
agentId: agent.agentInfo.id
|
|
1946
1947
|
};
|
|
1947
1948
|
const isMain = !targetMessages;
|
|
@@ -2009,13 +2010,13 @@ function createChatStore() {
|
|
|
2009
2010
|
}
|
|
2010
2011
|
processMessageContent(newMessage);
|
|
2011
2012
|
};
|
|
2012
|
-
const sendMessage = async (
|
|
2013
|
+
const sendMessage = async (message3, msgFiles = [], params) => {
|
|
2013
2014
|
const conversationId = conversation.active.id;
|
|
2014
2015
|
if (conversation.messages[conversationId].loading) return;
|
|
2015
2016
|
let msgContent = "", files;
|
|
2016
2017
|
const references = conversation.messages[conversationId].references;
|
|
2017
|
-
if (
|
|
2018
|
-
msgContent =
|
|
2018
|
+
if (message3) {
|
|
2019
|
+
msgContent = message3;
|
|
2019
2020
|
files = [...msgFiles, ...conversation.messages[conversationId].files || []];
|
|
2020
2021
|
} else {
|
|
2021
2022
|
if (references?.type === 1 && references?.content?.msgContent) {
|
|
@@ -2062,9 +2063,9 @@ function createChatStore() {
|
|
|
2062
2063
|
};
|
|
2063
2064
|
const extraParams = common.deepCopy(config.params?.params || {});
|
|
2064
2065
|
const userInputParams = variablesToObject(conversation.active.userInput || []);
|
|
2065
|
-
Object.assign(extraParams,
|
|
2066
|
+
Object.assign(extraParams, message3 ? {} : { ...references?.params }, params, userInputParams);
|
|
2066
2067
|
sendParams.params = extraParams;
|
|
2067
|
-
if (!
|
|
2068
|
+
if (!message3) {
|
|
2068
2069
|
setContent("");
|
|
2069
2070
|
setContentParams();
|
|
2070
2071
|
setReferences();
|
|
@@ -2288,14 +2289,9 @@ var ConversationShareBtn_default = ({ icon, ...rest }) => {
|
|
|
2288
2289
|
const conversationState = valtio.useSnapshot(chatStore.conversation);
|
|
2289
2290
|
const configState = valtio.useSnapshot(chatStore.config);
|
|
2290
2291
|
const handleShareConversation = async () => {
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
common.copyText(data);
|
|
2295
|
-
antd.message.success("\u5206\u4EAB\u94FE\u63A5\u5DF2\u590D\u5236\u5230\u526A\u8D34\u677F");
|
|
2296
|
-
}
|
|
2297
|
-
} catch (error) {
|
|
2298
|
-
antd.message.error("\u5206\u4EAB\u4F1A\u8BDD\u5931\u8D25");
|
|
2292
|
+
const { data } = await configState.services.request.shareConversation(conversationState.active.id);
|
|
2293
|
+
if (data) {
|
|
2294
|
+
common.copyText(data.url);
|
|
2299
2295
|
}
|
|
2300
2296
|
};
|
|
2301
2297
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3173,12 +3169,12 @@ var DocDrawer_default = ({ title, open, onClose, paramsStr }) => {
|
|
|
3173
3169
|
}, [paramsStr]);
|
|
3174
3170
|
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" }) }) });
|
|
3175
3171
|
};
|
|
3176
|
-
var IndexQuote_default = ({ data, loading, message:
|
|
3172
|
+
var IndexQuote_default = ({ data, loading, message: message3 }) => {
|
|
3177
3173
|
const [open, setOpen] = React10.useState(false);
|
|
3178
3174
|
const citation = React10.useMemo(() => {
|
|
3179
|
-
const citations =
|
|
3175
|
+
const citations = message3.content?.find((item) => item.type === "citation")?.citations ?? [];
|
|
3180
3176
|
return citations?.find((item) => String(item.citationId) === String(data.citationId));
|
|
3181
|
-
}, [data.citationId,
|
|
3177
|
+
}, [data.citationId, message3.content]);
|
|
3182
3178
|
const onClick = () => {
|
|
3183
3179
|
if (!citation?.citationUrl) return;
|
|
3184
3180
|
if (common.isExternal(citation.citationUrl)) {
|
|
@@ -3193,7 +3189,7 @@ var IndexQuote_default = ({ data, loading, message: message4 }) => {
|
|
|
3193
3189
|
open && /* @__PURE__ */ jsxRuntime.jsx(DocDrawer_default, { paramsStr: citation?.citationUrl, title: citation?.citationName, open, onClose: () => setOpen(false) })
|
|
3194
3190
|
] });
|
|
3195
3191
|
};
|
|
3196
|
-
var MarkImg_default = ({ data, loading, message:
|
|
3192
|
+
var MarkImg_default = ({ data, loading, message: message3, ...rest }) => {
|
|
3197
3193
|
const getPreviewFileUrl = (src) => {
|
|
3198
3194
|
return common.buildUrlParams({ [TOKEN_KEY]: tokenManager.get() || "" }, src);
|
|
3199
3195
|
};
|
|
@@ -3220,9 +3216,9 @@ var MdEdit_default = ({ data, loading }) => {
|
|
|
3220
3216
|
!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 }) })
|
|
3221
3217
|
] });
|
|
3222
3218
|
};
|
|
3223
|
-
var PreviewLink_default = ({ data, loading, message:
|
|
3219
|
+
var PreviewLink_default = ({ data, loading, message: message3, ...rest }) => {
|
|
3224
3220
|
const chatStore = useChatStore();
|
|
3225
|
-
const conversationWorkspacePrefix = "/workspace
|
|
3221
|
+
const conversationWorkspacePrefix = "/workspace";
|
|
3226
3222
|
const getLinkFileName = (path) => {
|
|
3227
3223
|
const lastSegment = path.split("/").pop();
|
|
3228
3224
|
if (!lastSegment) {
|
|
@@ -3241,9 +3237,6 @@ var PreviewLink_default = ({ data, loading, message: message4, ...rest }) => {
|
|
|
3241
3237
|
if (path.startsWith(conversationWorkspacePrefix)) {
|
|
3242
3238
|
return path;
|
|
3243
3239
|
}
|
|
3244
|
-
if (path.startsWith(conversationWorkspacePrefix.slice(1))) {
|
|
3245
|
-
return `/${path}`;
|
|
3246
|
-
}
|
|
3247
3240
|
const fileName = getLinkFileName(path);
|
|
3248
3241
|
return `${conversationWorkspacePrefix}${fileName}`;
|
|
3249
3242
|
};
|
|
@@ -3254,7 +3247,7 @@ var PreviewLink_default = ({ data, loading, message: message4, ...rest }) => {
|
|
|
3254
3247
|
chatStore.setPreview({
|
|
3255
3248
|
fileUrl: chatStore.config.services.request.getPreviewUrl({
|
|
3256
3249
|
path: normalizedPath,
|
|
3257
|
-
workspaceId:
|
|
3250
|
+
workspaceId: message3.conversationId
|
|
3258
3251
|
}),
|
|
3259
3252
|
fileName,
|
|
3260
3253
|
suffix
|
|
@@ -3367,7 +3360,7 @@ var adaptMarkdownComponent = (Component, payloadMapRef, messageRef) => {
|
|
|
3367
3360
|
return WrappedComponent;
|
|
3368
3361
|
};
|
|
3369
3362
|
var adaptMarkdownComponents = (components, payloadMapRef, messageRef) => Object.fromEntries(Object.entries(components ?? {}).map(([key, Component]) => [key, adaptMarkdownComponent(Component, payloadMapRef, messageRef)]));
|
|
3370
|
-
var XMarkdown_default = React10.memo(({ message:
|
|
3363
|
+
var XMarkdown_default = React10.memo(({ message: message3, components = {}, content = "", ...rest }) => {
|
|
3371
3364
|
const config = React10.useMemo(() => getMarkdownConfig(), []);
|
|
3372
3365
|
const formattedContent = React10.useMemo(() => formatMixedContent(content), [content]);
|
|
3373
3366
|
const newComponents = React10.useMemo(
|
|
@@ -3393,9 +3386,9 @@ var XMarkdown_default = React10.memo(({ message: message4, components = {}, cont
|
|
|
3393
3386
|
[formattedContent, payloadTagPattern]
|
|
3394
3387
|
);
|
|
3395
3388
|
const payloadMapRef = React10.useRef(payloadMap);
|
|
3396
|
-
const messageRef = React10.useRef(
|
|
3389
|
+
const messageRef = React10.useRef(message3);
|
|
3397
3390
|
payloadMapRef.current = payloadMap;
|
|
3398
|
-
messageRef.current =
|
|
3391
|
+
messageRef.current = message3;
|
|
3399
3392
|
const markdownComponents = React10.useMemo(() => adaptMarkdownComponents(newComponents, payloadMapRef, messageRef), [payloadTagPattern]);
|
|
3400
3393
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3401
3394
|
XMarkdown__default.default,
|
|
@@ -3822,10 +3815,10 @@ function extractDismissedSurfaceIdsFromMessages(messages) {
|
|
|
3822
3815
|
const lastCreateIndexBySurface = /* @__PURE__ */ new Map();
|
|
3823
3816
|
const lastActionIndexBySurface = /* @__PURE__ */ new Map();
|
|
3824
3817
|
for (let messageIndex = 0; messageIndex < messages.length; messageIndex++) {
|
|
3825
|
-
const
|
|
3826
|
-
const items = Array.isArray(
|
|
3818
|
+
const message3 = messages[messageIndex];
|
|
3819
|
+
const items = Array.isArray(message3?.content) ? message3.content : [];
|
|
3827
3820
|
for (const item of items) {
|
|
3828
|
-
if (
|
|
3821
|
+
if (message3?.role !== 1) {
|
|
3829
3822
|
if (item?.type === "a2uiCommand" && item.command) {
|
|
3830
3823
|
const surfaceId = String(item.command?.createSurface?.surfaceId || "").trim();
|
|
3831
3824
|
if (surfaceId) lastCreateIndexBySurface.set(surfaceId, messageIndex);
|
|
@@ -3841,7 +3834,7 @@ function extractDismissedSurfaceIdsFromMessages(messages) {
|
|
|
3841
3834
|
}
|
|
3842
3835
|
}
|
|
3843
3836
|
}
|
|
3844
|
-
if (
|
|
3837
|
+
if (message3?.role === 1 && item?.type === "text") {
|
|
3845
3838
|
const text = item.messageContent || item.text || "";
|
|
3846
3839
|
if (typeof text !== "string" || !text.includes("a2ui_action.v1")) continue;
|
|
3847
3840
|
try {
|
|
@@ -4424,9 +4417,9 @@ function diffConversationMessages(messages, prevCursors) {
|
|
|
4424
4417
|
const nextCursors = [];
|
|
4425
4418
|
const pendingItems = [];
|
|
4426
4419
|
for (let messageIndex = 0; messageIndex < messages.length; messageIndex += 1) {
|
|
4427
|
-
const
|
|
4428
|
-
const messageId = String(
|
|
4429
|
-
const items = Array.isArray(
|
|
4420
|
+
const message3 = messages[messageIndex];
|
|
4421
|
+
const messageId = String(message3?.messageId ?? messageIndex);
|
|
4422
|
+
const items = Array.isArray(message3?.content) ? message3.content : [];
|
|
4430
4423
|
const prevCursor = prevCursors[messageIndex];
|
|
4431
4424
|
const startIndex = prevCursor ? prevCursor.contentLength : 0;
|
|
4432
4425
|
if (prevCursor && (prevCursor.messageId !== messageId || items.length < prevCursor.contentLength)) {
|
|
@@ -4443,9 +4436,9 @@ function scanA2uiTagsFromMessages(messages, processedTagIds) {
|
|
|
4443
4436
|
const newTags = [];
|
|
4444
4437
|
const newTagIds = [];
|
|
4445
4438
|
for (let messageIndex = 0; messageIndex < messages.length; messageIndex += 1) {
|
|
4446
|
-
const
|
|
4447
|
-
const messageId = String(
|
|
4448
|
-
const items = Array.isArray(
|
|
4439
|
+
const message3 = messages[messageIndex];
|
|
4440
|
+
const messageId = String(message3?.messageId ?? messageIndex);
|
|
4441
|
+
const items = Array.isArray(message3?.content) ? message3.content : [];
|
|
4449
4442
|
for (const item of items) {
|
|
4450
4443
|
const text = extractItemTextForA2ui(item);
|
|
4451
4444
|
if (typeof text !== "string" || !text.includes("<A2UI")) continue;
|
|
@@ -4501,9 +4494,9 @@ function reduceA2uiRuntimeMessages(state, messages) {
|
|
|
4501
4494
|
processA2uiCommand(cmd, messageIndex, messageId, nextState, effects, deletedSurfaceIds, nextWizardSteps);
|
|
4502
4495
|
}
|
|
4503
4496
|
});
|
|
4504
|
-
nextState.processedMessageCursors = shouldReplayAll ? messages.map((
|
|
4505
|
-
messageId: String(
|
|
4506
|
-
contentLength: Array.isArray(
|
|
4497
|
+
nextState.processedMessageCursors = shouldReplayAll ? messages.map((message3, messageIndex) => ({
|
|
4498
|
+
messageId: String(message3?.messageId ?? messageIndex),
|
|
4499
|
+
contentLength: Array.isArray(message3?.content) ? message3.content.length : 0
|
|
4507
4500
|
})) : nextCursors;
|
|
4508
4501
|
nextState.wizardStepBySurface = { ...nextState.wizardStepBySurface, ...nextWizardSteps };
|
|
4509
4502
|
if (deletedSurfaceIds.size) {
|
|
@@ -4851,8 +4844,8 @@ function readContextModelPath(context) {
|
|
|
4851
4844
|
function buildLatestCommandIndexBySurface(messages) {
|
|
4852
4845
|
const indexBySurface = {};
|
|
4853
4846
|
let commandIndex = -1;
|
|
4854
|
-
for (const
|
|
4855
|
-
const items = Array.isArray(
|
|
4847
|
+
for (const message3 of messages) {
|
|
4848
|
+
const items = Array.isArray(message3?.content) ? message3.content : [];
|
|
4856
4849
|
for (const item of items) {
|
|
4857
4850
|
if (item?.type === "a2uiCommand" && item.command) {
|
|
4858
4851
|
commandIndex += 1;
|
|
@@ -5040,7 +5033,7 @@ var TextNode2 = React10__namespace.default.memo(
|
|
|
5040
5033
|
item,
|
|
5041
5034
|
role,
|
|
5042
5035
|
customComponents,
|
|
5043
|
-
message:
|
|
5036
|
+
message: message3
|
|
5044
5037
|
}) => {
|
|
5045
5038
|
const content = toA2uiDisplayText(role, item?.messageContent);
|
|
5046
5039
|
const markdownComponents = {
|
|
@@ -5053,7 +5046,7 @@ var TextNode2 = React10__namespace.default.memo(
|
|
|
5053
5046
|
const markdownContent = typeof content === "string" ? transformResourceText(content) : content;
|
|
5054
5047
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5055
5048
|
!!item.reasoningContent && /* @__PURE__ */ jsxRuntime.jsx(xV2.Think, { title: "\u6DF1\u5EA6\u601D\u8003", style: { marginBottom: "16px" }, children: item.reasoningContent }),
|
|
5056
|
-
!!markdownContent && /* @__PURE__ */ jsxRuntime.jsx(XMarkdown_default, { message:
|
|
5049
|
+
!!markdownContent && /* @__PURE__ */ jsxRuntime.jsx(XMarkdown_default, { message: message3, components: markdownComponents, content: markdownContent })
|
|
5057
5050
|
] });
|
|
5058
5051
|
}
|
|
5059
5052
|
);
|
|
@@ -5381,9 +5374,9 @@ var ToolCallItem = ({ item }) => {
|
|
|
5381
5374
|
};
|
|
5382
5375
|
var tool_call_item_default = ToolCallItem;
|
|
5383
5376
|
var RENDERABLE_MESSAGE_TYPES = ["runStarted", "toolCall", "toolResult", "text", "stepError", "runFailed", "files", "plan"];
|
|
5384
|
-
var MessageRender_default = React10__namespace.default.memo(({ role, message:
|
|
5377
|
+
var MessageRender_default = React10__namespace.default.memo(({ role, message: message3, messageIndex = -1, loading, containerRef, customComponents }) => {
|
|
5385
5378
|
const content = React10.useMemo(() => {
|
|
5386
|
-
return (
|
|
5379
|
+
return (message3.content || []).filter((item) => {
|
|
5387
5380
|
if (!RENDERABLE_MESSAGE_TYPES.includes(item.type)) {
|
|
5388
5381
|
return false;
|
|
5389
5382
|
}
|
|
@@ -5396,12 +5389,12 @@ var MessageRender_default = React10__namespace.default.memo(({ role, message: me
|
|
|
5396
5389
|
}
|
|
5397
5390
|
return true;
|
|
5398
5391
|
});
|
|
5399
|
-
}, [
|
|
5392
|
+
}, [message3.content]);
|
|
5400
5393
|
const quoteMsg = React10.useMemo(() => {
|
|
5401
5394
|
const quoteMsg2 = {};
|
|
5402
|
-
if (
|
|
5395
|
+
if (message3.params) {
|
|
5403
5396
|
try {
|
|
5404
|
-
const citation = JSON.parse(
|
|
5397
|
+
const citation = JSON.parse(message3.params).citation;
|
|
5405
5398
|
if (citation) {
|
|
5406
5399
|
quoteMsg2.messageContent = citation;
|
|
5407
5400
|
}
|
|
@@ -5409,7 +5402,7 @@ var MessageRender_default = React10__namespace.default.memo(({ role, message: me
|
|
|
5409
5402
|
}
|
|
5410
5403
|
}
|
|
5411
5404
|
return common.isEmptyObj(quoteMsg2) ? null : quoteMsg2;
|
|
5412
|
-
}, [
|
|
5405
|
+
}, [message3.params, message3.quoteMsg]);
|
|
5413
5406
|
const showPending = loading && (content.length === 0 || content[content.length - 1].type !== "text");
|
|
5414
5407
|
if (content.length === 0 && !showPending) return null;
|
|
5415
5408
|
const lastToolCallIndex = (() => {
|
|
@@ -5433,20 +5426,20 @@ var MessageRender_default = React10__namespace.default.memo(({ role, message: me
|
|
|
5433
5426
|
TextNode2,
|
|
5434
5427
|
{
|
|
5435
5428
|
item,
|
|
5436
|
-
role:
|
|
5429
|
+
role: message3.role,
|
|
5437
5430
|
customComponents,
|
|
5438
|
-
message:
|
|
5431
|
+
message: message3,
|
|
5439
5432
|
messageIndex
|
|
5440
5433
|
},
|
|
5441
5434
|
`message-${index}`
|
|
5442
5435
|
),
|
|
5443
|
-
(item.type === "stepError" || item.type === "runFailed") && (item.errorMessage ? /* @__PURE__ */ jsxRuntime.jsx(XMarkdown_default, { message:
|
|
5436
|
+
(item.type === "stepError" || item.type === "runFailed") && (item.errorMessage ? /* @__PURE__ */ jsxRuntime.jsx(XMarkdown_default, { message: message3, components: customComponents, content: item.errorMessage }) : null),
|
|
5444
5437
|
item.type === "files" && /* @__PURE__ */ jsxRuntime.jsx(FilesNode, { item }, `files-${index}`),
|
|
5445
5438
|
item.type === "plan" && /* @__PURE__ */ jsxRuntime.jsx(A2uiPlanNode, { item }, `plan-${index}`)
|
|
5446
5439
|
] })
|
|
5447
5440
|
}
|
|
5448
5441
|
),
|
|
5449
|
-
index === lastToolCallIndex && messageIndex >= 0 ? /* @__PURE__ */ jsxRuntime.jsx(A2uiMessageCards, { messageIndex, message:
|
|
5442
|
+
index === lastToolCallIndex && messageIndex >= 0 ? /* @__PURE__ */ jsxRuntime.jsx(A2uiMessageCards, { messageIndex, message: message3 }) : null
|
|
5450
5443
|
] }, `message-${index}`)),
|
|
5451
5444
|
showPending && role.user === "agent" && /* @__PURE__ */ jsxRuntime.jsx(xV2.Bubble, { role: role.user, placement: role.placement, content: /* @__PURE__ */ jsxRuntime.jsx(RunStartedNode, {}) }),
|
|
5452
5445
|
quoteMsg && /* @__PURE__ */ jsxRuntime.jsx(QuoteMsgNode, { quoteMsg, role })
|
|
@@ -5542,13 +5535,13 @@ var BubbleListItems_default = ({
|
|
|
5542
5535
|
const messageRefs = React10.useRef({});
|
|
5543
5536
|
const chatRecords = React10.useMemo(() => {
|
|
5544
5537
|
const chatRecords2 = [];
|
|
5545
|
-
conversationMessages.forEach((
|
|
5546
|
-
const role = getRole(
|
|
5538
|
+
conversationMessages.forEach((message3, messageIndex) => {
|
|
5539
|
+
const role = getRole(message3.role);
|
|
5547
5540
|
const isLeftBubble = role.user === "agent";
|
|
5548
|
-
const isMessageLoading = !!
|
|
5549
|
-
const baseKey = `${
|
|
5541
|
+
const isMessageLoading = !!message3.generating;
|
|
5542
|
+
const baseKey = `${message3.executionId}-${messageIndex}`;
|
|
5550
5543
|
const footerNode = !isMessageLoading ? /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { align: "center", gap: 8, children: [
|
|
5551
|
-
|
|
5544
|
+
message3.stopFlag && isLeftBubble && /* @__PURE__ */ jsxRuntime.jsx(Text3, { type: "secondary", style: { flex: "none" }, children: "\u5DF2\u505C\u6B62" }),
|
|
5552
5545
|
/* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { align: "center", gap: 4, children: role.user === "agent" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5553
5546
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5554
5547
|
antd.Button,
|
|
@@ -5568,21 +5561,21 @@ var BubbleListItems_default = ({
|
|
|
5568
5561
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5569
5562
|
antd.Button,
|
|
5570
5563
|
{
|
|
5571
|
-
color:
|
|
5564
|
+
color: message3.feedback === 1 ? "primary" : "default",
|
|
5572
5565
|
size: "small",
|
|
5573
5566
|
variant: "text",
|
|
5574
5567
|
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.LikeOutlined, {}),
|
|
5575
|
-
onClick: () => chatStore.feedback(
|
|
5568
|
+
onClick: () => chatStore.feedback(message3.executionId, 1, messageIndex)
|
|
5576
5569
|
}
|
|
5577
5570
|
),
|
|
5578
5571
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5579
5572
|
antd.Button,
|
|
5580
5573
|
{
|
|
5581
|
-
color:
|
|
5574
|
+
color: message3.feedback === 2 ? "primary" : "default",
|
|
5582
5575
|
size: "small",
|
|
5583
5576
|
variant: "text",
|
|
5584
5577
|
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.DislikeOutlined, {}),
|
|
5585
|
-
onClick: () => chatStore.feedback(
|
|
5578
|
+
onClick: () => chatStore.feedback(message3.executionId, 2, messageIndex)
|
|
5586
5579
|
}
|
|
5587
5580
|
),
|
|
5588
5581
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -5590,7 +5583,7 @@ var BubbleListItems_default = ({
|
|
|
5590
5583
|
{
|
|
5591
5584
|
control: agentActions,
|
|
5592
5585
|
ctx: {
|
|
5593
|
-
message:
|
|
5586
|
+
message: message3,
|
|
5594
5587
|
get dom() {
|
|
5595
5588
|
return messageRefs.current[baseKey];
|
|
5596
5589
|
}
|
|
@@ -5608,7 +5601,7 @@ var BubbleListItems_default = ({
|
|
|
5608
5601
|
MessageRender_default,
|
|
5609
5602
|
{
|
|
5610
5603
|
role,
|
|
5611
|
-
message:
|
|
5604
|
+
message: message3,
|
|
5612
5605
|
messageIndex,
|
|
5613
5606
|
customComponents,
|
|
5614
5607
|
loading: isMessageLoading,
|
|
@@ -6681,13 +6674,13 @@ var layouts_default = React10.forwardRef(({ theme: theme5, params, hooks, layout
|
|
|
6681
6674
|
}, [hasPreView]);
|
|
6682
6675
|
common.useWebSocket({
|
|
6683
6676
|
url: configState.services.websocketUrls?.[0],
|
|
6684
|
-
onMessage: (
|
|
6677
|
+
onMessage: (message3) => chatStore.acceptMessage(message3.payload),
|
|
6685
6678
|
clientHeartbeat: false,
|
|
6686
6679
|
reconnectInterval: 1e4
|
|
6687
6680
|
});
|
|
6688
6681
|
common.useWebSocket({
|
|
6689
6682
|
url: configState.services.websocketUrls?.[1],
|
|
6690
|
-
onMessage: (
|
|
6683
|
+
onMessage: (message3) => chatStore.acceptMessage(message3.payload),
|
|
6691
6684
|
clientHeartbeat: false,
|
|
6692
6685
|
reconnectInterval: 1e4
|
|
6693
6686
|
});
|