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