@zero-library/chat-agent 2.2.19 → 2.3.1

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 CHANGED
@@ -6,14 +6,14 @@ var jsxRuntime = require('react/jsx-runtime');
6
6
  var react = require('react');
7
7
  var valtio = require('valtio');
8
8
  var icons = require('@ant-design/icons');
9
+ var classNames11 = require('classnames');
9
10
  var x = require('@ant-design/x');
10
- var classNames9 = require('classnames');
11
11
  var dayjs = require('dayjs');
12
12
  var InfiniteScroll = require('react-infinite-scroll-component');
13
13
 
14
14
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
15
15
 
16
- var classNames9__default = /*#__PURE__*/_interopDefault(classNames9);
16
+ var classNames11__default = /*#__PURE__*/_interopDefault(classNames11);
17
17
  var dayjs__default = /*#__PURE__*/_interopDefault(dayjs);
18
18
  var InfiniteScroll__default = /*#__PURE__*/_interopDefault(InfiniteScroll);
19
19
 
@@ -311,7 +311,7 @@ var init_Charts = __esm({
311
311
  );
312
312
  Charts_default = ({ data, loading }) => {
313
313
  const { type, config } = data;
314
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default.chart, children: loading ? (
314
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames11__default.default(styles_module_default.chart, "scroll-fade-in"), children: loading ? (
315
315
  // Antd 骨架屏
316
316
  /* @__PURE__ */ jsxRuntime.jsx(antd.Skeleton.Node, { active: true, className: styles_module_default.chartSkeleton, children: /* @__PURE__ */ jsxRuntime.jsx(icons.DotChartOutlined, { className: styles_module_default.chartSkeletonIcon }) })
317
317
  ) : /* @__PURE__ */ jsxRuntime.jsx(
@@ -415,6 +415,27 @@ var createChatService = (request) => {
415
415
  const fileUpload = (formData) => {
416
416
  return request.post("/lolr/storage/upload", formData, { timeout: 5 * 60 * 1e3 });
417
417
  };
418
+ const labelItemUpdate = (agentId, params) => {
419
+ return request.post("/lolr/label/item", { agentId, ...params });
420
+ };
421
+ const labelItemDelete = (id) => {
422
+ return request.delete("/lolr/label/item", { id });
423
+ };
424
+ const labelsQuery = (agentId, params) => {
425
+ return request.get("/lolr/label", { agentId, ...params });
426
+ };
427
+ const labelItemsQuery = (agentId, params) => {
428
+ return request.get("/lolr/label/item", { ...params, agentId });
429
+ };
430
+ const labelItemTop = (params) => {
431
+ return request.put("/lolr/label/item/top", params);
432
+ };
433
+ const labelItemPromptAssistant = (prompt) => {
434
+ return request.post("/lolr/agent/prompts/optimization", { prompt });
435
+ };
436
+ const recommendQuestionsQuery = (agentId, conversationId) => {
437
+ return request.get("/lolr/agent/suggest", { maxCount: 3, agentId, conversationId });
438
+ };
418
439
  return {
419
440
  conversationsQuery,
420
441
  conversationCreate,
@@ -432,7 +453,14 @@ var createChatService = (request) => {
432
453
  agentInfoQuery,
433
454
  agentCharacterQuery,
434
455
  agentCharacterSelect,
435
- fileUpload
456
+ fileUpload,
457
+ labelItemUpdate,
458
+ labelItemDelete,
459
+ labelsQuery,
460
+ labelItemsQuery,
461
+ labelItemTop,
462
+ labelItemPromptAssistant,
463
+ recommendQuestionsQuery
436
464
  };
437
465
  };
438
466
  var createFileService = (request) => {
@@ -456,20 +484,19 @@ var defaultAgentLayout = {
456
484
  conversationList: true,
457
485
  preview: true,
458
486
  messageList: true,
459
- firstMessage: false,
460
487
  senderHeader: false,
461
488
  sender: true,
462
489
  senderFooter: false,
463
490
  globalHeader: false,
464
491
  chatHeader: true,
465
- disclaimerNotice: true
492
+ disclaimerNotice: true,
493
+ recommendQuestions: false
466
494
  };
467
495
  var defaultExpertLayout = {
468
496
  leftPanel: false,
469
497
  conversationList: false,
470
498
  preview: false,
471
499
  messageList: true,
472
- firstMessage: false,
473
500
  senderHeader: false,
474
501
  sender: {
475
502
  props: {
@@ -485,7 +512,8 @@ var defaultExpertLayout = {
485
512
  conversationListBtn: false
486
513
  }
487
514
  },
488
- disclaimerNotice: false
515
+ disclaimerNotice: false,
516
+ recommendQuestions: false
489
517
  };
490
518
  function createChatStore() {
491
519
  const config = valtio.proxy({
@@ -579,6 +607,8 @@ function createChatStore() {
579
607
  const receiver = valtio.proxy({
580
608
  /** 当前激活的接收者信息(智能体或专家) */
581
609
  active: {},
610
+ /** 智能体推荐问题列表 */
611
+ recommendQuestions: [],
582
612
  /** 接收者加载状态 */
583
613
  loading: false,
584
614
  /** 接收者透传参数,后期可能扩展不透传参数 */
@@ -771,6 +801,9 @@ function createChatStore() {
771
801
  const setContent = (content) => {
772
802
  conversation.messages[conversation.active.id].content = content;
773
803
  };
804
+ const setContentParams = (params) => {
805
+ conversation.messages[conversation.active.id].params = params;
806
+ };
774
807
  const setFileList = (files = []) => {
775
808
  conversation.messages[conversation.active.id].files = files;
776
809
  };
@@ -793,6 +826,17 @@ function createChatStore() {
793
826
  if (lastMessage.id !== messageId) return;
794
827
  conversation.messages[conversationId].questionList = data;
795
828
  };
829
+ const getRecommendQuestions = async (conversationId) => {
830
+ if (conversationId === conversation.active.id && conversation.active.member.agent?.id && !conversation.messages[conversationId].message.length) {
831
+ try {
832
+ const { data } = await config.services.request.recommendQuestionsQuery(conversation.active.member.agent.id, conversationId);
833
+ if (conversationId === conversation.active.id) {
834
+ receiver.recommendQuestions = data;
835
+ }
836
+ } catch (e) {
837
+ }
838
+ }
839
+ };
796
840
  const feedback = async (conversationId, messageId, msgFeedback, index) => {
797
841
  try {
798
842
  conversation.feedback.loading = true;
@@ -882,6 +926,7 @@ function createChatStore() {
882
926
  throw new Error("\u64CD\u4F5C\u88AB\u963B\u6B62");
883
927
  }
884
928
  await initConversation(conversationId);
929
+ receiver.recommendQuestions = [];
885
930
  await setPreview();
886
931
  config.hooks?.onAfterSwitchConversation?.(conversationId);
887
932
  try {
@@ -910,6 +955,7 @@ function createChatStore() {
910
955
  });
911
956
  conversation.messages[conversationId].message = data.items;
912
957
  }
958
+ getRecommendQuestions(conversationId);
913
959
  config.hooks?.onAfterInitMessages?.(conversation.messages[conversationId].message);
914
960
  config.hooks?.onAfterInit?.();
915
961
  };
@@ -954,10 +1000,11 @@ function createChatStore() {
954
1000
  stream: true
955
1001
  };
956
1002
  const extraParams = common.deepCopy(config.params.params || {});
957
- Object.assign(extraParams, receiver.params, message2 ? {} : references?.params, params);
1003
+ Object.assign(extraParams, receiver.params, message2 ? {} : { ...references?.params, ...conversation.messages[conversationId].params }, params);
958
1004
  sendParams.params = JSON.stringify(extraParams);
959
1005
  if (!message2) {
960
1006
  setContent("");
1007
+ setContentParams();
961
1008
  setFileList([]);
962
1009
  setReferences();
963
1010
  setHeaderOpen(false);
@@ -1124,6 +1171,8 @@ function createChatStore() {
1124
1171
  setReferences,
1125
1172
  /** 设置消息内容 */
1126
1173
  setContent,
1174
+ /** 设置内容参数,透传大模型后清空 */
1175
+ setContentParams,
1127
1176
  /** 设置文件列表 */
1128
1177
  setFileList,
1129
1178
  /** 设置头部展开状态 */
@@ -1169,7 +1218,7 @@ var styles_module_default2 = {
1169
1218
  quoteTooltip: "styles_module_quoteTooltip",
1170
1219
  quoteTooltipContainer: "styles_module_quoteTooltipContainer"
1171
1220
  };
1172
- var MessageRender_default = ({ message: message2, placement, onFilePreview }) => {
1221
+ var MessageRender_default = ({ message: message2, placement, onFilePreview, customComponents: propsCustomComponents }) => {
1173
1222
  const msgContent = react.useMemo(
1174
1223
  () => `${message2.msgContent || ""}${message2.msgContent && message2.tempContent ? "\n\n" : ""}${message2.tempContent || ""}`,
1175
1224
  [message2.msgContent, message2.tempContent]
@@ -1202,13 +1251,16 @@ var MessageRender_default = ({ message: message2, placement, onFilePreview }) =>
1202
1251
  onFilePreview?.(file);
1203
1252
  }
1204
1253
  };
1254
+ const mergedCustomComponents = react.useMemo(() => {
1255
+ return { ...customComponents, ...propsCustomComponents };
1256
+ }, [propsCustomComponents]);
1205
1257
  return /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { vertical: true, children: !(msgContent || message2.msgFiles.length) ? /* @__PURE__ */ jsxRuntime.jsx(antd.Typography, { children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { size: "small" }) }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1206
1258
  msgContent && /* @__PURE__ */ jsxRuntime.jsx(
1207
1259
  x.Bubble,
1208
1260
  {
1209
1261
  placement,
1210
- className: classNames9__default.default({ [styles_module_default2.loadingMessage]: message2.type }),
1211
- content: /* @__PURE__ */ jsxRuntime.jsx(common.RenderMarkdown, { content: replaceMarkdownTags(msgContent), customComponents, message: message2 })
1262
+ className: classNames11__default.default({ [styles_module_default2.loadingMessage]: message2.type }),
1263
+ content: /* @__PURE__ */ jsxRuntime.jsx(common.RenderMarkdown, { content: replaceMarkdownTags(msgContent), customComponents: mergedCustomComponents, message: message2 })
1212
1264
  }
1213
1265
  ),
1214
1266
  message2.msgFiles?.map((file) => /* @__PURE__ */ jsxRuntime.jsx(
@@ -1309,7 +1361,7 @@ var WelcomeItem_default = ({ icon = true, title = true, description = true, prom
1309
1361
  /* @__PURE__ */ jsxRuntime.jsx(
1310
1362
  x.Welcome,
1311
1363
  {
1312
- className: classNames9__default.default(styles_module_default3.chatWelcome, "p-t-32"),
1364
+ className: classNames11__default.default(styles_module_default3.chatWelcome, "p-t-32"),
1313
1365
  variant: "borderless",
1314
1366
  icon: /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: icon, DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(antd.Avatar, { shape: "square", size: 58, src: receiverState.active.logo }) }),
1315
1367
  title: /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: title, DefaultComponent: `\u4F60\u597D\uFF0C\u6211\u662F${receiverState.active.name || ""}` }),
@@ -1322,22 +1374,23 @@ var WelcomeItem_default = ({ icon = true, title = true, description = true, prom
1322
1374
  )
1323
1375
  }
1324
1376
  ),
1325
- receiverState.active.config?.recommendQuestions?.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
1377
+ /* @__PURE__ */ jsxRuntime.jsx(
1326
1378
  common.RenderWrapper,
1327
1379
  {
1328
1380
  control: prompts,
1329
- DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(
1381
+ DefaultComponent: receiverState?.recommendQuestions?.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
1330
1382
  x.Prompts,
1331
1383
  {
1332
1384
  className: "m-t-16",
1333
1385
  wrap: true,
1386
+ onItemClick: ({ data }) => chatStore.sendMessage(data.key),
1334
1387
  items: [
1335
1388
  {
1336
1389
  key: "1",
1337
1390
  label: "\u{1F914} \u63A8\u8350\u95EE\u9898:",
1338
- children: receiverState.active.config.recommendQuestions.map(({ question }) => ({
1391
+ children: receiverState?.recommendQuestions.map((question) => ({
1339
1392
  key: question,
1340
- description: /* @__PURE__ */ jsxRuntime.jsx("span", { onClick: () => chatStore.sendMessage(question), className: classNames9__default.default(styles_module_default3.chatWelcomePrompts, "text-ellipsis"), children: question })
1393
+ description: /* @__PURE__ */ jsxRuntime.jsx("span", { className: classNames11__default.default(styles_module_default3.chatWelcomePrompts, "text-ellipsis"), children: question })
1341
1394
  }))
1342
1395
  }
1343
1396
  ]
@@ -1347,7 +1400,13 @@ var WelcomeItem_default = ({ icon = true, title = true, description = true, prom
1347
1400
  )
1348
1401
  ] });
1349
1402
  };
1350
- var BubbleListItems_default = ({ firstMessage = false, welcomeMessage = true, avatar = { user: false, agent: true, other: true } }) => {
1403
+ var BubbleListItems_default = ({
1404
+ firstMessages = [],
1405
+ welcomeMessage = true,
1406
+ avatar = { user: false, agent: true, other: true },
1407
+ agentActions = false,
1408
+ customComponents: customComponents2 = {}
1409
+ }) => {
1351
1410
  const chatStore = useChatStore();
1352
1411
  const receiverState = valtio.useSnapshot(chatStore.receiver);
1353
1412
  const conversationState = valtio.useSnapshot(chatStore.conversation);
@@ -1430,6 +1489,7 @@ var BubbleListItems_default = ({ firstMessage = false, welcomeMessage = true, av
1430
1489
  const roleKey = Object.keys(conversationRoles).find((key) => conversationRoles[key].id === sender.id);
1431
1490
  return conversationRoles[roleKey] || {};
1432
1491
  };
1492
+ const messageRefs = react.useRef({});
1433
1493
  const chatRecords = react.useMemo(() => {
1434
1494
  return (chatMessage?.message || []).map((message2, index) => {
1435
1495
  const role = getRole(message2.sender);
@@ -1439,19 +1499,42 @@ var BubbleListItems_default = ({ firstMessage = false, welcomeMessage = true, av
1439
1499
  variant: "borderless",
1440
1500
  avatar: role.avatar,
1441
1501
  content: /* @__PURE__ */ jsxRuntime.jsx(
1442
- MessageRender_default,
1502
+ "div",
1443
1503
  {
1444
- message: message2,
1445
- placement: role.placement,
1446
- onFilePreview: (file) => chatStore.setPreview({
1447
- fileUrl: file.content,
1448
- suffix: file.extension,
1449
- fileName: file.name
1450
- })
1504
+ ref: (el) => {
1505
+ messageRefs.current[message2.id] = el;
1506
+ },
1507
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1508
+ MessageRender_default,
1509
+ {
1510
+ message: message2,
1511
+ placement: role.placement,
1512
+ customComponents: customComponents2,
1513
+ onFilePreview: (file) => chatStore.setPreview({
1514
+ fileUrl: file.content,
1515
+ suffix: file.extension,
1516
+ fileName: file.name
1517
+ })
1518
+ }
1519
+ )
1451
1520
  }
1452
1521
  ),
1453
1522
  footer: /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { children: role.user === "agent" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1454
- /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { onClick: () => common.copyText(message2.msgContent), color: "default", variant: "text", size: "small", icon: /* @__PURE__ */ jsxRuntime.jsx(icons.CopyOutlined, {}) }),
1523
+ /* @__PURE__ */ jsxRuntime.jsx(
1524
+ antd.Button,
1525
+ {
1526
+ onClick: () => {
1527
+ const container = messageRefs.current[message2.id];
1528
+ if (!container) return;
1529
+ const markdown = common.htmlToMarkdown(container?.innerHTML) || message2.msgContent;
1530
+ common.copyText(markdown);
1531
+ },
1532
+ color: "default",
1533
+ variant: "text",
1534
+ size: "small",
1535
+ icon: /* @__PURE__ */ jsxRuntime.jsx(icons.CopyOutlined, {})
1536
+ }
1537
+ ),
1455
1538
  /* @__PURE__ */ jsxRuntime.jsx(
1456
1539
  antd.Button,
1457
1540
  {
@@ -1473,6 +1556,18 @@ var BubbleListItems_default = ({ firstMessage = false, welcomeMessage = true, av
1473
1556
  icon: /* @__PURE__ */ jsxRuntime.jsx(icons.DislikeOutlined, {}),
1474
1557
  onClick: () => chatStore.feedback(conversationState.active.id, message2.id, 2, index)
1475
1558
  }
1559
+ ),
1560
+ /* @__PURE__ */ jsxRuntime.jsx(
1561
+ common.RenderWrapper,
1562
+ {
1563
+ control: agentActions,
1564
+ ctx: {
1565
+ message: message2,
1566
+ get dom() {
1567
+ return messageRefs.current[message2.id];
1568
+ }
1569
+ }
1570
+ }
1476
1571
  )
1477
1572
  ] }) })
1478
1573
  // ...(isHasTime
@@ -1481,26 +1576,28 @@ var BubbleListItems_default = ({ firstMessage = false, welcomeMessage = true, av
1481
1576
  };
1482
1577
  });
1483
1578
  }, [chatMessage?.message]);
1484
- const firstMessageRecord = react.useMemo(() => {
1485
- const isExist = common.shouldRender(firstMessage);
1486
- return isExist ? [
1487
- {
1488
- key: "firstMessage",
1489
- content: /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: firstMessage }),
1490
- placement: "end"
1579
+ const firstMessagesRecord = react.useMemo(() => {
1580
+ return (firstMessages || []).map((firstMessage, index) => {
1581
+ const { member, ...args } = firstMessage;
1582
+ return {
1583
+ key: `firstMessage-${index}`,
1584
+ placement: conversationRoles[member]?.placement,
1585
+ avatar: conversationRoles[member]?.avatar,
1491
1586
  // avatar: { style: { visibility: 'hidden' } }
1492
- }
1493
- ] : [];
1494
- }, [firstMessage]);
1587
+ variant: "borderless",
1588
+ ...args
1589
+ };
1590
+ });
1591
+ }, [firstMessages]);
1495
1592
  const bubbleListItems = react.useMemo(() => {
1496
1593
  const list = [];
1497
- list.push(...firstMessageRecord);
1594
+ list.push(...firstMessagesRecord);
1498
1595
  list.push(...chatRecords, ...questionList);
1499
1596
  if (list.length) {
1500
1597
  return list;
1501
1598
  }
1502
1599
  return [...welcomeMessageRecord];
1503
- }, [chatRecords, questionList, welcomeMessageRecord, firstMessageRecord]);
1600
+ }, [chatRecords, questionList, welcomeMessageRecord, firstMessagesRecord]);
1504
1601
  const listRef = react.useRef(null);
1505
1602
  const autoScrollRef = react.useRef(true);
1506
1603
  const handleScroll = (el) => {
@@ -1531,7 +1628,7 @@ var BubbleListItems_default = ({ firstMessage = false, welcomeMessage = true, av
1531
1628
  autoScroll: false,
1532
1629
  ref: listRef,
1533
1630
  items: bubbleListItems,
1534
- className: classNames9__default.default(styles_module_default3.nsBubbleList, "height-full", "scroll-fade-in", "zero-chat-bubbles"),
1631
+ className: classNames11__default.default(styles_module_default3.nsBubbleList, "height-full", "scroll-fade-in", "zero-chat-bubbles"),
1535
1632
  onScroll: handleScroll
1536
1633
  },
1537
1634
  conversationState.active.id
@@ -1566,7 +1663,7 @@ var CharacterList_default = () => {
1566
1663
  /* @__PURE__ */ jsxRuntime.jsx(
1567
1664
  antd.Avatar,
1568
1665
  {
1569
- className: classNames9__default.default(styles_module_default3.nsAvatarListItemIcon, "cursor-pointer", {
1666
+ className: classNames11__default.default(styles_module_default3.nsAvatarListItemIcon, "cursor-pointer", {
1570
1667
  [styles_module_default3.nsAvatarListItemIconActive]: activeCharacter.id === item.id
1571
1668
  }),
1572
1669
  size: 50,
@@ -1662,7 +1759,7 @@ var ChatHeader_default = ({
1662
1759
  const chatStore = useChatStore();
1663
1760
  const receiverState = valtio.useSnapshot(chatStore.receiver);
1664
1761
  const configState = valtio.useSnapshot(chatStore.config);
1665
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { justify: "space-between", align: "center", className: classNames9__default.default(styles_module_default3.nsChatHeader, "zero-chat-header"), children: [
1762
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { justify: "space-between", align: "center", className: classNames11__default.default(styles_module_default3.nsChatHeader, "zero-chat-header"), children: [
1666
1763
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 4, align: "center", children: [
1667
1764
  /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: avatar, DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(antd.Avatar, { size: 22, src: receiverState.active.logo, alt: receiverState.active.name }) }),
1668
1765
  /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: title, DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default3.nsChatTitle, children: receiverState.active.name }) }),
@@ -1940,6 +2037,396 @@ var ChatSender_default = react.forwardRef(
1940
2037
  // src/ui/common/ChatSender.tsx
1941
2038
  init_Context();
1942
2039
 
2040
+ // src/ui/common/FeaturesRenderer.tsx
2041
+ init_Context();
2042
+
2043
+ // src/ui/common/QuickAsk/QuickAskPanel.tsx
2044
+ init_Context();
2045
+
2046
+ // src/ui/common/QuickAsk/QuickAskEditModal.tsx
2047
+ init_Context();
2048
+ var QuickAskEditModal_default = ({ open, onCancel, loading, onConfirm, initialValues, categories = [] }) => {
2049
+ const [form] = antd.Form.useForm();
2050
+ const chatStore = useChatStore();
2051
+ const configState = valtio.useSnapshot(chatStore.config);
2052
+ const [promptLoading, setPromptLoading] = react.useState(false);
2053
+ const [description, setDescription] = react.useState("");
2054
+ const handleOk = async () => {
2055
+ try {
2056
+ const values = await form.validateFields();
2057
+ if (values) {
2058
+ onConfirm(values);
2059
+ }
2060
+ } catch (error) {
2061
+ console.error("Validation failed:", error);
2062
+ }
2063
+ };
2064
+ const handleGenerate = async () => {
2065
+ if (!description.trim()) return;
2066
+ setPromptLoading(true);
2067
+ try {
2068
+ const res = await configState.services.request?.labelItemPromptAssistant?.(description);
2069
+ if (res.data) {
2070
+ form.setFieldsValue({
2071
+ title: res.data.title,
2072
+ labelName: res.data.labelName,
2073
+ content: res.data.content
2074
+ });
2075
+ }
2076
+ } finally {
2077
+ setPromptLoading(false);
2078
+ }
2079
+ };
2080
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2081
+ antd.Modal,
2082
+ {
2083
+ title: initialValues?.id ? "\u7F16\u8F91\u5FEB\u901F\u63D0\u95EE" : "\u65B0\u589E\u5FEB\u901F\u63D0\u95EE",
2084
+ open,
2085
+ onCancel,
2086
+ onOk: handleOk,
2087
+ width: 600,
2088
+ okText: "\u786E\u5B9A",
2089
+ okButtonProps: {
2090
+ loading
2091
+ },
2092
+ cancelText: "\u53D6\u6D88",
2093
+ children: [
2094
+ /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, gap: 4, children: [
2095
+ /* @__PURE__ */ jsxRuntime.jsx(
2096
+ antd.Input.TextArea,
2097
+ {
2098
+ rows: 4,
2099
+ placeholder: "\u8BF7\u8F93\u5165\u95EE\u9898\u63CF\u8FF0\uFF0C\u7F57\u62C9\u63D0\u793A\u8BCD\u52A9\u624B\u5C06\u5E2E\u60A8\u751F\u6210\u95EE\u9898\u540D\u79F0\uFF0C\u5206\u7C7B\u548C\u5185\u5BB9\u3002",
2100
+ value: description,
2101
+ onChange: (e) => setDescription(e.target.value),
2102
+ disabled: promptLoading
2103
+ }
2104
+ ),
2105
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { justify: "end", children: /* @__PURE__ */ jsxRuntime.jsx(
2106
+ antd.Button,
2107
+ {
2108
+ type: "primary",
2109
+ size: "small",
2110
+ icon: /* @__PURE__ */ jsxRuntime.jsx(icons.SignatureOutlined, {}),
2111
+ onClick: handleGenerate,
2112
+ loading: promptLoading,
2113
+ disabled: !description.trim(),
2114
+ children: "\u7F57\u62C9\u63D0\u793A\u8BCD\u52A9\u624B"
2115
+ }
2116
+ ) })
2117
+ ] }),
2118
+ /* @__PURE__ */ jsxRuntime.jsxs(antd.Form, { form, layout: "vertical", initialValues, children: [
2119
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { label: "\u95EE\u9898ID", name: "id", hidden: true, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Input, { disabled: true }) }),
2120
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { label: "\u95EE\u9898\u540D\u79F0", name: "title", rules: [{ required: true, message: "\u8BF7\u8F93\u5165\u95EE\u9898\u540D\u79F0" }], children: /* @__PURE__ */ jsxRuntime.jsx(antd.Input, { placeholder: "\u8BF7\u8F93\u5165\u95EE\u9898\u540D\u79F0" }) }),
2121
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { label: "\u95EE\u9898\u5206\u7C7B", name: "labelName", rules: [{ required: true, message: "\u8BF7\u9009\u62E9\u6216\u8F93\u5165\u95EE\u9898\u5206\u7C7B" }], children: /* @__PURE__ */ jsxRuntime.jsx(
2122
+ antd.AutoComplete,
2123
+ {
2124
+ fieldNames: { value: "labelName" },
2125
+ placeholder: "\u8BF7\u9009\u62E9\u95EE\u9898\u5206\u7C7B\u6216\u8F93\u5165\u65B0\u7684\u5206\u7C7B",
2126
+ options: categories
2127
+ }
2128
+ ) }),
2129
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { label: "\u95EE\u9898\u5185\u5BB9", name: "content", rules: [{ required: true, message: "\u8BF7\u8F93\u5165\u5177\u4F53\u63D0\u95EE\u5185\u5BB9" }], children: /* @__PURE__ */ jsxRuntime.jsx(antd.Input.TextArea, { placeholder: "\u8BF7\u8F93\u5165\u5177\u4F53\u63D0\u95EE\u5185\u5BB9\uFF0C\u5982\uFF1A\u5E2E\u6211\u6269\u5199\u4E00\u4EFD\u8BC1\u636E\u8BF4\u660E", rows: 6 }) })
2130
+ ] })
2131
+ ]
2132
+ }
2133
+ );
2134
+ };
2135
+
2136
+ // src/ui/common/QuickAsk/styles.module.less
2137
+ var styles_module_default4 = {
2138
+ quickAskPanel: "styles_module_quickAskPanel",
2139
+ tagContainer: "styles_module_tagContainer",
2140
+ quickAskItem: "styles_module_quickAskItem",
2141
+ quickAskItemHeader: "styles_module_quickAskItemHeader",
2142
+ quickAskItemBody: "styles_module_quickAskItemBody"
2143
+ };
2144
+ var QuickAskPanel_default = () => {
2145
+ const { message: message2 } = antd.App.useApp();
2146
+ const chatStore = useChatStore();
2147
+ const configState = valtio.useSnapshot(chatStore.config);
2148
+ const receiverState = valtio.useSnapshot(chatStore.receiver);
2149
+ const [searchText, setSearchText, getSearchText] = common.useRefState("");
2150
+ const [searchExpanded, setSearchExpanded] = react.useState(false);
2151
+ const [activeTab, setActiveTab, getActiveTab] = common.useRefState({});
2152
+ const [categories, setCategories] = react.useState([]);
2153
+ const [items, setItems] = react.useState([]);
2154
+ const [editModalOpen, setEditModalOpen] = react.useState(false);
2155
+ const [editingItem, setEditingItem] = react.useState();
2156
+ const fetchCategories = async () => {
2157
+ try {
2158
+ const res = await configState.services.request?.labelsQuery?.(receiverState.active?.id, { pageNo: 1, pageSize: 1e3 });
2159
+ if (res?.data) {
2160
+ setCategories(res.data?.items);
2161
+ }
2162
+ } catch (err) {
2163
+ }
2164
+ };
2165
+ const fetchItems = common.useDebounce(async () => {
2166
+ try {
2167
+ const res = await configState.services.request?.labelItemsQuery?.(receiverState.active?.id, {
2168
+ labelId: getActiveTab().id,
2169
+ keyword: getSearchText()
2170
+ });
2171
+ if (res?.data) {
2172
+ setItems(res.data);
2173
+ }
2174
+ } catch (err) {
2175
+ }
2176
+ });
2177
+ react.useEffect(() => {
2178
+ if (receiverState.active?.id) {
2179
+ fetchCategories();
2180
+ fetchItems();
2181
+ }
2182
+ }, [receiverState.active?.id]);
2183
+ const [loading, setLoading] = react.useState(false);
2184
+ const handleEditConfirm = async (values) => {
2185
+ try {
2186
+ setLoading(true);
2187
+ await configState.services.request?.labelItemUpdate?.(receiverState.active?.id, values);
2188
+ setEditModalOpen(false);
2189
+ message2.success("\u4FDD\u5B58\u6210\u529F");
2190
+ if (!getActiveTab().id || values.labelName === getActiveTab().labelName) {
2191
+ fetchItems();
2192
+ }
2193
+ fetchCategories();
2194
+ } finally {
2195
+ setLoading(false);
2196
+ }
2197
+ };
2198
+ const handleDelete = async (id) => {
2199
+ try {
2200
+ await configState.services.request?.labelItemDelete?.(id);
2201
+ message2.success("\u5220\u9664\u6210\u529F");
2202
+ fetchItems();
2203
+ } catch (err) {
2204
+ }
2205
+ };
2206
+ const handleTop = async (item) => {
2207
+ try {
2208
+ await configState.services.request?.labelItemTop?.({
2209
+ id: item.id,
2210
+ isTop: item.isTop ? 0 : 1
2211
+ });
2212
+ message2.success(item.isTop ? "\u53D6\u6D88\u7F6E\u9876\u6210\u529F" : "\u7F6E\u9876\u6210\u529F");
2213
+ fetchItems();
2214
+ } catch (err) {
2215
+ }
2216
+ };
2217
+ return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: styles_module_default4.quickAskPanel, children: [
2218
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { justify: "space-between", align: "center", children: /* @__PURE__ */ jsxRuntime.jsx(antd.Typography.Title, { level: 5, children: "\u5FEB\u901F\u63D0\u95EE" }) }),
2219
+ /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, className: "m-b-16 m-t-16", children: [
2220
+ !searchExpanded && /* @__PURE__ */ jsxRuntime.jsx(
2221
+ antd.Button,
2222
+ {
2223
+ type: "dashed",
2224
+ block: true,
2225
+ icon: /* @__PURE__ */ jsxRuntime.jsx(icons.PlusOutlined, {}),
2226
+ className: "flex-1",
2227
+ onClick: () => {
2228
+ setEditingItem(null);
2229
+ setEditModalOpen(true);
2230
+ },
2231
+ children: "\u65B0\u589E\u5FEB\u901F\u63D0\u95EE"
2232
+ }
2233
+ ),
2234
+ searchExpanded ? /* @__PURE__ */ jsxRuntime.jsx(
2235
+ antd.Input,
2236
+ {
2237
+ autoFocus: true,
2238
+ placeholder: "\u8F93\u5165\u95EE\u9898\u540D\u79F0\u6216\u5185\u5BB9\u68C0\u7D22",
2239
+ prefix: /* @__PURE__ */ jsxRuntime.jsx(icons.SearchOutlined, {}),
2240
+ value: searchText,
2241
+ onChange: (e) => {
2242
+ setSearchText(e.target.value);
2243
+ fetchItems();
2244
+ },
2245
+ className: "flex-1",
2246
+ allowClear: true,
2247
+ onBlur: () => setSearchExpanded(false)
2248
+ }
2249
+ ) : /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { icon: /* @__PURE__ */ jsxRuntime.jsx(icons.SearchOutlined, {}), onClick: () => setSearchExpanded(true) })
2250
+ ] }),
2251
+ /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { align: "center", className: classNames11__default.default("scroll-fade-in", "m-b-16", styles_module_default4.tagContainer), children: [
2252
+ /* @__PURE__ */ jsxRuntime.jsx(
2253
+ antd.Tag,
2254
+ {
2255
+ color: !activeTab.id ? "processing" : "default",
2256
+ className: "cursor-pointer",
2257
+ bordered: false,
2258
+ onClick: () => {
2259
+ setActiveTab({});
2260
+ fetchItems();
2261
+ },
2262
+ children: "\u5168\u90E8"
2263
+ }
2264
+ ),
2265
+ categories.map((c) => /* @__PURE__ */ jsxRuntime.jsx(
2266
+ antd.Tag,
2267
+ {
2268
+ color: activeTab.id === c.id ? "processing" : "default",
2269
+ className: "cursor-pointer",
2270
+ bordered: false,
2271
+ onClick: () => {
2272
+ setActiveTab(c);
2273
+ fetchItems();
2274
+ },
2275
+ children: c.labelName
2276
+ },
2277
+ c.id
2278
+ ))
2279
+ ] }),
2280
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { vertical: true, className: "flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { vertical: true, gap: 8, className: "height-full scroll-fade-in", children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(
2281
+ "div",
2282
+ {
2283
+ className: styles_module_default4.quickAskItem,
2284
+ onClick: () => {
2285
+ chatStore.setContent(item.content);
2286
+ chatStore.setContentParams({
2287
+ use_template: 1
2288
+ });
2289
+ },
2290
+ children: [
2291
+ /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, justify: "space-between", className: styles_module_default4.quickAskItemHeader, children: [
2292
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 text-ellipsis", children: item.title }),
2293
+ /* @__PURE__ */ jsxRuntime.jsxs(antd.Space, { size: 4, children: [
2294
+ /* @__PURE__ */ jsxRuntime.jsx(
2295
+ antd.Button,
2296
+ {
2297
+ type: "primary",
2298
+ size: "small",
2299
+ icon: /* @__PURE__ */ jsxRuntime.jsx(icons.PushpinOutlined, { rotate: item.isTop ? -45 : 0 }),
2300
+ title: item.isTop ? "\u53D6\u6D88\u7F6E\u9876" : "\u7F6E\u9876",
2301
+ onClick: (e) => {
2302
+ e.stopPropagation();
2303
+ handleTop(item);
2304
+ }
2305
+ },
2306
+ "top"
2307
+ ),
2308
+ /* @__PURE__ */ jsxRuntime.jsx(
2309
+ antd.Button,
2310
+ {
2311
+ type: "primary",
2312
+ size: "small",
2313
+ icon: /* @__PURE__ */ jsxRuntime.jsx(icons.CopyOutlined, {}),
2314
+ title: "\u590D\u5236",
2315
+ onClick: (e) => {
2316
+ e.stopPropagation();
2317
+ handleEditConfirm({
2318
+ title: item.title,
2319
+ labelName: item.labelName,
2320
+ content: item.content
2321
+ });
2322
+ }
2323
+ },
2324
+ "copy"
2325
+ ),
2326
+ /* @__PURE__ */ jsxRuntime.jsx(
2327
+ antd.Button,
2328
+ {
2329
+ type: "primary",
2330
+ size: "small",
2331
+ icon: /* @__PURE__ */ jsxRuntime.jsx(icons.EditOutlined, {}),
2332
+ title: "\u7F16\u8F91",
2333
+ onClick: (e) => {
2334
+ e.stopPropagation();
2335
+ setEditingItem(item);
2336
+ setEditModalOpen(true);
2337
+ }
2338
+ },
2339
+ "edit"
2340
+ ),
2341
+ item.canDelete && /* @__PURE__ */ jsxRuntime.jsx(
2342
+ antd.Popconfirm,
2343
+ {
2344
+ title: "\u63D0\u793A",
2345
+ okText: "\u786E\u5B9A",
2346
+ cancelText: "\u53D6\u6D88",
2347
+ description: "\u786E\u8BA4\u5220\u9664\u95EE\u9898\u5417?",
2348
+ onConfirm: (e) => {
2349
+ e.stopPropagation();
2350
+ handleDelete(item.id);
2351
+ },
2352
+ children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "primary", size: "small", icon: /* @__PURE__ */ jsxRuntime.jsx(icons.DeleteOutlined, {}), title: "\u5220\u9664", onClick: (e) => e.stopPropagation() })
2353
+ },
2354
+ "delete"
2355
+ )
2356
+ ] })
2357
+ ] }),
2358
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames11__default.default(styles_module_default4.quickAskItemBody), children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ellipsis-3", children: item.content }) })
2359
+ ]
2360
+ },
2361
+ item.id
2362
+ )) }) }),
2363
+ editModalOpen && /* @__PURE__ */ jsxRuntime.jsx(
2364
+ QuickAskEditModal_default,
2365
+ {
2366
+ open: editModalOpen,
2367
+ onCancel: () => setEditModalOpen(false),
2368
+ onConfirm: handleEditConfirm,
2369
+ loading,
2370
+ initialValues: editingItem,
2371
+ categories
2372
+ }
2373
+ )
2374
+ ] });
2375
+ };
2376
+ var FeaturesRenderer_default = () => {
2377
+ const chatStore = useChatStore();
2378
+ const receiverState = valtio.useSnapshot(chatStore.receiver);
2379
+ const conversationState = valtio.useSnapshot(chatStore.conversation);
2380
+ const chatMessage = react.useMemo(
2381
+ () => conversationState.messages[conversationState.active.id] || {},
2382
+ [conversationState.messages[conversationState.active.id]]
2383
+ );
2384
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2385
+ receiverState.active.feature?.deepThink && /* @__PURE__ */ jsxRuntime.jsx(
2386
+ antd.Button,
2387
+ {
2388
+ size: "small",
2389
+ color: receiverState.params.thinkMode === "1" ? "primary" : "default",
2390
+ variant: "filled",
2391
+ onClick: () => chatStore.setReceiverParams({ thinkMode: receiverState.params.thinkMode === "1" ? "2" : "1" }),
2392
+ children: "\u6DF1\u5EA6\u601D\u8003"
2393
+ }
2394
+ ),
2395
+ receiverState.active.feature?.switchManual && /* @__PURE__ */ jsxRuntime.jsx(
2396
+ antd.Button,
2397
+ {
2398
+ size: "small",
2399
+ title: chatMessage?.speakHuman ? "\u5F53\u524D\u72B6\u6001\u4E3A\u4EBA\u5DE5\u6A21\u5F0F\u3002\u60A8\u53D1\u9001\u7684\u95EE\u9898\u5C06\u76F4\u63A5\u53D1\u9001\u7ED9\u4E13\u5BB6\uFF0C\u667A\u80FD\u52A9\u624B\u5C06\u4E0D\u518D\u56DE\u590D" : "\u5F53\u524D\u72B6\u6001\u4E3A\u667A\u80FD\u52A9\u624B\u6A21\u5F0F\u3002\u60A8\u53D1\u9001\u7684\u95EE\u9898\u5C06\u53D1\u9001\u7ED9\u667A\u80FD\u52A9\u624B\uFF0C\u667A\u80FD\u52A9\u624B\u5C06\u56DE\u590D\u60A8",
2400
+ shape: "round",
2401
+ icon: /* @__PURE__ */ jsxRuntime.jsx(icons.UserSwitchOutlined, {}),
2402
+ color: chatMessage?.speakHuman ? "primary" : "default",
2403
+ variant: "filled",
2404
+ onClick: () => {
2405
+ chatStore.setSpeakHuman?.(!chatMessage?.speakHuman);
2406
+ },
2407
+ children: "\u5411\u4E13\u5BB6\u54A8\u8BE2"
2408
+ }
2409
+ ),
2410
+ receiverState.active.feature?.quickAsk && /* @__PURE__ */ jsxRuntime.jsx(
2411
+ antd.Popover,
2412
+ {
2413
+ trigger: "click",
2414
+ placement: "topLeft",
2415
+ content: /* @__PURE__ */ jsxRuntime.jsx(QuickAskPanel_default, {}),
2416
+ children: /* @__PURE__ */ jsxRuntime.jsx(
2417
+ antd.Button,
2418
+ {
2419
+ size: "small",
2420
+ color: "primary",
2421
+ variant: "filled",
2422
+ children: "\u5FEB\u901F\u63D0\u95EE"
2423
+ }
2424
+ )
2425
+ }
2426
+ )
2427
+ ] });
2428
+ };
2429
+
1943
2430
  // src/ui/common/SenderPromptsItems.tsx
1944
2431
  init_Context();
1945
2432
  var SenderPromptsItems_default = () => {
@@ -1958,14 +2445,14 @@ var SenderPromptsItems_default = () => {
1958
2445
  split: false,
1959
2446
  className: styles_module_default3.nsSenderList,
1960
2447
  dataSource: question.items,
1961
- renderItem: (item) => /* @__PURE__ */ jsxRuntime.jsx(antd.List.Item, { onClick: () => chatStore.sendMessage(item.question), className: styles_module_default3.nsSenderListItem, children: item.question }),
2448
+ renderItem: (item) => /* @__PURE__ */ jsxRuntime.jsx(antd.List.Item, { onClick: () => chatStore.sendMessage(item.question), className: styles_module_default3.nsSenderListItem, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ellipsis", children: item.question }) }),
1962
2449
  footer: /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { justify: "end", className: styles_module_default3.nsSenderListFooter, children: "(\u60A8\u53EF\u70B9\u51FB\u4EE5\u4E0A\u95EE\u9898\u5F00\u542FAI\u4F53\u9A8C)" })
1963
2450
  }
1964
2451
  ),
1965
2452
  title: /* @__PURE__ */ jsxRuntime.jsx(
1966
2453
  "div",
1967
2454
  {
1968
- className: classNames9__default.default(styles_module_default3.nsSenderListTitle, "text-ellipsis"),
2455
+ className: classNames11__default.default(styles_module_default3.nsSenderListTitle, "text-ellipsis"),
1969
2456
  children: `${receiverState.active.name}\u5F00\u59CB\u5173\u6CE8${question.name}\u5185\u5BB9\uFF01`
1970
2457
  }
1971
2458
  ),
@@ -2023,31 +2510,7 @@ var ChatSender_default2 = react.forwardRef(
2023
2510
  sendBtnProps: common.isFunction(sendBtnProps) ? sendBtnProps() : {},
2024
2511
  extraFooterBelow: /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: footerBelow }),
2025
2512
  extraFooter: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2026
- receiverState.active.feature?.deepThink && /* @__PURE__ */ jsxRuntime.jsx(
2027
- antd.Button,
2028
- {
2029
- size: "small",
2030
- color: receiverState.params.thinkMode === "1" ? "primary" : "default",
2031
- variant: "filled",
2032
- onClick: () => chatStore.setReceiverParams({ thinkMode: receiverState.params.thinkMode === "1" ? "2" : "1" }),
2033
- children: "\u6DF1\u5EA6\u601D\u8003"
2034
- }
2035
- ),
2036
- receiverState.active.feature?.switchManual && /* @__PURE__ */ jsxRuntime.jsx(
2037
- antd.Button,
2038
- {
2039
- size: "small",
2040
- title: chatMessage?.speakHuman ? "\u5F53\u524D\u72B6\u6001\u4E3A\u4EBA\u5DE5\u6A21\u5F0F\u3002\u60A8\u53D1\u9001\u7684\u95EE\u9898\u5C06\u76F4\u63A5\u53D1\u9001\u7ED9\u4E13\u5BB6\uFF0C\u667A\u80FD\u52A9\u624B\u5C06\u4E0D\u518D\u56DE\u590D" : "\u5F53\u524D\u72B6\u6001\u4E3A\u667A\u80FD\u52A9\u624B\u6A21\u5F0F\u3002\u60A8\u53D1\u9001\u7684\u95EE\u9898\u5C06\u53D1\u9001\u7ED9\u667A\u80FD\u52A9\u624B\uFF0C\u667A\u80FD\u52A9\u624B\u5C06\u56DE\u590D\u60A8",
2041
- shape: "round",
2042
- icon: /* @__PURE__ */ jsxRuntime.jsx(icons.UserSwitchOutlined, {}),
2043
- color: chatMessage?.speakHuman ? "primary" : "default",
2044
- variant: "filled",
2045
- onClick: () => {
2046
- chatStore.setSpeakHuman?.(!chatMessage?.speakHuman);
2047
- },
2048
- children: "\u5411\u4E13\u5BB6\u54A8\u8BE2"
2049
- }
2050
- ),
2513
+ /* @__PURE__ */ jsxRuntime.jsx(FeaturesRenderer_default, {}),
2051
2514
  /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: extraBtn })
