@zero-library/chat-agent 2.2.18 → 2.3.0

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
 
@@ -45,7 +45,10 @@ var init_styles_module = __esm({
45
45
  fileEditContent: "styles_module_fileEditContent",
46
46
  quoteList: "styles_module_quoteList",
47
47
  mdEdit: "styles_module_mdEdit",
48
- think: "styles_module_think"
48
+ think: "styles_module_think",
49
+ chart: "styles_module_chart",
50
+ chartSkeleton: "styles_module_chartSkeleton",
51
+ chartSkeletonIcon: "styles_module_chartSkeletonIcon"
49
52
  };
50
53
  }
51
54
  });
@@ -252,6 +255,77 @@ var init_Think = __esm({
252
255
  };
253
256
  }
254
257
  });
258
+
259
+ // src/ui/common/markdownAlert/Charts.tsx
260
+ var Charts_exports = {};
261
+ __export(Charts_exports, {
262
+ default: () => Charts_default
263
+ });
264
+ var chartTypes, CHART_COMPONENTS, Charts_default;
265
+ var init_Charts = __esm({
266
+ "src/ui/common/markdownAlert/Charts.tsx"() {
267
+ init_styles_module();
268
+ chartTypes = [
269
+ "Line",
270
+ "Column",
271
+ "Bar",
272
+ "Area",
273
+ "Pie",
274
+ "DualAxes",
275
+ "Scatter",
276
+ "WordCloud",
277
+ "Funnel",
278
+ "Heatmap",
279
+ "Histogram",
280
+ "Liquid",
281
+ "BidirectionalBar",
282
+ "Box",
283
+ "Bullet",
284
+ "CirclePacking",
285
+ "Gauge",
286
+ "Radar",
287
+ "Rose",
288
+ "Sankey",
289
+ "Stock",
290
+ "Sunburst",
291
+ "Treemap",
292
+ "Venn",
293
+ "Waterfall",
294
+ "MindMap",
295
+ "Fishbone",
296
+ "IndentedTree",
297
+ "Dendrogram",
298
+ "OrganizationChart",
299
+ "FlowGraph",
300
+ "FlowDirectionGraph",
301
+ "NetworkGraph"
302
+ // …如果还有其他图表也继续加
303
+ ];
304
+ CHART_COMPONENTS = Object.fromEntries(
305
+ chartTypes.map((type) => [
306
+ type,
307
+ () => import('@ant-design/charts').then((mod) => ({
308
+ default: mod[type]
309
+ }))
310
+ ])
311
+ );
312
+ Charts_default = ({ data, loading }) => {
313
+ const { type, config } = data;
314
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames11__default.default(styles_module_default.chart, "scroll-fade-in"), children: loading ? (
315
+ // Antd 骨架屏
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
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
318
+ common.LazyComponent,
319
+ {
320
+ type,
321
+ ...config,
322
+ customComponents: CHART_COMPONENTS,
323
+ unknownContent: /* @__PURE__ */ jsxRuntime.jsx(antd.Alert, { message: "\u4E0D\u652F\u6301\u7684\u56FE\u8868", description: `\u5F53\u524D\u56FE\u8868\u7C7B\u578B "${type}" \u6682\u672A\u5B9E\u73B0\uFF0C\u8BF7\u68C0\u67E5\u56FE\u8868\u7C7B\u578B\u662F\u5426\u6B63\u786E\u3002`, type: "warning", showIcon: true })
324
+ }
325
+ ) });
326
+ };
327
+ }
328
+ });
255
329
  var userInfoManager = common.createSecureManager({
256
330
  key: "NS-USER",
257
331
  aesKey: "((#II))"
@@ -341,6 +415,27 @@ var createChatService = (request) => {
341
415
  const fileUpload = (formData) => {
342
416
  return request.post("/lolr/storage/upload", formData, { timeout: 5 * 60 * 1e3 });
343
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
+ };
344
439
  return {
345
440
  conversationsQuery,
346
441
  conversationCreate,
@@ -358,12 +453,19 @@ var createChatService = (request) => {
358
453
  agentInfoQuery,
359
454
  agentCharacterQuery,
360
455
  agentCharacterSelect,
361
- fileUpload
456
+ fileUpload,
457
+ labelItemUpdate,
458
+ labelItemDelete,
459
+ labelsQuery,
460
+ labelItemsQuery,
461
+ labelItemTop,
462
+ labelItemPromptAssistant,
463
+ recommendQuestionsQuery
362
464
  };
363
465
  };
364
466
  var createFileService = (request) => {
365
467
  const docQuery = (paramsStr) => {
366
- return request.get(`/uc/doc?${paramsStr}`);
468
+ return request.get(`/lolr/doc?${paramsStr}`);
367
469
  };
368
470
  const fileCreate = async (fileContent, fileName, targetFormat = "docx") => {
369
471
  const blob = await request.post(`/uc/doc/convert`, { fileContent, fileName, targetFormat }, { responseType: "blob" });
@@ -382,20 +484,19 @@ var defaultAgentLayout = {
382
484
  conversationList: true,
383
485
  preview: true,
384
486
  messageList: true,
385
- firstMessage: false,
386
487
  senderHeader: false,
387
488
  sender: true,
388
489
  senderFooter: false,
389
490
  globalHeader: false,
390
491
  chatHeader: true,
391
- disclaimerNotice: true
492
+ disclaimerNotice: true,
493
+ recommendQuestions: false
392
494
  };
393
495
  var defaultExpertLayout = {
394
496
  leftPanel: false,
395
497
  conversationList: false,
396
498
  preview: false,
397
499
  messageList: true,
398
- firstMessage: false,
399
500
  senderHeader: false,
400
501
  sender: {
401
502
  props: {
@@ -411,7 +512,8 @@ var defaultExpertLayout = {
411
512
  conversationListBtn: false
412
513
  }
413
514
  },
414
- disclaimerNotice: false
515
+ disclaimerNotice: false,
516
+ recommendQuestions: false
415
517
  };
416
518
  function createChatStore() {
417
519
  const config = valtio.proxy({
@@ -505,6 +607,8 @@ function createChatStore() {
505
607
  const receiver = valtio.proxy({
506
608
  /** 当前激活的接收者信息(智能体或专家) */
507
609
  active: {},
610
+ /** 智能体推荐问题列表 */
611
+ recommendQuestions: [],
508
612
  /** 接收者加载状态 */
509
613
  loading: false,
510
614
  /** 接收者透传参数,后期可能扩展不透传参数 */
@@ -545,9 +649,6 @@ function createChatStore() {
545
649
  });
546
650
  receiver.active.type = 3;
547
651
  setReceiverParams();
548
- if (receiver.active.feature?.deepThink) {
549
- setReceiverParams({ thinkMode: "2" });
550
- }
551
652
  config.hooks?.onAfterSwitchAgent?.(data);
552
653
  } catch (error) {
553
654
  console.error(error);
@@ -700,6 +801,9 @@ function createChatStore() {
700
801
  const setContent = (content) => {
701
802
  conversation.messages[conversation.active.id].content = content;
702
803
  };
804
+ const setContentParams = (params) => {
805
+ conversation.messages[conversation.active.id].params = params;
806
+ };
703
807
  const setFileList = (files = []) => {
704
808
  conversation.messages[conversation.active.id].files = files;
705
809
  };
@@ -722,6 +826,17 @@ function createChatStore() {
722
826
  if (lastMessage.id !== messageId) return;
723
827
  conversation.messages[conversationId].questionList = data;
724
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
+ };
725
840
  const feedback = async (conversationId, messageId, msgFeedback, index) => {
726
841
  try {
727
842
  conversation.feedback.loading = true;
@@ -811,6 +926,7 @@ function createChatStore() {
811
926
  throw new Error("\u64CD\u4F5C\u88AB\u963B\u6B62");
812
927
  }
813
928
  await initConversation(conversationId);
929
+ receiver.recommendQuestions = [];
814
930
  await setPreview();
815
931
  config.hooks?.onAfterSwitchConversation?.(conversationId);
816
932
  try {
@@ -839,6 +955,7 @@ function createChatStore() {
839
955
  });
840
956
  conversation.messages[conversationId].message = data.items;
841
957
  }
958
+ getRecommendQuestions(conversationId);
842
959
  config.hooks?.onAfterInitMessages?.(conversation.messages[conversationId].message);
843
960
  config.hooks?.onAfterInit?.();
844
961
  };
@@ -883,10 +1000,11 @@ function createChatStore() {
883
1000
  stream: true
884
1001
  };
885
1002
  const extraParams = common.deepCopy(config.params.params || {});
886
- Object.assign(extraParams, receiver.params, message2 ? {} : references?.params, params);
1003
+ Object.assign(extraParams, receiver.params, message2 ? {} : { ...references?.params, ...conversation.messages[conversationId].params }, params);
887
1004
  sendParams.params = JSON.stringify(extraParams);
888
1005
  if (!message2) {
889
1006
  setContent("");
1007
+ setContentParams();
890
1008
  setFileList([]);
891
1009
  setReferences();
892
1010
  setHeaderOpen(false);
@@ -1053,6 +1171,8 @@ function createChatStore() {
1053
1171
  setReferences,
1054
1172
  /** 设置消息内容 */
1055
1173
  setContent,
1174
+ /** 设置内容参数,透传大模型后清空 */
1175
+ setContentParams,
1056
1176
  /** 设置文件列表 */
1057
1177
  setFileList,
1058
1178
  /** 设置头部展开状态 */
@@ -1085,7 +1205,8 @@ var customComponents = {
1085
1205
  mdEdit: () => Promise.resolve().then(() => (init_MdEdit(), MdEdit_exports)),
1086
1206
  fileEdit: () => Promise.resolve().then(() => (init_FileEdit(), FileEdit_exports)),
1087
1207
  // quoteList: () => import('./QuoteList'),
1088
- think: () => Promise.resolve().then(() => (init_Think(), Think_exports))
1208
+ think: () => Promise.resolve().then(() => (init_Think(), Think_exports)),
1209
+ charts: () => Promise.resolve().then(() => (init_Charts(), Charts_exports))
1089
1210
  };
1090
1211
 
1091
1212
  // src/components/styles.module.less
@@ -1097,7 +1218,7 @@ var styles_module_default2 = {
1097
1218
  quoteTooltip: "styles_module_quoteTooltip",
1098
1219
  quoteTooltipContainer: "styles_module_quoteTooltipContainer"
1099
1220
  };
1100
- var MessageRender_default = ({ message: message2, placement, onFilePreview }) => {
1221
+ var MessageRender_default = ({ message: message2, placement, onFilePreview, customComponents: propsCustomComponents }) => {
1101
1222
  const msgContent = react.useMemo(
1102
1223
  () => `${message2.msgContent || ""}${message2.msgContent && message2.tempContent ? "\n\n" : ""}${message2.tempContent || ""}`,
1103
1224
  [message2.msgContent, message2.tempContent]
@@ -1130,13 +1251,16 @@ var MessageRender_default = ({ message: message2, placement, onFilePreview }) =>
1130
1251
  onFilePreview?.(file);
1131
1252
  }
1132
1253
  };
1254
+ const mergedCustomComponents = react.useMemo(() => {
1255
+ return { ...customComponents, ...propsCustomComponents };
1256
+ }, [propsCustomComponents]);
1133
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: [
1134
1258
  msgContent && /* @__PURE__ */ jsxRuntime.jsx(
1135
1259
  x.Bubble,
1136
1260
  {
1137
1261
  placement,
1138
- className: classNames9__default.default({ [styles_module_default2.loadingMessage]: message2.type }),
1139
- 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 })
1140
1264
  }
1141
1265
  ),
1142
1266
  message2.msgFiles?.map((file) => /* @__PURE__ */ jsxRuntime.jsx(
@@ -1237,7 +1361,7 @@ var WelcomeItem_default = ({ icon = true, title = true, description = true, prom
1237
1361
  /* @__PURE__ */ jsxRuntime.jsx(
1238
1362
  x.Welcome,
1239
1363
  {
1240
- className: classNames9__default.default(styles_module_default3.chatWelcome, "p-t-32"),
1364
+ className: classNames11__default.default(styles_module_default3.chatWelcome, "p-t-32"),
1241
1365
  variant: "borderless",
1242
1366
  icon: /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: icon, DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(antd.Avatar, { shape: "square", size: 58, src: receiverState.active.logo }) }),
1243
1367
  title: /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: title, DefaultComponent: `\u4F60\u597D\uFF0C\u6211\u662F${receiverState.active.name || ""}` }),
@@ -1250,22 +1374,23 @@ var WelcomeItem_default = ({ icon = true, title = true, description = true, prom
1250
1374
  )
1251
1375
  }
1252
1376
  ),
1253
- receiverState.active.config?.recommendQuestions?.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
1377
+ /* @__PURE__ */ jsxRuntime.jsx(
1254
1378
  common.RenderWrapper,
1255
1379
  {
1256
1380
  control: prompts,
1257
- DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(
1381
+ DefaultComponent: receiverState?.recommendQuestions?.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
1258
1382
  x.Prompts,
1259
1383
  {
1260
1384
  className: "m-t-16",
1261
1385
  wrap: true,
1386
+ onItemClick: ({ data }) => chatStore.sendMessage(data.key),
1262
1387
  items: [
1263
1388
  {
1264
1389
  key: "1",
1265
1390
  label: "\u{1F914} \u63A8\u8350\u95EE\u9898:",
1266
- children: receiverState.active.config.recommendQuestions.map(({ question }) => ({
1391
+ children: receiverState?.recommendQuestions.map((question) => ({
1267
1392
  key: question,
1268
- 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 })
1269
1394
  }))
1270
1395
  }
1271
1396
  ]
@@ -1275,7 +1400,13 @@ var WelcomeItem_default = ({ icon = true, title = true, description = true, prom
1275
1400
  )
1276
1401
  ] });
1277
1402
  };
1278
- 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
+ }) => {
1279
1410
  const chatStore = useChatStore();
1280
1411
  const receiverState = valtio.useSnapshot(chatStore.receiver);
1281
1412
  const conversationState = valtio.useSnapshot(chatStore.conversation);
@@ -1358,6 +1489,7 @@ var BubbleListItems_default = ({ firstMessage = false, welcomeMessage = true, av
1358
1489
  const roleKey = Object.keys(conversationRoles).find((key) => conversationRoles[key].id === sender.id);
1359
1490
  return conversationRoles[roleKey] || {};
1360
1491
  };
1492
+ const messageRefs = react.useRef({});
1361
1493
  const chatRecords = react.useMemo(() => {
1362
1494
  return (chatMessage?.message || []).map((message2, index) => {
1363
1495
  const role = getRole(message2.sender);
@@ -1367,19 +1499,42 @@ var BubbleListItems_default = ({ firstMessage = false, welcomeMessage = true, av
1367
1499
  variant: "borderless",
1368
1500
  avatar: role.avatar,
1369
1501
  content: /* @__PURE__ */ jsxRuntime.jsx(
1370
- MessageRender_default,
1502
+ "div",
1371
1503
  {
1372
- message: message2,
1373
- placement: role.placement,
1374
- onFilePreview: (file) => chatStore.setPreview({
1375
- fileUrl: file.content,
1376
- suffix: file.extension,
1377
- fileName: file.name
1378
- })
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
+ )
1379
1520
  }
1380
1521
  ),
1381
1522
  footer: /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { children: role.user === "agent" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1382
- /* @__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
+ ),
1383
1538
  /* @__PURE__ */ jsxRuntime.jsx(
1384
1539
  antd.Button,
1385
1540
  {
@@ -1401,6 +1556,18 @@ var BubbleListItems_default = ({ firstMessage = false, welcomeMessage = true, av
1401
1556
  icon: /* @__PURE__ */ jsxRuntime.jsx(icons.DislikeOutlined, {}),
1402
1557
  onClick: () => chatStore.feedback(conversationState.active.id, message2.id, 2, index)
1403
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
+ }
1404
1571
  )
1405
1572
  ] }) })
1406
1573
  // ...(isHasTime
@@ -1409,26 +1576,28 @@ var BubbleListItems_default = ({ firstMessage = false, welcomeMessage = true, av
1409
1576
  };
1410
1577
  });
1411
1578
  }, [chatMessage?.message]);
1412
- const firstMessageRecord = react.useMemo(() => {
1413
- const isExist = common.shouldRender(firstMessage);
1414
- return isExist ? [
1415
- {
1416
- key: "firstMessage",
1417
- content: /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: firstMessage }),
1418
- 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,
1419
1586
  // avatar: { style: { visibility: 'hidden' } }
1420
- }
1421
- ] : [];
1422
- }, [firstMessage]);
1587
+ variant: "borderless",
1588
+ ...args
1589
+ };
1590
+ });
1591
+ }, [firstMessages]);
1423
1592
  const bubbleListItems = react.useMemo(() => {
1424
1593
  const list = [];
1425
- list.push(...firstMessageRecord);
1594
+ list.push(...firstMessagesRecord);
1426
1595
  list.push(...chatRecords, ...questionList);
1427
1596
  if (list.length) {
1428
1597
  return list;
1429
1598
  }
1430
1599
  return [...welcomeMessageRecord];
1431
- }, [chatRecords, questionList, welcomeMessageRecord, firstMessageRecord]);
1600
+ }, [chatRecords, questionList, welcomeMessageRecord, firstMessagesRecord]);
1432
1601
  const listRef = react.useRef(null);
1433
1602
  const autoScrollRef = react.useRef(true);
1434
1603
  const handleScroll = (el) => {
@@ -1459,7 +1628,7 @@ var BubbleListItems_default = ({ firstMessage = false, welcomeMessage = true, av
1459
1628
  autoScroll: false,
1460
1629
  ref: listRef,
1461
1630
  items: bubbleListItems,
1462
- 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"),
1463
1632
  onScroll: handleScroll
1464
1633
  },
1465
1634
  conversationState.active.id
@@ -1494,7 +1663,7 @@ var CharacterList_default = () => {
1494
1663
  /* @__PURE__ */ jsxRuntime.jsx(
1495
1664
  antd.Avatar,
1496
1665
  {
1497
- className: classNames9__default.default(styles_module_default3.nsAvatarListItemIcon, "cursor-pointer", {
1666
+ className: classNames11__default.default(styles_module_default3.nsAvatarListItemIcon, "cursor-pointer", {
1498
1667
  [styles_module_default3.nsAvatarListItemIconActive]: activeCharacter.id === item.id
1499
1668
  }),
1500
1669
  size: 50,
@@ -1590,7 +1759,7 @@ var ChatHeader_default = ({
1590
1759
  const chatStore = useChatStore();
1591
1760
  const receiverState = valtio.useSnapshot(chatStore.receiver);
1592
1761
  const configState = valtio.useSnapshot(chatStore.config);
1593
- 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: [
1594
1763
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 4, align: "center", children: [
1595
1764
  /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: avatar, DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(antd.Avatar, { size: 22, src: receiverState.active.logo, alt: receiverState.active.name }) }),
1596
1765
  /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: title, DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default3.nsChatTitle, children: receiverState.active.name }) }),
@@ -1868,6 +2037,396 @@ var ChatSender_default = react.forwardRef(
1868
2037
  // src/ui/common/ChatSender.tsx
1869
2038
  init_Context();
1870
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
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
+ /* @__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
+
1871
2430
  // src/ui/common/SenderPromptsItems.tsx
1872
2431
  init_Context();
1873
2432
  var SenderPromptsItems_default = () => {
@@ -1886,14 +2445,14 @@ var SenderPromptsItems_default = () => {
1886
2445
  split: false,
1887
2446
  className: styles_module_default3.nsSenderList,
1888
2447
  dataSource: question.items,
1889
- 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 }) }),
1890
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)" })
1891
2450
  }
1892
2451
  ),
1893
2452
  title: /* @__PURE__ */ jsxRuntime.jsx(
1894
2453
  "div",
1895
2454
  {
1896
- className: classNames9__default.default(styles_module_default3.nsSenderListTitle, "text-ellipsis"),
2455
+ className: classNames11__default.default(styles_module_default3.nsSenderListTitle, "text-ellipsis"),
1897
2456
  children: `${receiverState.active.name}\u5F00\u59CB\u5173\u6CE8${question.name}\u5185\u5BB9\uFF01`
1898
2457
  }
1899
2458
  ),
@@ -1951,31 +2510,7 @@ var ChatSender_default2 = react.forwardRef(
1951
2510
  sendBtnProps: common.isFunction(sendBtnProps) ? sendBtnProps() : {},
1952
2511
  extraFooterBelow: /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: footerBelow }),
1953
2512
  extraFooter: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1954
- receiverState.active.feature?.deepThink && /* @__PURE__ */ jsxRuntime.jsx(
1955
- antd.Button,
1956
- {
1957
- size: "small",
1958
- color: receiverState.params.thinkMode === "1" ? "primary" : "default",
1959
- variant: "filled",
1960
- onClick: () => chatStore.setReceiverParams({ thinkMode: receiverState.params.thinkMode === "1" ? "2" : "1" }),
1961
- children: "\u6DF1\u5EA6\u601D\u8003"
1962
- }
1963
- ),
1964
- receiverState.active.feature?.switchManual && /* @__PURE__ */ jsxRuntime.jsx(
1965
- antd.Button,
1966
- {
1967
- size: "small",
1968
- 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",
1969
- shape: "round",
1970
- icon: /* @__PURE__ */ jsxRuntime.jsx(icons.UserSwitchOutlined, {}),
1971
- color: chatMessage?.speakHuman ? "primary" : "default",
1972
- variant: "filled",
1973
- onClick: () => {
1974
- chatStore.setSpeakHuman?.(!chatMessage?.speakHuman);
1975
- },
1976
- children: "\u5411\u4E13\u5BB6\u54A8\u8BE2"
1977
- }
1978
- ),
2513
+ /* @__PURE__ */ jsxRuntime.jsx(FeaturesRenderer_default, {}),
1979
2514
  /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: extraBtn })
1980
2515
  ] }),
1981
2516
  extraHeader: /* @__PURE__ */ jsxRuntime.jsx(
@@ -2026,7 +2561,7 @@ var ConversationListHeader_default = () => {
2026
2561
  type: "primary",
2027
2562
  shape: "round",
2028
2563
  onClick: () => chatStore.createConversation(),
2029
- className: classNames9__default.default("m-t-16"),
2564
+ className: classNames11__default.default("m-t-16"),
2030
2565
  icon: /* @__PURE__ */ jsxRuntime.jsx(icons.PlusOutlined, {}),
2031
2566
  children: "\u65B0\u5EFA\u4F1A\u8BDD"
2032
2567
  }
@@ -2034,14 +2569,14 @@ var ConversationListHeader_default = () => {
2034
2569
  ] });
2035
2570
  };
2036
2571
  var ConversationListPanel_default = ({ header }) => {
2037
- 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: [
2038
2573
  /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: header, DefaultComponent: ConversationListHeader_default }),
2039
2574
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsxRuntime.jsx(ConversationList_default, {}) })
2040
2575
  ] });
2041
2576
  };
