@zero-library/chat-agent 2.1.12 → 2.1.14
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/README.md +1 -3
- package/dist/index.cjs.js +87 -95
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +29 -33
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +82 -27
- package/dist/index.d.ts +82 -27
- package/dist/index.esm.js +87 -95
- package/dist/index.esm.js.map +1 -1
- package/package.json +6 -3
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useRefState, useDebounce, useSyncInput, RenderWrapper, shouldRender, isFunction, useDeepEffect, useWebSocket, getWebSocketUrl, getToken, isLocalhost, downloadFile, FilePreview, MarkdownEditor, useCreateValtioContext, isNumber, getFileSuffixName, isObject, isNullOrUnDef, isBoolean, UserAvatar, deepCopy, getCurrentUser, deepMerge, createRequest, RenderMarkdown, copyText, FileIcon, isExternal } from '@zero-library/common';
|
|
2
|
-
import { App, Badge, Button, Flex, Typography, Spin, Splitter, Tag, Popover, List, Avatar, Space, message, Empty,
|
|
2
|
+
import { App, Badge, Button, Flex, Typography, Spin, Splitter, Tag, Popover, List, Avatar, Space, message, Empty, Modal, Row, Col, Collapse, Drawer } from 'antd';
|
|
3
3
|
import dayjs from 'dayjs';
|
|
4
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
5
|
import { forwardRef, useRef, useEffect, useImperativeHandle, useMemo, useState } from 'react';
|
|
@@ -7,7 +7,7 @@ import { useSnapshot, proxy } from 'valtio';
|
|
|
7
7
|
import { CloudUploadOutlined, PaperClipOutlined, EnterOutlined, UserSwitchOutlined, CloseOutlined, PlusOutlined, CommentOutlined, OpenAIOutlined, CopyOutlined, LikeOutlined, DislikeOutlined, DeleteOutlined, RedoOutlined, PlayCircleOutlined, CaretRightOutlined } from '@ant-design/icons';
|
|
8
8
|
import { Attachments, Sender, Suggestion, XProvider, Welcome, Prompts, Bubble, Conversations } from '@ant-design/x';
|
|
9
9
|
export * from '@ant-design/x';
|
|
10
|
-
import
|
|
10
|
+
import classNames8 from 'classnames';
|
|
11
11
|
import InfiniteScroll from 'react-infinite-scroll-component';
|
|
12
12
|
|
|
13
13
|
var __defProp = Object.defineProperty;
|
|
@@ -36,7 +36,7 @@ function transform(source, fieldMap) {
|
|
|
36
36
|
function transforms(sources, fieldMap) {
|
|
37
37
|
return sources?.map((source) => transform(source, fieldMap)) || [];
|
|
38
38
|
}
|
|
39
|
-
var copy, classifyTime;
|
|
39
|
+
var copy, classifyTime, replaceThinkTags;
|
|
40
40
|
var init_utils = __esm({
|
|
41
41
|
"src/core/utils.ts"() {
|
|
42
42
|
copy = (value) => {
|
|
@@ -61,6 +61,9 @@ var init_utils = __esm({
|
|
|
61
61
|
return "\u66F4\u65E9";
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
|
+
replaceThinkTags = (str) => {
|
|
65
|
+
return str.replace(/<think>/g, ":::alert type=think data={content:'").replace(/<\/think>/g, "'} :::");
|
|
66
|
+
};
|
|
64
67
|
}
|
|
65
68
|
});
|
|
66
69
|
var ChatProvider, useChatStore;
|
|
@@ -81,7 +84,8 @@ var init_styles_module = __esm({
|
|
|
81
84
|
fileEditHeader: "styles_module_fileEditHeader",
|
|
82
85
|
fileEditContent: "styles_module_fileEditContent",
|
|
83
86
|
quoteList: "styles_module_quoteList",
|
|
84
|
-
mdEdit: "styles_module_mdEdit"
|
|
87
|
+
mdEdit: "styles_module_mdEdit",
|
|
88
|
+
think: "styles_module_think"
|
|
85
89
|
};
|
|
86
90
|
}
|
|
87
91
|
});
|
|
@@ -99,7 +103,7 @@ var init_AppCard = __esm({
|
|
|
99
103
|
AppCard_default = ({ data, loading }) => {
|
|
100
104
|
const chatStore = useChatStore();
|
|
101
105
|
const onClick = () => {
|
|
102
|
-
chatStore.switchAgentConversation(
|
|
106
|
+
chatStore.switchAgentConversation(data.appKey);
|
|
103
107
|
};
|
|
104
108
|
return /* @__PURE__ */ jsx(Spin, { spinning: loading, size: "small", children: /* @__PURE__ */ jsxs(Flex, { vertical: true, gap: 4, align: "center", className: styles_module_default.appCard, onClick, children: [
|
|
105
109
|
/* @__PURE__ */ jsx("img", { src: data.iconUrl }),
|
|
@@ -290,6 +294,36 @@ var init_QuoteList = __esm({
|
|
|
290
294
|
}
|
|
291
295
|
});
|
|
292
296
|
|
|
297
|
+
// src/ui/common/markdownAlert/Think.tsx
|
|
298
|
+
var Think_exports = {};
|
|
299
|
+
__export(Think_exports, {
|
|
300
|
+
default: () => Think_default
|
|
301
|
+
});
|
|
302
|
+
var Think_default;
|
|
303
|
+
var init_Think = __esm({
|
|
304
|
+
"src/ui/common/markdownAlert/Think.tsx"() {
|
|
305
|
+
init_styles_module();
|
|
306
|
+
Think_default = ({ data, loading }) => {
|
|
307
|
+
return /* @__PURE__ */ jsx(
|
|
308
|
+
Collapse,
|
|
309
|
+
{
|
|
310
|
+
className: styles_module_default.think,
|
|
311
|
+
ghost: true,
|
|
312
|
+
size: "small",
|
|
313
|
+
defaultActiveKey: ["think"],
|
|
314
|
+
items: [
|
|
315
|
+
{
|
|
316
|
+
key: "think",
|
|
317
|
+
label: loading ? "\u4ED4\u7EC6\u601D\u8003\u4E2D..." : "\u601D\u8003\u8FC7\u7A0B",
|
|
318
|
+
children: /* @__PURE__ */ jsx(RenderMarkdown, { content: data.content })
|
|
319
|
+
}
|
|
320
|
+
]
|
|
321
|
+
}
|
|
322
|
+
);
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
|
|
293
327
|
// src/stores/index.ts
|
|
294
328
|
init_utils();
|
|
295
329
|
|
|
@@ -553,8 +587,8 @@ function createChatStore() {
|
|
|
553
587
|
character.loading = true;
|
|
554
588
|
const { data } = await config.services.request.agentCharacterQuery(agentId);
|
|
555
589
|
if (receiver.active.id !== agentId) return;
|
|
556
|
-
character.list = data;
|
|
557
|
-
const active =
|
|
590
|
+
character.list = data || [];
|
|
591
|
+
const active = character.list.find((item) => item.selected);
|
|
558
592
|
if (active) {
|
|
559
593
|
character.active = active;
|
|
560
594
|
}
|
|
@@ -903,6 +937,13 @@ function createChatStore() {
|
|
|
903
937
|
conversation.messages[msg.conversationId].loading = false;
|
|
904
938
|
getQuestionList(msg.conversationId, msg.id);
|
|
905
939
|
};
|
|
940
|
+
const errCallback = (msg) => {
|
|
941
|
+
const messages = conversation.messages[msg.conversationId].message;
|
|
942
|
+
const idx = findMsgIndex(msg.conversationId, msg.id);
|
|
943
|
+
if (idx === -1) return;
|
|
944
|
+
messages[idx] = { ...msg, type: void 0 };
|
|
945
|
+
conversation.messages[msg.conversationId].loading = false;
|
|
946
|
+
};
|
|
906
947
|
const acceptMessage = (newMessage) => {
|
|
907
948
|
const conversationId = newMessage.data.conversationId;
|
|
908
949
|
if (!conversation.messages[conversationId]?.message) return;
|
|
@@ -919,6 +960,9 @@ function createChatStore() {
|
|
|
919
960
|
case "TEXT_MESSAGE_END":
|
|
920
961
|
endCallback(newMessage.data);
|
|
921
962
|
break;
|
|
963
|
+
case "RUN_ERROR":
|
|
964
|
+
errCallback(newMessage.data);
|
|
965
|
+
break;
|
|
922
966
|
}
|
|
923
967
|
};
|
|
924
968
|
return {
|
|
@@ -958,6 +1002,9 @@ function createChatStore() {
|
|
|
958
1002
|
// src/ui/layouts/index.tsx
|
|
959
1003
|
init_Context();
|
|
960
1004
|
|
|
1005
|
+
// src/components/MessageRender.tsx
|
|
1006
|
+
init_utils();
|
|
1007
|
+
|
|
961
1008
|
// src/ui/common/markdownAlert/index.ts
|
|
962
1009
|
var customComponents = {
|
|
963
1010
|
appCard: () => Promise.resolve().then(() => (init_AppCard(), AppCard_exports)),
|
|
@@ -965,18 +1012,27 @@ var customComponents = {
|
|
|
965
1012
|
indexQuote: () => Promise.resolve().then(() => (init_IndexQuote(), IndexQuote_exports)),
|
|
966
1013
|
mdEdit: () => Promise.resolve().then(() => (init_MdEdit(), MdEdit_exports)),
|
|
967
1014
|
fileEdit: () => Promise.resolve().then(() => (init_FileEdit(), FileEdit_exports)),
|
|
968
|
-
quoteList: () => Promise.resolve().then(() => (init_QuoteList(), QuoteList_exports))
|
|
1015
|
+
quoteList: () => Promise.resolve().then(() => (init_QuoteList(), QuoteList_exports)),
|
|
1016
|
+
think: () => Promise.resolve().then(() => (init_Think(), Think_exports))
|
|
969
1017
|
};
|
|
970
1018
|
|
|
971
1019
|
// src/components/styles.module.less
|
|
972
1020
|
var styles_module_default2 = {
|
|
1021
|
+
loadingMessage: "styles_module_loadingMessage",
|
|
973
1022
|
chatAttachments: "styles_module_chatAttachments",
|
|
974
1023
|
chatSender: "styles_module_chatSender",
|
|
975
1024
|
chatQuoteMsg: "styles_module_chatQuoteMsg"
|
|
976
1025
|
};
|
|
977
1026
|
var MessageRender_default = ({ message: message3, placement }) => {
|
|
978
|
-
return /* @__PURE__ */
|
|
979
|
-
message3.msgContent && /* @__PURE__ */ jsx(
|
|
1027
|
+
return /* @__PURE__ */ jsx(Flex, { vertical: true, children: !(message3.msgContent || message3.msgFiles.length) ? /* @__PURE__ */ jsx(Typography, { children: /* @__PURE__ */ jsx(Spin, { size: "small" }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1028
|
+
message3.msgContent && /* @__PURE__ */ jsx(
|
|
1029
|
+
Bubble,
|
|
1030
|
+
{
|
|
1031
|
+
placement,
|
|
1032
|
+
className: classNames8({ [styles_module_default2.loadingMessage]: message3.type }),
|
|
1033
|
+
content: /* @__PURE__ */ jsx(RenderMarkdown, { content: replaceThinkTags(message3.msgContent), customComponents })
|
|
1034
|
+
}
|
|
1035
|
+
),
|
|
980
1036
|
message3.msgFiles?.map((file) => /* @__PURE__ */ jsx(
|
|
981
1037
|
Bubble,
|
|
982
1038
|
{
|
|
@@ -1000,7 +1056,7 @@ var MessageRender_default = ({ message: message3, placement }) => {
|
|
|
1000
1056
|
message3.quoteMsg?.id && /* @__PURE__ */ jsx(
|
|
1001
1057
|
Bubble,
|
|
1002
1058
|
{
|
|
1003
|
-
className:
|
|
1059
|
+
className: classNames8(styles_module_default2.chatQuoteMsg),
|
|
1004
1060
|
placement,
|
|
1005
1061
|
content: /* @__PURE__ */ jsxs(Flex, { vertical: true, gap: 8, children: [
|
|
1006
1062
|
message3.quoteMsg.msgContent && /* @__PURE__ */ jsxs(Flex, { children: [
|
|
@@ -1024,7 +1080,7 @@ var MessageRender_default = ({ message: message3, placement }) => {
|
|
|
1024
1080
|
] })
|
|
1025
1081
|
}
|
|
1026
1082
|
)
|
|
1027
|
-
] });
|
|
1083
|
+
] }) });
|
|
1028
1084
|
};
|
|
1029
1085
|
|
|
1030
1086
|
// src/core/constants.ts
|
|
@@ -1040,7 +1096,6 @@ init_Context();
|
|
|
1040
1096
|
|
|
1041
1097
|
// src/ui/common/styles.module.less
|
|
1042
1098
|
var styles_module_default3 = {
|
|
1043
|
-
loadingMessage: "styles_module_loadingMessage",
|
|
1044
1099
|
nsConversationListPanel: "styles_module_nsConversationListPanel",
|
|
1045
1100
|
nsConversations: "styles_module_nsConversations",
|
|
1046
1101
|
nsBubbleList: "styles_module_nsBubbleList",
|
|
@@ -1064,68 +1119,6 @@ var styles_module_default3 = {
|
|
|
1064
1119
|
nsAvatarListItemIconActive: "styles_module_nsAvatarListItemIconActive",
|
|
1065
1120
|
nsAvatarListItemName: "styles_module_nsAvatarListItemName"
|
|
1066
1121
|
};
|
|
1067
|
-
function extractThinkContent(content) {
|
|
1068
|
-
let main = content;
|
|
1069
|
-
const thinkContents = [];
|
|
1070
|
-
let buffer = "";
|
|
1071
|
-
const regex = /<think>(.*?)<\/think>/gs;
|
|
1072
|
-
for (const match of content.matchAll(regex)) {
|
|
1073
|
-
const thinkText = match[1].trim();
|
|
1074
|
-
thinkContents.push(thinkText);
|
|
1075
|
-
main = main.replace(match[0], "");
|
|
1076
|
-
}
|
|
1077
|
-
const lastStart = content.lastIndexOf("<think>");
|
|
1078
|
-
const lastEnd = content.lastIndexOf("</think>");
|
|
1079
|
-
if (lastStart > lastEnd) {
|
|
1080
|
-
buffer = content.slice(lastStart).replace("<think>", "");
|
|
1081
|
-
main = main.slice(0, lastStart);
|
|
1082
|
-
}
|
|
1083
|
-
return { mainContent: main, thinkContents, thinkBuffer: buffer };
|
|
1084
|
-
}
|
|
1085
|
-
function renderMarkdownPanel(content, label, key) {
|
|
1086
|
-
return {
|
|
1087
|
-
key,
|
|
1088
|
-
label,
|
|
1089
|
-
children: /* @__PURE__ */ jsx(RenderMarkdown, { content, customComponents })
|
|
1090
|
-
};
|
|
1091
|
-
}
|
|
1092
|
-
var MessageAIRender_default = ({ message: message3, placement }) => {
|
|
1093
|
-
const { mainContent, thinkContents, thinkBuffer } = useMemo(() => {
|
|
1094
|
-
if (!message3?.msgContent) return { mainContent: "", thinkContents: [], thinkBuffer: "" };
|
|
1095
|
-
return extractThinkContent(message3.msgContent);
|
|
1096
|
-
}, [message3?.msgContent]);
|
|
1097
|
-
if (!message3.msgContent) {
|
|
1098
|
-
return /* @__PURE__ */ jsx(Typography, { children: /* @__PURE__ */ jsx(Spin, { size: "small" }) });
|
|
1099
|
-
}
|
|
1100
|
-
return /* @__PURE__ */ jsx(Flex, { vertical: true, children: /* @__PURE__ */ jsx(
|
|
1101
|
-
Bubble,
|
|
1102
|
-
{
|
|
1103
|
-
placement,
|
|
1104
|
-
className: classNames9({ [styles_module_default3.loadingMessage]: message3.type && message3.type !== "TEXT_MESSAGE_END" }),
|
|
1105
|
-
content: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1106
|
-
thinkContents.length > 0 && /* @__PURE__ */ jsx(
|
|
1107
|
-
Collapse,
|
|
1108
|
-
{
|
|
1109
|
-
ghost: true,
|
|
1110
|
-
size: "small",
|
|
1111
|
-
defaultActiveKey: thinkContents.map((_, i) => `think-${i}`),
|
|
1112
|
-
items: thinkContents.map((content, index) => renderMarkdownPanel(content, `\u601D\u8003\u8FC7\u7A0B`, `think-${index}`))
|
|
1113
|
-
}
|
|
1114
|
-
),
|
|
1115
|
-
thinkBuffer && /* @__PURE__ */ jsx(
|
|
1116
|
-
Collapse,
|
|
1117
|
-
{
|
|
1118
|
-
ghost: true,
|
|
1119
|
-
size: "small",
|
|
1120
|
-
defaultActiveKey: ["buffer-think"],
|
|
1121
|
-
items: [renderMarkdownPanel(thinkBuffer, "\u4ED4\u7EC6\u601D\u8003\u4E2D...", "buffer-think")]
|
|
1122
|
-
}
|
|
1123
|
-
),
|
|
1124
|
-
/* @__PURE__ */ jsx(RenderMarkdown, { content: mainContent, customComponents })
|
|
1125
|
-
] })
|
|
1126
|
-
}
|
|
1127
|
-
) });
|
|
1128
|
-
};
|
|
1129
1122
|
var BubbleListItems_default = ({ firstMessage = false, avatar = { user: false, agent: true, other: true } }) => {
|
|
1130
1123
|
const chatStore = useChatStore();
|
|
1131
1124
|
const receiverState = useSnapshot(chatStore.receiver);
|
|
@@ -1174,7 +1167,7 @@ var BubbleListItems_default = ({ firstMessage = false, avatar = { user: false, a
|
|
|
1174
1167
|
/* @__PURE__ */ jsx(
|
|
1175
1168
|
Welcome,
|
|
1176
1169
|
{
|
|
1177
|
-
className:
|
|
1170
|
+
className: classNames8(styles_module_default3.chatWelcome, "p-t-32"),
|
|
1178
1171
|
variant: "borderless",
|
|
1179
1172
|
icon: /* @__PURE__ */ jsx(Avatar, { shape: "square", size: 58, src: receiverState.active.logo }),
|
|
1180
1173
|
title: `\u4F60\u597D\uFF0C\u6211\u662F${receiverState.active.name || ""}`,
|
|
@@ -1192,7 +1185,7 @@ var BubbleListItems_default = ({ firstMessage = false, avatar = { user: false, a
|
|
|
1192
1185
|
label: "\u{1F914} \u63A8\u8350\u95EE\u9898:",
|
|
1193
1186
|
children: receiverState.active.config.recommendQuestions.map(({ question }) => ({
|
|
1194
1187
|
key: question,
|
|
1195
|
-
description: /* @__PURE__ */ jsx("span", { onClick: () => chatStore.sendMessage(question), className:
|
|
1188
|
+
description: /* @__PURE__ */ jsx("span", { onClick: () => chatStore.sendMessage(question), className: classNames8(styles_module_default3.chatWelcomePrompts, "text-ellipsis"), children: question })
|
|
1196
1189
|
}))
|
|
1197
1190
|
}
|
|
1198
1191
|
]
|
|
@@ -1238,8 +1231,7 @@ var BubbleListItems_default = ({ firstMessage = false, avatar = { user: false, a
|
|
|
1238
1231
|
placement: role.placement,
|
|
1239
1232
|
variant: "borderless",
|
|
1240
1233
|
avatar: role.avatar,
|
|
1241
|
-
content:
|
|
1242
|
-
// loadingRender: () => <Spin size="small" />,
|
|
1234
|
+
content: /* @__PURE__ */ jsx(MessageRender_default, { message: message3, placement: role.placement }),
|
|
1243
1235
|
footer: role.user === "agent" && /* @__PURE__ */ jsxs(Flex, { children: [
|
|
1244
1236
|
/* @__PURE__ */ jsx(Button, { onClick: () => copy(message3.msgContent), color: "default", variant: "text", size: "small", icon: /* @__PURE__ */ jsx(CopyOutlined, {}) }),
|
|
1245
1237
|
/* @__PURE__ */ jsx(
|
|
@@ -1325,7 +1317,7 @@ var BubbleListItems_default = ({ firstMessage = false, avatar = { user: false, a
|
|
|
1325
1317
|
autoScroll: false,
|
|
1326
1318
|
ref: listRef,
|
|
1327
1319
|
items: bubbleListItems,
|
|
1328
|
-
className:
|
|
1320
|
+
className: classNames8(styles_module_default3.nsBubbleList, "height-full", "scroll-fade-in", "zero-chat-bubbles"),
|
|
1329
1321
|
onScroll: handleScroll
|
|
1330
1322
|
},
|
|
1331
1323
|
conversationState.active.id
|
|
@@ -1360,7 +1352,7 @@ var CharacterList_default = () => {
|
|
|
1360
1352
|
/* @__PURE__ */ jsx(
|
|
1361
1353
|
Avatar,
|
|
1362
1354
|
{
|
|
1363
|
-
className:
|
|
1355
|
+
className: classNames8(styles_module_default3.nsAvatarListItemIcon, "cursor-pointer", {
|
|
1364
1356
|
[styles_module_default3.nsAvatarListItemIconActive]: activeCharacter.id === item.id
|
|
1365
1357
|
}),
|
|
1366
1358
|
size: 50,
|
|
@@ -1381,7 +1373,7 @@ var AgentCharacter_default = () => {
|
|
|
1381
1373
|
chatStore.getCharacters(receiverState.active.id);
|
|
1382
1374
|
}
|
|
1383
1375
|
}, [receiverState.active.id]);
|
|
1384
|
-
return characterState.active
|
|
1376
|
+
return characterState.active?.id && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1385
1377
|
/* @__PURE__ */ jsx("div", { title: "\u6027\u683C", children: /* @__PURE__ */ jsx(Avatar, { onClick: chatStore.openCharacterList, className: "cursor-pointer", src: characterState.active.logo }) }),
|
|
1386
1378
|
characterState.open && /* @__PURE__ */ jsx(CharacterList_default, {})
|
|
1387
1379
|
] });
|
|
@@ -1455,7 +1447,7 @@ var ChatHeader_default = ({
|
|
|
1455
1447
|
const chatStore = useChatStore();
|
|
1456
1448
|
const receiverState = useSnapshot(chatStore.receiver);
|
|
1457
1449
|
const configState = useSnapshot(chatStore.config);
|
|
1458
|
-
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Flex, { justify: "space-between", align: "center", className:
|
|
1450
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Flex, { justify: "space-between", align: "center", className: classNames8(styles_module_default3.nsChatHeader, "zero-chat-header"), children: [
|
|
1459
1451
|
/* @__PURE__ */ jsxs(Flex, { gap: 4, align: "center", children: [
|
|
1460
1452
|
/* @__PURE__ */ jsx(
|
|
1461
1453
|
RenderWrapper,
|
|
@@ -1725,7 +1717,7 @@ var ChatSender_default = forwardRef(
|
|
|
1725
1717
|
extraFooter,
|
|
1726
1718
|
" "
|
|
1727
1719
|
] }),
|
|
1728
|
-
/* @__PURE__ */ jsx(Flex, { align: "center", children: loading ? /* @__PURE__ */ jsx(LoadingButton, {}) : /* @__PURE__ */ jsx(SendButton, { ...sendBtnProps }) })
|
|
1720
|
+
/* @__PURE__ */ jsx(Flex, { align: "center", children: loading ? /* @__PURE__ */ jsx(LoadingButton, { disabled: false }) : /* @__PURE__ */ jsx(SendButton, { ...sendBtnProps }) })
|
|
1729
1721
|
] }),
|
|
1730
1722
|
extraFooterBelow
|
|
1731
1723
|
] });
|
|
@@ -1746,9 +1738,9 @@ var SenderPromptsItems_default = () => {
|
|
|
1746
1738
|
const chatStore = useChatStore();
|
|
1747
1739
|
const receiverState = useSnapshot(chatStore.receiver);
|
|
1748
1740
|
const component = useMemo(
|
|
1749
|
-
() => receiverState.active.config?.labels?.length > 0 && /* @__PURE__ */ jsxs(Flex, { gap: 4,
|
|
1741
|
+
() => receiverState.active.config?.labels?.length > 0 && /* @__PURE__ */ jsxs(Flex, { gap: 4, wrap: true, children: [
|
|
1750
1742
|
/* @__PURE__ */ jsx(Button, { disabled: true, color: "default", variant: "text", children: "\u968F\u4FBF\u804A\u804A" }),
|
|
1751
|
-
receiverState.active.config.labels.map((question) => /* @__PURE__ */ jsx(
|
|
1743
|
+
receiverState.active.config.labels.slice(0, 6).map((question) => /* @__PURE__ */ jsx(
|
|
1752
1744
|
Popover,
|
|
1753
1745
|
{
|
|
1754
1746
|
content: /* @__PURE__ */ jsx(
|
|
@@ -1765,7 +1757,7 @@ var SenderPromptsItems_default = () => {
|
|
|
1765
1757
|
title: /* @__PURE__ */ jsx(
|
|
1766
1758
|
"div",
|
|
1767
1759
|
{
|
|
1768
|
-
className:
|
|
1760
|
+
className: classNames8(styles_module_default3.nsSenderListTitle, "text-ellipsis"),
|
|
1769
1761
|
children: `${receiverState.active.name}\u5F00\u59CB\u5173\u6CE8${question.name}\u5185\u5BB9\uFF01`
|
|
1770
1762
|
}
|
|
1771
1763
|
),
|
|
@@ -1894,7 +1886,7 @@ var ConversationListHeader_default = () => {
|
|
|
1894
1886
|
type: "primary",
|
|
1895
1887
|
shape: "round",
|
|
1896
1888
|
onClick: () => chatStore.createConversation(),
|
|
1897
|
-
className:
|
|
1889
|
+
className: classNames8("m-t-16"),
|
|
1898
1890
|
icon: /* @__PURE__ */ jsx(PlusOutlined, {}),
|
|
1899
1891
|
children: "\u65B0\u5EFA\u4F1A\u8BDD"
|
|
1900
1892
|
}
|
|
@@ -1902,7 +1894,7 @@ var ConversationListHeader_default = () => {
|
|
|
1902
1894
|
] });
|
|
1903
1895
|
};
|
|
1904
1896
|
var ConversationListPanel_default = ({ header }) => {
|
|
1905
|
-
return /* @__PURE__ */ jsxs(Flex, { vertical: true, className:
|
|
1897
|
+
return /* @__PURE__ */ jsxs(Flex, { vertical: true, className: classNames8("height-full", "zero-chat-conversations", styles_module_default3.nsConversationListPanel), children: [
|
|
1906
1898
|
/* @__PURE__ */ jsx(RenderWrapper, { control: header, DefaultComponent: ConversationListHeader_default }),
|
|
1907
1899
|
/* @__PURE__ */ jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsx(ConversationList_default, {}) })
|
|
1908
1900
|
] });
|
|
@@ -1982,7 +1974,7 @@ var layouts_default = forwardRef(({ theme, params, userInfo, hooks, layout, conf
|
|
|
1982
1974
|
useWebSocket({
|
|
1983
1975
|
url: configState.services.websocketBaseUrls?.[0] && getWebSocketUrl(
|
|
1984
1976
|
`${configState.services.websocketBaseUrls?.[0]}/lolr/conversation/ws/subscribe?NS-TOKEN=${getToken()}`,
|
|
1985
|
-
isLocalhost() ? "192.168.
|
|
1977
|
+
isLocalhost() ? "192.168.3.102" : ""
|
|
1986
1978
|
),
|
|
1987
1979
|
onMessage: chatStore.acceptMessage,
|
|
1988
1980
|
clientHeartbeat: false,
|
|
@@ -1991,7 +1983,7 @@ var layouts_default = forwardRef(({ theme, params, userInfo, hooks, layout, conf
|
|
|
1991
1983
|
useWebSocket({
|
|
1992
1984
|
url: configState.services.websocketBaseUrls?.[1] && getWebSocketUrl(
|
|
1993
1985
|
`${configState.services.websocketBaseUrls?.[1]}/lolr/conversation/ws/subscribe?NS-TOKEN=${getToken()}`,
|
|
1994
|
-
isLocalhost() ? "192.168.
|
|
1986
|
+
isLocalhost() ? "192.168.3.102" : ""
|
|
1995
1987
|
),
|
|
1996
1988
|
onMessage: chatStore.acceptMessage,
|
|
1997
1989
|
clientHeartbeat: false,
|
|
@@ -2000,7 +1992,7 @@ var layouts_default = forwardRef(({ theme, params, userInfo, hooks, layout, conf
|
|
|
2000
1992
|
useEffect(() => {
|
|
2001
1993
|
configState.hooks?.onBeforeInit?.();
|
|
2002
1994
|
}, []);
|
|
2003
|
-
return /* @__PURE__ */ jsx(XProvider, { theme: { cssVar: true, ...theme }, children: /* @__PURE__ */ jsx(ChatProvider, { store: chatStore, children: /* @__PURE__ */ jsx(Spin, { spinning: receiverState.loading, wrapperClassName: "full-spin", children: /* @__PURE__ */ jsxs(Flex, { vertical: true, className:
|
|
1995
|
+
return /* @__PURE__ */ jsx(XProvider, { theme: { cssVar: true, ...theme }, children: /* @__PURE__ */ jsx(ChatProvider, { store: chatStore, children: /* @__PURE__ */ jsx(Spin, { spinning: receiverState.loading, wrapperClassName: "full-spin", children: /* @__PURE__ */ jsxs(Flex, { vertical: true, className: classNames8(styles_module_default4.nsChatLayout, "zero-chat-layout", "height-full"), children: [
|
|
2004
1996
|
/* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.globalHeader, DefaultComponent: ChatHeader_default }),
|
|
2005
1997
|
/* @__PURE__ */ jsxs(Flex, { className: "full-scroll", children: [
|
|
2006
1998
|
/* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.leftPanel }),
|
|
@@ -2054,15 +2046,15 @@ var layouts_default = forwardRef(({ theme, params, userInfo, hooks, layout, conf
|
|
|
2054
2046
|
}
|
|
2055
2047
|
)
|
|
2056
2048
|
] }) }),
|
|
2057
|
-
/* @__PURE__ */ jsx(Splitter.Panel, { collapsible: false, max: 800, min: 400, size: sizes[1], children: /* @__PURE__ */ jsxs(Flex, { vertical: true, className:
|
|
2049
|
+
/* @__PURE__ */ jsx(Splitter.Panel, { collapsible: false, max: 800, min: 400, size: sizes[1], children: /* @__PURE__ */ jsxs(Flex, { vertical: true, className: classNames8("height-full"), children: [
|
|
2058
2050
|
/* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.chatHeader, DefaultComponent: ChatHeader_default }),
|
|
2059
|
-
/* @__PURE__ */ jsx(Flex, { vertical: true, className:
|
|
2051
|
+
/* @__PURE__ */ jsx(Flex, { vertical: true, className: classNames8("full-scroll"), children: /* @__PURE__ */ jsxs(
|
|
2060
2052
|
Flex,
|
|
2061
2053
|
{
|
|
2062
2054
|
justify: "center",
|
|
2063
2055
|
vertical: true,
|
|
2064
2056
|
gap: 24,
|
|
2065
|
-
className:
|
|
2057
|
+
className: classNames8("height-full", styles_module_default4.nsChatBody, "zero-chat-body", styles_module_default4.nsBodyWidth),
|
|
2066
2058
|
children: [
|
|
2067
2059
|
shouldRender(configState.layout.messageList) && /* @__PURE__ */ jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.messageList, DefaultComponent: BubbleListItems_default }) }),
|
|
2068
2060
|
/* @__PURE__ */ jsxs(Flex, { vertical: true, gap: 8, children: [
|