2052
2515
  ] }),
2053
2516
  extraHeader: /* @__PURE__ */ jsxRuntime.jsx(
@@ -2098,7 +2561,7 @@ var ConversationListHeader_default = () => {
2098
2561
  type: "primary",
2099
2562
  shape: "round",
2100
2563
  onClick: () => chatStore.createConversation(),
2101
- className: classNames9__default.default("m-t-16"),
2564
+ className: classNames11__default.default("m-t-16"),
2102
2565
  icon: /* @__PURE__ */ jsxRuntime.jsx(icons.PlusOutlined, {}),
2103
2566
  children: "\u65B0\u5EFA\u4F1A\u8BDD"
2104
2567
  }
@@ -2106,14 +2569,14 @@ var ConversationListHeader_default = () => {
2106
2569
  ] });
2107
2570
  };
2108
2571
  var ConversationListPanel_default = ({ header }) => {
2109
- return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames9__default.default("height-full", "zero-chat-conversations", styles_module_default3.nsConversationListPanel), children: [
2572
+ return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames11__default.default("height-full", "zero-chat-conversations", styles_module_default3.nsConversationListPanel), children: [
2110
2573
  /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: header, DefaultComponent: ConversationListHeader_default }),
2111
2574
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsxRuntime.jsx(ConversationList_default, {}) })
2112
2575
  ] });