2042
2577
 
2043
2578
  // src/ui/layouts/styles.module.less
2044
- var styles_module_default4 = {
2579
+ var styles_module_default5 = {
2045
2580
  nsPreviewHeader: "styles_module_nsPreviewHeader",
2046
2581
  nsPreviewHeaderTitle: "styles_module_nsPreviewHeaderTitle",
2047
2582
  nsChatSenderHeader: "styles_module_nsChatSenderHeader",
@@ -2088,6 +2623,7 @@ var layouts_default = react.forwardRef(({ theme, params, userInfo, hooks, layout
2088
2623
  createConversation: chatStore.createConversation,
2089
2624
  setReferences: chatStore.setReferences,
2090
2625
  setMessage: chatStore.setContent,
2626
+ setMessageParams: chatStore.setContentParams,
2091
2627
  setFiles: chatStore.setFileList,
2092
2628
  setServices: chatStore.setServices,
2093
2629
  setParams: chatStore.setParams,
@@ -2126,7 +2662,7 @@ var layouts_default = react.forwardRef(({ theme, params, userInfo, hooks, layout
2126
2662
  react.useEffect(() => {
2127
2663
  configState.hooks?.onBeforeInit?.();
2128
2664
  }, []);
2129
- 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: [
2130
2666
  /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.globalHeader, DefaultComponent: ChatHeader_default }),
2131
2667
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { className: "full-scroll", children: [
2132
2668
  /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.leftPanel }),
@@ -2134,8 +2670,8 @@ var layouts_default = react.forwardRef(({ theme, params, userInfo, hooks, layout
2134
2670
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Splitter, { className: "flex-1", onResize: setSplitterSizes, children: [
2135
2671
  /* @__PURE__ */ jsxRuntime.jsx(antd.Splitter.Panel, { collapsible: false, min: 600, size: sizes[0], children: hasPreView && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2136
2672
  configState.preview.file.fileUrl && /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: "height-full", children: [
2137
- /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { justify: "space-between", align: "center", gap: 16, className: styles_module_default4.nsPreviewHeader, children: [
2138
- /* @__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 }),
2139
2675
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, justify: "center", align: "center", children: [
2140
2676
  /* @__PURE__ */ jsxRuntime.jsx(
2141
2677
  antd.Button,
@@ -2179,15 +2715,15 @@ var layouts_default = react.forwardRef(({ theme, params, userInfo, hooks, layout
2179
2715
  }
2180
2716
  )
2181
2717
  ] }) }),
2182
- /* @__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: [
2183
2719
  /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.chatHeader, DefaultComponent: ChatHeader_default }),
2184
- /* @__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(
2185
2721
  antd.Flex,
2186
2722
  {
2187
2723
  justify: "center",
2188
2724
  vertical: true,
2189
2725
  gap: 24,
2190
- 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),
2191
2727
  children: [
2192
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 }) }),
2193
2729
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, gap: 8, children: [
@@ -2195,7 +2731,7 @@ var layouts_default = react.forwardRef(({ theme, params, userInfo, hooks, layout
2195
2731
  common.RenderWrapper,
2196
2732
  {
2197
2733
  control: configState.layout.senderHeader,
2198
- DefaultComponent: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles_module_default4.nsChatSenderHeader, children: [
2734
+ DefaultComponent: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles_module_default5.nsChatSenderHeader, children: [
2199
2735
  "\u6211\u662F ",
2200
2736
  receiverState.active.name
2201
2737
  ] })
@@ -2206,7 +2742,26 @@ var layouts_default = react.forwardRef(({ theme, params, userInfo, hooks, layout
2206
2742
  common.RenderWrapper,
2207
2743
  {
2208
2744
  control: configState.layout.disclaimerNotice,
2209
- 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
+ )
2210
2765
  }
2211
2766
  )
2212
2767
  ] }),