2113
2576
  };
2114
2577
 
2115
2578
  // src/ui/layouts/styles.module.less
2116
- var styles_module_default4 = {
2579
+ var styles_module_default5 = {
2117
2580
  nsPreviewHeader: "styles_module_nsPreviewHeader",
2118
2581
  nsPreviewHeaderTitle: "styles_module_nsPreviewHeaderTitle",
2119
2582
  nsChatSenderHeader: "styles_module_nsChatSenderHeader",
@@ -2160,6 +2623,7 @@ var layouts_default = react.forwardRef(({ theme, params, userInfo, hooks, layout
2160
2623
  createConversation: chatStore.createConversation,
2161
2624
  setReferences: chatStore.setReferences,
2162
2625
  setMessage: chatStore.setContent,
2626
+ setMessageParams: chatStore.setContentParams,
2163
2627
  setFiles: chatStore.setFileList,
2164
2628
  setServices: chatStore.setServices,
2165
2629
  setParams: chatStore.setParams,
@@ -2198,7 +2662,7 @@ var layouts_default = react.forwardRef(({ theme, params, userInfo, hooks, layout
2198
2662
  react.useEffect(() => {
2199
2663
  configState.hooks?.onBeforeInit?.();
2200
2664
  }, []);
2201
- return /* @__PURE__ */ jsxRuntime.jsx(x.XProvider, { theme: { cssVar: true, ...theme }, children: /* @__PURE__ */ jsxRuntime.jsx(ChatProvider, { store: chatStore, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { spinning: receiverState.loading, wrapperClassName: "full-spin", children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames9__default.default(styles_module_default4.nsChatLayout, "zero-chat-layout", "height-full"), children: [
2665
+ return /* @__PURE__ */ jsxRuntime.jsx(x.XProvider, { theme: { cssVar: true, ...theme }, children: /* @__PURE__ */ jsxRuntime.jsx(ChatProvider, { store: chatStore, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { spinning: receiverState.loading, wrapperClassName: "full-spin", children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames11__default.default(styles_module_default5.nsChatLayout, "zero-chat-layout", "height-full"), children: [
2202
2666
  /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.globalHeader, DefaultComponent: ChatHeader_default }),
2203
2667
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { className: "full-scroll", children: [
2204
2668
  /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.leftPanel }),
@@ -2206,8 +2670,8 @@ var layouts_default = react.forwardRef(({ theme, params, userInfo, hooks, layout
2206
2670
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Splitter, { className: "flex-1", onResize: setSplitterSizes, children: [
2207
2671
  /* @__PURE__ */ jsxRuntime.jsx(antd.Splitter.Panel, { collapsible: false, min: 600, size: sizes[0], children: hasPreView && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2208
2672
  configState.preview.file.fileUrl && /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: "height-full", children: [
2209
- /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { justify: "space-between", align: "center", gap: 16, className: styles_module_default4.nsPreviewHeader, children: [
2210
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames9__default.default(styles_module_default4.nsPreviewHeaderTitle, "text-ellipsis"), title: configState.preview.file.fileName, children: configState.preview.file.fileName }),
2673
+ /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { justify: "space-between", align: "center", gap: 16, className: styles_module_default5.nsPreviewHeader, children: [
2674
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames11__default.default(styles_module_default5.nsPreviewHeaderTitle, "text-ellipsis"), title: configState.preview.file.fileName, children: configState.preview.file.fileName }),
2211
2675
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, justify: "center", align: "center", children: [
2212
2676
  /* @__PURE__ */ jsxRuntime.jsx(
2213
2677
  antd.Button,
@@ -2251,15 +2715,15 @@ var layouts_default = react.forwardRef(({ theme, params, userInfo, hooks, layout
2251
2715
  }
2252
2716
  )
2253
2717
  ] }) }),
2254
- /* @__PURE__ */ jsxRuntime.jsx(antd.Splitter.Panel, { collapsible: false, max: 800, min: 400, size: sizes[1], children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames9__default.default("height-full"), children: [
2718
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Splitter.Panel, { collapsible: false, max: 800, min: 400, size: sizes[1], children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames11__default.default("height-full"), children: [
2255
2719
  /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.chatHeader, DefaultComponent: ChatHeader_default }),
2256
- /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { vertical: true, className: classNames9__default.default("full-scroll"), children: /* @__PURE__ */ jsxRuntime.jsxs(
2720
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { vertical: true, className: classNames11__default.default("full-scroll"), children: /* @__PURE__ */ jsxRuntime.jsxs(
2257
2721
  antd.Flex,
2258
2722
  {
2259
2723
  justify: "center",
2260
2724
  vertical: true,
2261
2725
  gap: 24,
2262
- className: classNames9__default.default("height-full", styles_module_default4.nsChatBody, "zero-chat-body", styles_module_default4.nsBodyWidth),
2726
+ className: classNames11__default.default("height-full", styles_module_default5.nsChatBody, "zero-chat-body", styles_module_default5.nsBodyWidth),
2263
2727
  children: [
2264
2728
  common.shouldRender(configState.layout.messageList) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.messageList, DefaultComponent: BubbleListItems_default }) }),
2265
2729
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, gap: 8, children: [
@@ -2267,7 +2731,7 @@ var layouts_default = react.forwardRef(({ theme, params, userInfo, hooks, layout
2267
2731
  common.RenderWrapper,
2268
2732
  {
2269
2733
  control: configState.layout.senderHeader,
2270
- DefaultComponent: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles_module_default4.nsChatSenderHeader, children: [
2734
+ DefaultComponent: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles_module_default5.nsChatSenderHeader, children: [
2271
2735
  "\u6211\u662F ",
2272
2736
  receiverState.active.name
2273
2737
  ] })
@@ -2278,7 +2742,26 @@ var layouts_default = react.forwardRef(({ theme, params, userInfo, hooks, layout
2278
2742
  common.RenderWrapper,
2279
2743
  {
2280
2744
  control: configState.layout.disclaimerNotice,
2281
- DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default4.nsDisclaimerNotice, children: "\u5185\u5BB9\u7531AI\u751F\u6210\uFF0C\u4EC5\u4F9B\u53C2\u8003\uFF0C\u8BF7\u4ED4\u7EC6\u7504\u522B" })
2745
+ DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default5.nsDisclaimerNotice, children: "\u5185\u5BB9\u7531AI\u751F\u6210\uFF0C\u4EC5\u4F9B\u53C2\u8003\uFF0C\u8BF7\u4ED4\u7EC6\u7504\u522B" })
2746
+ }
2747
+ ),
2748
+ /* @__PURE__ */ jsxRuntime.jsx(
2749
+ common.RenderWrapper,
2750
+ {
2751
+ control: configState.layout.recommendQuestions,
2752
+ DefaultComponent: receiverState?.recommendQuestions?.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
2753
+ x.Prompts,
2754
+ {
2755
+ vertical: true,
2756
+ title: "\u63A8\u8350\u95EE\u9898:",
2757
+ onItemClick: ({ data }) => chatStore.sendMessage(data.key),
2758
+ items: receiverState?.recommendQuestions.map((question) => ({
2759
+ key: question,
2760
+ icon: /* @__PURE__ */ jsxRuntime.jsx(icons.FileSearchOutlined, {}),
2761
+ description: question
2762
+ }))
2763
+ }
2764
+ )
2282
2765
  }
2283
2766
  )
2284
2767
  ] }),