@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.esm.js CHANGED
@@ -1,11 +1,11 @@
1
- import { createSecureManager, createTokenManager, useRefState, useDebounce, useSyncInput, markdownToText, RenderWrapper, shouldRender, isFunction, useDeepEffect, useWebSocket, downloadFile, FilePreview, MarkdownEditor, isNumber, getFileSuffixName, isObject, isNullOrUnDef, isBoolean, UserAvatar, copyText, deepCopy, transforms, deepMerge, createRequest, HttpStatus, isArray, isString, isEmptyObj, RenderMarkdown, transform, emit, buildUrlParams, getWebSocketUrl, useCreateValtioContext, FileIcon, isExternal } from '@zero-library/common';
2
- import { App, Badge, Button, Flex, Typography, Spin, Splitter, Tag, Popover, List, Avatar, Space, message, Empty, Tooltip, Modal, Row, Col, Collapse, Drawer } from 'antd';
1
+ import { createSecureManager, createTokenManager, useRefState, useDebounce, useSyncInput, markdownToText, RenderWrapper, shouldRender, isFunction, useDeepEffect, useWebSocket, downloadFile, FilePreview, MarkdownEditor, isObject, isNullOrUnDef, isNumber, getFileSuffixName, isBoolean, UserAvatar, htmlToMarkdown, copyText, deepCopy, transforms, deepMerge, createRequest, HttpStatus, isArray, isString, isEmptyObj, RenderMarkdown, transform, emit, buildUrlParams, getWebSocketUrl, useCreateValtioContext, FileIcon, isExternal, LazyComponent } from '@zero-library/common';
2
+ import { App, Badge, Button, Flex, Typography, Spin, Splitter, Tag, Popover, List, Avatar, Space, Input, Popconfirm, message, Empty, Tooltip, Form, Modal, AutoComplete, Row, Col, Collapse, Skeleton, Alert, Drawer } from 'antd';
3
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
4
  import { forwardRef, useRef, useEffect, useImperativeHandle, useMemo, useState } from 'react';
5
5
  import { useSnapshot, proxy } from 'valtio';
6
- import { CloudUploadOutlined, PaperClipOutlined, EnterOutlined, UserSwitchOutlined, CloseOutlined, PlusOutlined, CommentOutlined, OpenAIOutlined, CopyOutlined, LikeOutlined, DislikeOutlined, DeleteOutlined, RedoOutlined, PlayCircleOutlined } from '@ant-design/icons';
6
+ import { CloudUploadOutlined, PaperClipOutlined, EnterOutlined, CloseOutlined, FileSearchOutlined, UserSwitchOutlined, PlusOutlined, CommentOutlined, OpenAIOutlined, CopyOutlined, LikeOutlined, DislikeOutlined, SearchOutlined, PushpinOutlined, EditOutlined, DeleteOutlined, RedoOutlined, SignatureOutlined, PlayCircleOutlined, DotChartOutlined } from '@ant-design/icons';
7
+ import classNames11 from 'classnames';
7
8
  import { Attachments, Sender, Suggestion, XProvider, Prompts, Bubble, Conversations, Welcome } from '@ant-design/x';
8
- import classNames9 from 'classnames';
9
9
  import dayjs from 'dayjs';
10
10
  import InfiniteScroll from 'react-infinite-scroll-component';
11
11
 
@@ -37,7 +37,10 @@ var init_styles_module = __esm({
37
37
  fileEditContent: "styles_module_fileEditContent",
38
38
  quoteList: "styles_module_quoteList",
39
39
  mdEdit: "styles_module_mdEdit",
40
- think: "styles_module_think"
40
+ think: "styles_module_think",
41
+ chart: "styles_module_chart",
42
+ chartSkeleton: "styles_module_chartSkeleton",
43
+ chartSkeletonIcon: "styles_module_chartSkeletonIcon"
41
44
  };
42
45
  }
43
46
  });
@@ -244,6 +247,77 @@ var init_Think = __esm({
244
247
  };
245
248
  }
246
249
  });
250
+
251
+ // src/ui/common/markdownAlert/Charts.tsx
252
+ var Charts_exports = {};
253
+ __export(Charts_exports, {
254
+ default: () => Charts_default
255
+ });
256
+ var chartTypes, CHART_COMPONENTS, Charts_default;
257
+ var init_Charts = __esm({
258
+ "src/ui/common/markdownAlert/Charts.tsx"() {
259
+ init_styles_module();
260
+ chartTypes = [
261
+ "Line",
262
+ "Column",
263
+ "Bar",
264
+ "Area",
265
+ "Pie",
266
+ "DualAxes",
267
+ "Scatter",
268
+ "WordCloud",
269
+ "Funnel",
270
+ "Heatmap",
271
+ "Histogram",
272
+ "Liquid",
273
+ "BidirectionalBar",
274
+ "Box",
275
+ "Bullet",
276
+ "CirclePacking",
277
+ "Gauge",
278
+ "Radar",
279
+ "Rose",
280
+ "Sankey",
281
+ "Stock",
282
+ "Sunburst",
283
+ "Treemap",
284
+ "Venn",
285
+ "Waterfall",
286
+ "MindMap",
287
+ "Fishbone",
288
+ "IndentedTree",
289
+ "Dendrogram",
290
+ "OrganizationChart",
291
+ "FlowGraph",
292
+ "FlowDirectionGraph",
293
+ "NetworkGraph"
294
+ // …如果还有其他图表也继续加
295
+ ];
296
+ CHART_COMPONENTS = Object.fromEntries(
297
+ chartTypes.map((type) => [
298
+ type,
299
+ () => import('@ant-design/charts').then((mod) => ({
300
+ default: mod[type]
301
+ }))
302
+ ])
303
+ );
304
+ Charts_default = ({ data, loading }) => {
305
+ const { type, config } = data;
306
+ return /* @__PURE__ */ jsx("div", { className: classNames11(styles_module_default.chart, "scroll-fade-in"), children: loading ? (
307
+ // Antd 骨架屏
308
+ /* @__PURE__ */ jsx(Skeleton.Node, { active: true, className: styles_module_default.chartSkeleton, children: /* @__PURE__ */ jsx(DotChartOutlined, { className: styles_module_default.chartSkeletonIcon }) })
309
+ ) : /* @__PURE__ */ jsx(
310
+ LazyComponent,
311
+ {
312
+ type,
313
+ ...config,
314
+ customComponents: CHART_COMPONENTS,
315
+ unknownContent: /* @__PURE__ */ jsx(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 })
316
+ }
317
+ ) });
318
+ };
319
+ }
320
+ });
247
321
  var userInfoManager = createSecureManager({
248
322
  key: "NS-USER",
249
323
  aesKey: "((#II))"
@@ -333,6 +407,27 @@ var createChatService = (request) => {
333
407
  const fileUpload = (formData) => {
334
408
  return request.post("/lolr/storage/upload", formData, { timeout: 5 * 60 * 1e3 });
335
409
  };
410
+ const labelItemUpdate = (agentId, params) => {
411
+ return request.post("/lolr/label/item", { agentId, ...params });
412
+ };
413
+ const labelItemDelete = (id) => {
414
+ return request.delete("/lolr/label/item", { id });
415
+ };
416
+ const labelsQuery = (agentId, params) => {
417
+ return request.get("/lolr/label", { agentId, ...params });
418
+ };
419
+ const labelItemsQuery = (agentId, params) => {
420
+ return request.get("/lolr/label/item", { ...params, agentId });
421
+ };
422
+ const labelItemTop = (params) => {
423
+ return request.put("/lolr/label/item/top", params);
424
+ };
425
+ const labelItemPromptAssistant = (prompt) => {
426
+ return request.post("/lolr/agent/prompts/optimization", { prompt });
427
+ };
428
+ const recommendQuestionsQuery = (agentId, conversationId) => {
429
+ return request.get("/lolr/agent/suggest", { maxCount: 3, agentId, conversationId });
430
+ };
336
431
  return {
337
432
  conversationsQuery,
338
433
  conversationCreate,
@@ -350,12 +445,19 @@ var createChatService = (request) => {
350
445
  agentInfoQuery,
351
446
  agentCharacterQuery,
352
447
  agentCharacterSelect,
353
- fileUpload
448
+ fileUpload,
449
+ labelItemUpdate,
450
+ labelItemDelete,
451
+ labelsQuery,
452
+ labelItemsQuery,
453
+ labelItemTop,
454
+ labelItemPromptAssistant,
455
+ recommendQuestionsQuery
354
456
  };
355
457
  };
356
458
  var createFileService = (request) => {
357
459
  const docQuery = (paramsStr) => {
358
- return request.get(`/uc/doc?${paramsStr}`);
460
+ return request.get(`/lolr/doc?${paramsStr}`);
359
461
  };
360
462
  const fileCreate = async (fileContent, fileName, targetFormat = "docx") => {
361
463
  const blob = await request.post(`/uc/doc/convert`, { fileContent, fileName, targetFormat }, { responseType: "blob" });
@@ -374,20 +476,19 @@ var defaultAgentLayout = {
374
476
  conversationList: true,
375
477
  preview: true,
376
478
  messageList: true,
377
- firstMessage: false,
378
479
  senderHeader: false,
379
480
  sender: true,
380
481
  senderFooter: false,
381
482
  globalHeader: false,
382
483
  chatHeader: true,
383
- disclaimerNotice: true
484
+ disclaimerNotice: true,
485
+ recommendQuestions: false
384
486
  };
385
487
  var defaultExpertLayout = {
386
488
  leftPanel: false,
387
489
  conversationList: false,
388
490
  preview: false,
389
491
  messageList: true,
390
- firstMessage: false,
391
492
  senderHeader: false,
392
493
  sender: {
393
494
  props: {
@@ -403,7 +504,8 @@ var defaultExpertLayout = {
403
504
  conversationListBtn: false
404
505
  }
405
506
  },
406
- disclaimerNotice: false
507
+ disclaimerNotice: false,
508
+ recommendQuestions: false
407
509
  };
408
510
  function createChatStore() {
409
511
  const config = proxy({
@@ -497,6 +599,8 @@ function createChatStore() {
497
599
  const receiver = proxy({
498
600
  /** 当前激活的接收者信息(智能体或专家) */
499
601
  active: {},
602
+ /** 智能体推荐问题列表 */
603
+ recommendQuestions: [],
500
604
  /** 接收者加载状态 */
501
605
  loading: false,
502
606
  /** 接收者透传参数,后期可能扩展不透传参数 */
@@ -537,9 +641,6 @@ function createChatStore() {
537
641
  });
538
642
  receiver.active.type = 3;
539
643
  setReceiverParams();
540
- if (receiver.active.feature?.deepThink) {
541
- setReceiverParams({ thinkMode: "2" });
542
- }
543
644
  config.hooks?.onAfterSwitchAgent?.(data);
544
645
  } catch (error) {
545
646
  console.error(error);
@@ -692,6 +793,9 @@ function createChatStore() {
692
793
  const setContent = (content) => {
693
794
  conversation.messages[conversation.active.id].content = content;
694
795
  };
796
+ const setContentParams = (params) => {
797
+ conversation.messages[conversation.active.id].params = params;
798
+ };
695
799
  const setFileList = (files = []) => {
696
800
  conversation.messages[conversation.active.id].files = files;
697
801
  };
@@ -714,6 +818,17 @@ function createChatStore() {
714
818
  if (lastMessage.id !== messageId) return;
715
819
  conversation.messages[conversationId].questionList = data;
716
820
  };
821
+ const getRecommendQuestions = async (conversationId) => {
822
+ if (conversationId === conversation.active.id && conversation.active.member.agent?.id && !conversation.messages[conversationId].message.length) {
823
+ try {
824
+ const { data } = await config.services.request.recommendQuestionsQuery(conversation.active.member.agent.id, conversationId);
825
+ if (conversationId === conversation.active.id) {
826
+ receiver.recommendQuestions = data;
827
+ }
828
+ } catch (e) {
829
+ }
830
+ }
831
+ };
717
832
  const feedback = async (conversationId, messageId, msgFeedback, index) => {
718
833
  try {
719
834
  conversation.feedback.loading = true;
@@ -803,6 +918,7 @@ function createChatStore() {
803
918
  throw new Error("\u64CD\u4F5C\u88AB\u963B\u6B62");
804
919
  }
805
920
  await initConversation(conversationId);
921
+ receiver.recommendQuestions = [];
806
922
  await setPreview();
807
923
  config.hooks?.onAfterSwitchConversation?.(conversationId);
808
924
  try {
@@ -831,6 +947,7 @@ function createChatStore() {
831
947
  });
832
948
  conversation.messages[conversationId].message = data.items;
833
949
  }
950
+ getRecommendQuestions(conversationId);
834
951
  config.hooks?.onAfterInitMessages?.(conversation.messages[conversationId].message);
835
952
  config.hooks?.onAfterInit?.();
836
953
  };
@@ -875,10 +992,11 @@ function createChatStore() {
875
992
  stream: true
876
993
  };
877
994
  const extraParams = deepCopy(config.params.params || {});
878
- Object.assign(extraParams, receiver.params, message2 ? {} : references?.params, params);
995
+ Object.assign(extraParams, receiver.params, message2 ? {} : { ...references?.params, ...conversation.messages[conversationId].params }, params);
879
996
  sendParams.params = JSON.stringify(extraParams);
880
997
  if (!message2) {
881
998
  setContent("");
999
+ setContentParams();
882
1000
  setFileList([]);
883
1001
  setReferences();
884
1002
  setHeaderOpen(false);
@@ -1045,6 +1163,8 @@ function createChatStore() {
1045
1163
  setReferences,
1046
1164
  /** 设置消息内容 */
1047
1165
  setContent,
1166
+ /** 设置内容参数,透传大模型后清空 */
1167
+ setContentParams,
1048
1168
  /** 设置文件列表 */
1049
1169
  setFileList,
1050
1170
  /** 设置头部展开状态 */
@@ -1077,7 +1197,8 @@ var customComponents = {
1077
1197
  mdEdit: () => Promise.resolve().then(() => (init_MdEdit(), MdEdit_exports)),
1078
1198
  fileEdit: () => Promise.resolve().then(() => (init_FileEdit(), FileEdit_exports)),
1079
1199
  // quoteList: () => import('./QuoteList'),
1080
- think: () => Promise.resolve().then(() => (init_Think(), Think_exports))
1200
+ think: () => Promise.resolve().then(() => (init_Think(), Think_exports)),
1201
+ charts: () => Promise.resolve().then(() => (init_Charts(), Charts_exports))
1081
1202
  };
1082
1203
 
1083
1204
  // src/components/styles.module.less
@@ -1089,7 +1210,7 @@ var styles_module_default2 = {
1089
1210
  quoteTooltip: "styles_module_quoteTooltip",
1090
1211
  quoteTooltipContainer: "styles_module_quoteTooltipContainer"
1091
1212
  };
1092
- var MessageRender_default = ({ message: message2, placement, onFilePreview }) => {
1213
+ var MessageRender_default = ({ message: message2, placement, onFilePreview, customComponents: propsCustomComponents }) => {
1093
1214
  const msgContent = useMemo(
1094
1215
  () => `${message2.msgContent || ""}${message2.msgContent && message2.tempContent ? "\n\n" : ""}${message2.tempContent || ""}`,
1095
1216
  [message2.msgContent, message2.tempContent]
@@ -1122,13 +1243,16 @@ var MessageRender_default = ({ message: message2, placement, onFilePreview }) =>
1122
1243
  onFilePreview?.(file);
1123
1244
  }
1124
1245
  };
1246
+ const mergedCustomComponents = useMemo(() => {
1247
+ return { ...customComponents, ...propsCustomComponents };
1248
+ }, [propsCustomComponents]);
1125
1249
  return /* @__PURE__ */ jsx(Flex, { vertical: true, children: !(msgContent || message2.msgFiles.length) ? /* @__PURE__ */ jsx(Typography, { children: /* @__PURE__ */ jsx(Spin, { size: "small" }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
1126
1250
  msgContent && /* @__PURE__ */ jsx(
1127
1251
  Bubble,
1128
1252
  {
1129
1253
  placement,
1130
- className: classNames9({ [styles_module_default2.loadingMessage]: message2.type }),
1131
- content: /* @__PURE__ */ jsx(RenderMarkdown, { content: replaceMarkdownTags(msgContent), customComponents, message: message2 })
1254
+ className: classNames11({ [styles_module_default2.loadingMessage]: message2.type }),
1255
+ content: /* @__PURE__ */ jsx(RenderMarkdown, { content: replaceMarkdownTags(msgContent), customComponents: mergedCustomComponents, message: message2 })
1132
1256
  }
1133
1257
  ),
1134
1258
  message2.msgFiles?.map((file) => /* @__PURE__ */ jsx(
@@ -1229,7 +1353,7 @@ var WelcomeItem_default = ({ icon = true, title = true, description = true, prom
1229
1353
  /* @__PURE__ */ jsx(
1230
1354
  Welcome,
1231
1355
  {
1232
- className: classNames9(styles_module_default3.chatWelcome, "p-t-32"),
1356
+ className: classNames11(styles_module_default3.chatWelcome, "p-t-32"),
1233
1357
  variant: "borderless",
1234
1358
  icon: /* @__PURE__ */ jsx(RenderWrapper, { control: icon, DefaultComponent: /* @__PURE__ */ jsx(Avatar, { shape: "square", size: 58, src: receiverState.active.logo }) }),
1235
1359
  title: /* @__PURE__ */ jsx(RenderWrapper, { control: title, DefaultComponent: `\u4F60\u597D\uFF0C\u6211\u662F${receiverState.active.name || ""}` }),
@@ -1242,22 +1366,23 @@ var WelcomeItem_default = ({ icon = true, title = true, description = true, prom
1242
1366
  )
1243
1367
  }
1244
1368
  ),
1245
- receiverState.active.config?.recommendQuestions?.length > 0 && /* @__PURE__ */ jsx(
1369
+ /* @__PURE__ */ jsx(
1246
1370
  RenderWrapper,
1247
1371
  {
1248
1372
  control: prompts,
1249
- DefaultComponent: /* @__PURE__ */ jsx(
1373
+ DefaultComponent: receiverState?.recommendQuestions?.length > 0 && /* @__PURE__ */ jsx(
1250
1374
  Prompts,
1251
1375
  {
1252
1376
  className: "m-t-16",
1253
1377
  wrap: true,
1378
+ onItemClick: ({ data }) => chatStore.sendMessage(data.key),
1254
1379
  items: [
1255
1380
  {
1256
1381
  key: "1",
1257
1382
  label: "\u{1F914} \u63A8\u8350\u95EE\u9898:",
1258
- children: receiverState.active.config.recommendQuestions.map(({ question }) => ({
1383
+ children: receiverState?.recommendQuestions.map((question) => ({
1259
1384
  key: question,
1260
- description: /* @__PURE__ */ jsx("span", { onClick: () => chatStore.sendMessage(question), className: classNames9(styles_module_default3.chatWelcomePrompts, "text-ellipsis"), children: question })
1385
+ description: /* @__PURE__ */ jsx("span", { className: classNames11(styles_module_default3.chatWelcomePrompts, "text-ellipsis"), children: question })
1261
1386
  }))
1262
1387
  }
1263
1388
  ]
@@ -1267,7 +1392,13 @@ var WelcomeItem_default = ({ icon = true, title = true, description = true, prom
1267
1392
  )
1268
1393
  ] });
1269
1394
  };
1270
- var BubbleListItems_default = ({ firstMessage = false, welcomeMessage = true, avatar = { user: false, agent: true, other: true } }) => {
1395
+ var BubbleListItems_default = ({
1396
+ firstMessages = [],
1397
+ welcomeMessage = true,
1398
+ avatar = { user: false, agent: true, other: true },
1399
+ agentActions = false,
1400
+ customComponents: customComponents2 = {}
1401
+ }) => {
1271
1402
  const chatStore = useChatStore();
1272
1403
  const receiverState = useSnapshot(chatStore.receiver);
1273
1404
  const conversationState = useSnapshot(chatStore.conversation);
@@ -1350,6 +1481,7 @@ var BubbleListItems_default = ({ firstMessage = false, welcomeMessage = true, av
1350
1481
  const roleKey = Object.keys(conversationRoles).find((key) => conversationRoles[key].id === sender.id);
1351
1482
  return conversationRoles[roleKey] || {};
1352
1483
  };
1484
+ const messageRefs = useRef({});
1353
1485
  const chatRecords = useMemo(() => {
1354
1486
  return (chatMessage?.message || []).map((message2, index) => {
1355
1487
  const role = getRole(message2.sender);
@@ -1359,19 +1491,42 @@ var BubbleListItems_default = ({ firstMessage = false, welcomeMessage = true, av
1359
1491
  variant: "borderless",
1360
1492
  avatar: role.avatar,
1361
1493
  content: /* @__PURE__ */ jsx(
1362
- MessageRender_default,
1494
+ "div",
1363
1495
  {
1364
- message: message2,
1365
- placement: role.placement,
1366
- onFilePreview: (file) => chatStore.setPreview({
1367
- fileUrl: file.content,
1368
- suffix: file.extension,
1369
- fileName: file.name
1370
- })
1496
+ ref: (el) => {
1497
+ messageRefs.current[message2.id] = el;
1498
+ },
1499
+ children: /* @__PURE__ */ jsx(
1500
+ MessageRender_default,
1501
+ {
1502
+ message: message2,
1503
+ placement: role.placement,
1504
+ customComponents: customComponents2,
1505
+ onFilePreview: (file) => chatStore.setPreview({
1506
+ fileUrl: file.content,
1507
+ suffix: file.extension,
1508
+ fileName: file.name
1509
+ })
1510
+ }
1511
+ )
1371
1512
  }
1372
1513
  ),
1373
1514
  footer: /* @__PURE__ */ jsx(Flex, { children: role.user === "agent" && /* @__PURE__ */ jsxs(Fragment, { children: [
1374
- /* @__PURE__ */ jsx(Button, { onClick: () => copyText(message2.msgContent), color: "default", variant: "text", size: "small", icon: /* @__PURE__ */ jsx(CopyOutlined, {}) }),
1515
+ /* @__PURE__ */ jsx(
1516
+ Button,
1517
+ {
1518
+ onClick: () => {
1519
+ const container = messageRefs.current[message2.id];
1520
+ if (!container) return;
1521
+ const markdown = htmlToMarkdown(container?.innerHTML) || message2.msgContent;
1522
+ copyText(markdown);
1523
+ },
1524
+ color: "default",
1525
+ variant: "text",
1526
+ size: "small",
1527
+ icon: /* @__PURE__ */ jsx(CopyOutlined, {})
1528
+ }
1529
+ ),
1375
1530
  /* @__PURE__ */ jsx(
1376
1531
  Button,
1377
1532
  {
@@ -1393,6 +1548,18 @@ var BubbleListItems_default = ({ firstMessage = false, welcomeMessage = true, av
1393
1548
  icon: /* @__PURE__ */ jsx(DislikeOutlined, {}),
1394
1549
  onClick: () => chatStore.feedback(conversationState.active.id, message2.id, 2, index)
1395
1550
  }
1551
+ ),
1552
+ /* @__PURE__ */ jsx(
1553
+ RenderWrapper,
1554
+ {
1555
+ control: agentActions,
1556
+ ctx: {
1557
+ message: message2,
1558
+ get dom() {
1559
+ return messageRefs.current[message2.id];
1560
+ }
1561
+ }
1562
+ }
1396
1563
  )
1397
1564
  ] }) })
1398
1565
  // ...(isHasTime
@@ -1401,26 +1568,28 @@ var BubbleListItems_default = ({ firstMessage = false, welcomeMessage = true, av
1401
1568
  };
1402
1569
  });
1403
1570
  }, [chatMessage?.message]);
1404
- const firstMessageRecord = useMemo(() => {
1405
- const isExist = shouldRender(firstMessage);
1406
- return isExist ? [
1407
- {
1408
- key: "firstMessage",
1409
- content: /* @__PURE__ */ jsx(RenderWrapper, { control: firstMessage }),
1410
- placement: "end"
1571
+ const firstMessagesRecord = useMemo(() => {
1572
+ return (firstMessages || []).map((firstMessage, index) => {
1573
+ const { member, ...args } = firstMessage;
1574
+ return {
1575
+ key: `firstMessage-${index}`,
1576
+ placement: conversationRoles[member]?.placement,
1577
+ avatar: conversationRoles[member]?.avatar,
1411
1578
  // avatar: { style: { visibility: 'hidden' } }
1412
- }
1413
- ] : [];
1414
- }, [firstMessage]);
1579
+ variant: "borderless",
1580
+ ...args
1581
+ };
1582
+ });
1583
+ }, [firstMessages]);
1415
1584
  const bubbleListItems = useMemo(() => {
1416
1585
  const list = [];
1417
- list.push(...firstMessageRecord);
1586
+ list.push(...firstMessagesRecord);
1418
1587
  list.push(...chatRecords, ...questionList);
1419
1588
  if (list.length) {
1420
1589
  return list;
1421
1590
  }
1422
1591
  return [...welcomeMessageRecord];
1423
- }, [chatRecords, questionList, welcomeMessageRecord, firstMessageRecord]);
1592
+ }, [chatRecords, questionList, welcomeMessageRecord, firstMessagesRecord]);
1424
1593
  const listRef = useRef(null);
1425
1594
  const autoScrollRef = useRef(true);
1426
1595
  const handleScroll = (el) => {
@@ -1451,7 +1620,7 @@ var BubbleListItems_default = ({ firstMessage = false, welcomeMessage = true, av
1451
1620
  autoScroll: false,
1452
1621
  ref: listRef,
1453
1622
  items: bubbleListItems,
1454
- className: classNames9(styles_module_default3.nsBubbleList, "height-full", "scroll-fade-in", "zero-chat-bubbles"),
1623
+ className: classNames11(styles_module_default3.nsBubbleList, "height-full", "scroll-fade-in", "zero-chat-bubbles"),
1455
1624
  onScroll: handleScroll
1456
1625
  },
1457
1626
  conversationState.active.id
@@ -1486,7 +1655,7 @@ var CharacterList_default = () => {
1486
1655
  /* @__PURE__ */ jsx(
1487
1656
  Avatar,
1488
1657
  {
1489
- className: classNames9(styles_module_default3.nsAvatarListItemIcon, "cursor-pointer", {
1658
+ className: classNames11(styles_module_default3.nsAvatarListItemIcon, "cursor-pointer", {
1490
1659
  [styles_module_default3.nsAvatarListItemIconActive]: activeCharacter.id === item.id
1491
1660
  }),
1492
1661
  size: 50,
@@ -1582,7 +1751,7 @@ var ChatHeader_default = ({
1582
1751
  const chatStore = useChatStore();
1583
1752
  const receiverState = useSnapshot(chatStore.receiver);
1584
1753
  const configState = useSnapshot(chatStore.config);
1585
- return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Flex, { justify: "space-between", align: "center", className: classNames9(styles_module_default3.nsChatHeader, "zero-chat-header"), children: [
1754
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Flex, { justify: "space-between", align: "center", className: classNames11(styles_module_default3.nsChatHeader, "zero-chat-header"), children: [
1586
1755
  /* @__PURE__ */ jsxs(Flex, { gap: 4, align: "center", children: [
1587
1756
  /* @__PURE__ */ jsx(RenderWrapper, { control: avatar, DefaultComponent: /* @__PURE__ */ jsx(Avatar, { size: 22, src: receiverState.active.logo, alt: receiverState.active.name }) }),
1588
1757
  /* @__PURE__ */ jsx(RenderWrapper, { control: title, DefaultComponent: /* @__PURE__ */ jsx("div", { className: styles_module_default3.nsChatTitle, children: receiverState.active.name }) }),
@@ -1860,6 +2029,396 @@ var ChatSender_default = forwardRef(
1860
2029
  // src/ui/common/ChatSender.tsx
1861
2030
  init_Context();
1862
2031
 
2032
+ // src/ui/common/FeaturesRenderer.tsx
2033
+ init_Context();
2034
+
2035
+ // src/ui/common/QuickAsk/QuickAskPanel.tsx
2036
+ init_Context();
2037
+
2038
+ // src/ui/common/QuickAsk/QuickAskEditModal.tsx
2039
+ init_Context();
2040
+ var QuickAskEditModal_default = ({ open, onCancel, loading, onConfirm, initialValues, categories = [] }) => {
2041
+ const [form] = Form.useForm();
2042
+ const chatStore = useChatStore();
2043
+ const configState = useSnapshot(chatStore.config);
2044
+ const [promptLoading, setPromptLoading] = useState(false);
2045
+ const [description, setDescription] = useState("");
2046
+ const handleOk = async () => {
2047
+ try {
2048
+ const values = await form.validateFields();
2049
+ if (values) {
2050
+ onConfirm(values);
2051
+ }
2052
+ } catch (error) {
2053
+ console.error("Validation failed:", error);
2054
+ }
2055
+ };
2056
+ const handleGenerate = async () => {
2057
+ if (!description.trim()) return;
2058
+ setPromptLoading(true);
2059
+ try {
2060
+ const res = await configState.services.request?.labelItemPromptAssistant?.(description);
2061
+ if (res.data) {
2062
+ form.setFieldsValue({
2063
+ title: res.data.title,
2064
+ labelName: res.data.labelName,
2065
+ content: res.data.content
2066
+ });
2067
+ }
2068
+ } finally {
2069
+ setPromptLoading(false);
2070
+ }
2071
+ };
2072
+ return /* @__PURE__ */ jsxs(
2073
+ Modal,
2074
+ {
2075
+ title: initialValues?.id ? "\u7F16\u8F91\u5FEB\u901F\u63D0\u95EE" : "\u65B0\u589E\u5FEB\u901F\u63D0\u95EE",
2076
+ open,
2077
+ onCancel,
2078
+ onOk: handleOk,
2079
+ width: 600,
2080
+ okText: "\u786E\u5B9A",
2081
+ okButtonProps: {
2082
+ loading
2083
+ },
2084
+ cancelText: "\u53D6\u6D88",
2085
+ children: [
2086
+ /* @__PURE__ */ jsxs(Flex, { vertical: true, gap: 4, children: [
2087
+ /* @__PURE__ */ jsx(
2088
+ Input.TextArea,
2089
+ {
2090
+ rows: 4,
2091
+ 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",
2092
+ value: description,
2093
+ onChange: (e) => setDescription(e.target.value),
2094
+ disabled: promptLoading
2095
+ }
2096
+ ),
2097
+ /* @__PURE__ */ jsx(Flex, { justify: "end", children: /* @__PURE__ */ jsx(
2098
+ Button,
2099
+ {
2100
+ type: "primary",
2101
+ size: "small",
2102
+ icon: /* @__PURE__ */ jsx(SignatureOutlined, {}),
2103
+ onClick: handleGenerate,
2104
+ loading: promptLoading,
2105
+ disabled: !description.trim(),
2106
+ children: "\u7F57\u62C9\u63D0\u793A\u8BCD\u52A9\u624B"
2107
+ }
2108
+ ) })
2109
+ ] }),
2110
+ /* @__PURE__ */ jsxs(Form, { form, layout: "vertical", initialValues, children: [
2111
+ /* @__PURE__ */ jsx(Form.Item, { label: "\u95EE\u9898ID", name: "id", hidden: true, children: /* @__PURE__ */ jsx(Input, { disabled: true }) }),
2112
+ /* @__PURE__ */ jsx(Form.Item, { label: "\u95EE\u9898\u540D\u79F0", name: "title", rules: [{ required: true, message: "\u8BF7\u8F93\u5165\u95EE\u9898\u540D\u79F0" }], children: /* @__PURE__ */ jsx(Input, { placeholder: "\u8BF7\u8F93\u5165\u95EE\u9898\u540D\u79F0" }) }),
2113
+ /* @__PURE__ */ jsx(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__ */ jsx(
2114
+ AutoComplete,
2115
+ {
2116
+ fieldNames: { value: "labelName" },
2117
+ placeholder: "\u8BF7\u9009\u62E9\u95EE\u9898\u5206\u7C7B\u6216\u8F93\u5165\u65B0\u7684\u5206\u7C7B",
2118
+ options: categories
2119
+ }
2120
+ ) }),
2121
+ /* @__PURE__ */ jsx(Form.Item, { label: "\u95EE\u9898\u5185\u5BB9", name: "content", rules: [{ required: true, message: "\u8BF7\u8F93\u5165\u5177\u4F53\u63D0\u95EE\u5185\u5BB9" }], children: /* @__PURE__ */ jsx(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 }) })
2122
+ ] })
2123
+ ]
2124
+ }
2125
+ );
2126
+ };
2127
+
2128
+ // src/ui/common/QuickAsk/styles.module.less
2129
+ var styles_module_default4 = {
2130
+ quickAskPanel: "styles_module_quickAskPanel",
2131
+ tagContainer: "styles_module_tagContainer",
2132
+ quickAskItem: "styles_module_quickAskItem",
2133
+ quickAskItemHeader: "styles_module_quickAskItemHeader",
2134
+ quickAskItemBody: "styles_module_quickAskItemBody"
2135
+ };
2136
+ var QuickAskPanel_default = () => {
2137
+ const { message: message2 } = App.useApp();
2138
+ const chatStore = useChatStore();
2139
+ const configState = useSnapshot(chatStore.config);
2140
+ const receiverState = useSnapshot(chatStore.receiver);
2141
+ const [searchText, setSearchText, getSearchText] = useRefState("");
2142
+ const [searchExpanded, setSearchExpanded] = useState(false);
2143
+ const [activeTab, setActiveTab, getActiveTab] = useRefState({});
2144
+ const [categories, setCategories] = useState([]);
2145
+ const [items, setItems] = useState([]);
2146
+ const [editModalOpen, setEditModalOpen] = useState(false);
2147
+ const [editingItem, setEditingItem] = useState();
2148
+ const fetchCategories = async () => {
2149
+ try {
2150
+ const res = await configState.services.request?.labelsQuery?.(receiverState.active?.id, { pageNo: 1, pageSize: 1e3 });
2151
+ if (res?.data) {
2152
+ setCategories(res.data?.items);
2153
+ }
2154
+ } catch (err) {
2155
+ }
2156
+ };
2157
+ const fetchItems = useDebounce(async () => {
2158
+ try {
2159
+ const res = await configState.services.request?.labelItemsQuery?.(receiverState.active?.id, {
2160
+ labelId: getActiveTab().id,
2161
+ keyword: getSearchText()
2162
+ });
2163
+ if (res?.data) {
2164
+ setItems(res.data);
2165
+ }
2166
+ } catch (err) {
2167
+ }
2168
+ });
2169
+ useEffect(() => {
2170
+ if (receiverState.active?.id) {
2171
+ fetchCategories();
2172
+ fetchItems();
2173
+ }
2174
+ }, [receiverState.active?.id]);
2175
+ const [loading, setLoading] = useState(false);
2176
+ const handleEditConfirm = async (values) => {
2177
+ try {
2178
+ setLoading(true);
2179
+ await configState.services.request?.labelItemUpdate?.(receiverState.active?.id, values);
2180
+ setEditModalOpen(false);
2181
+ message2.success("\u4FDD\u5B58\u6210\u529F");
2182
+ if (!getActiveTab().id || values.labelName === getActiveTab().labelName) {
2183
+ fetchItems();
2184
+ }
2185
+ fetchCategories();
2186
+ } finally {
2187
+ setLoading(false);
2188
+ }
2189
+ };
2190
+ const handleDelete = async (id) => {
2191
+ try {
2192
+ await configState.services.request?.labelItemDelete?.(id);
2193
+ message2.success("\u5220\u9664\u6210\u529F");
2194
+ fetchItems();
2195
+ } catch (err) {
2196
+ }
2197
+ };
2198
+ const handleTop = async (item) => {
2199
+ try {
2200
+ await configState.services.request?.labelItemTop?.({
2201
+ id: item.id,
2202
+ isTop: !item.isTop
2203
+ });
2204
+ message2.success(item.isTop ? "\u53D6\u6D88\u7F6E\u9876\u6210\u529F" : "\u7F6E\u9876\u6210\u529F");
2205
+ fetchItems();
2206
+ } catch (err) {
2207
+ }
2208
+ };
2209
+ return /* @__PURE__ */ jsxs(Flex, { vertical: true, className: styles_module_default4.quickAskPanel, children: [
2210
+ /* @__PURE__ */ jsx(Flex, { justify: "space-between", align: "center", children: /* @__PURE__ */ jsx(Typography.Title, { level: 5, children: "\u5FEB\u901F\u63D0\u95EE" }) }),
2211
+ /* @__PURE__ */ jsxs(Flex, { gap: 8, className: "m-b-16 m-t-16", children: [
2212
+ !searchExpanded && /* @__PURE__ */ jsx(
2213
+ Button,
2214
+ {
2215
+ type: "dashed",
2216
+ block: true,
2217
+ icon: /* @__PURE__ */ jsx(PlusOutlined, {}),
2218
+ className: "flex-1",
2219
+ onClick: () => {
2220
+ setEditingItem(null);
2221
+ setEditModalOpen(true);
2222
+ },
2223
+ children: "\u65B0\u589E\u5FEB\u901F\u63D0\u95EE"
2224
+ }
2225
+ ),
2226
+ searchExpanded ? /* @__PURE__ */ jsx(
2227
+ Input,
2228
+ {
2229
+ autoFocus: true,
2230
+ placeholder: "\u8F93\u5165\u95EE\u9898\u540D\u79F0\u6216\u5185\u5BB9\u68C0\u7D22",
2231
+ prefix: /* @__PURE__ */ jsx(SearchOutlined, {}),
2232
+ value: searchText,
2233
+ onChange: (e) => {
2234
+ setSearchText(e.target.value);
2235
+ fetchItems();
2236
+ },
2237
+ className: "flex-1",
2238
+ allowClear: true,
2239
+ onBlur: () => setSearchExpanded(false)
2240
+ }
2241
+ ) : /* @__PURE__ */ jsx(Button, { icon: /* @__PURE__ */ jsx(SearchOutlined, {}), onClick: () => setSearchExpanded(true) })
2242
+ ] }),
2243
+ /* @__PURE__ */ jsxs(Flex, { align: "center", className: classNames11("scroll-fade-in", "m-b-16", styles_module_default4.tagContainer), children: [
2244
+ /* @__PURE__ */ jsx(
2245
+ Tag,
2246
+ {
2247
+ color: !activeTab.id ? "processing" : "default",
2248
+ className: "cursor-pointer",
2249
+ bordered: false,
2250
+ onClick: () => {
2251
+ setActiveTab({});
2252
+ fetchItems();
2253
+ },
2254
+ children: "\u5168\u90E8"
2255
+ }
2256
+ ),
2257
+ categories.map((c) => /* @__PURE__ */ jsx(
2258
+ Tag,
2259
+ {
2260
+ color: activeTab.id === c.id ? "processing" : "default",
2261
+ className: "cursor-pointer",
2262
+ bordered: false,
2263
+ onClick: () => {
2264
+ setActiveTab(c);
2265
+ fetchItems();
2266
+ },
2267
+ children: c.labelName
2268
+ },
2269
+ c.id
2270
+ ))
2271
+ ] }),
2272
+ /* @__PURE__ */ jsx(Flex, { vertical: true, className: "flex-1", children: /* @__PURE__ */ jsx(Flex, { vertical: true, gap: 8, className: "height-full scroll-fade-in", children: items.map((item) => /* @__PURE__ */ jsxs(
2273
+ "div",
2274
+ {
2275
+ className: styles_module_default4.quickAskItem,
2276
+ onClick: () => {
2277
+ chatStore.setContent(item.content);
2278
+ chatStore.setContentParams({
2279
+ use_template: 1
2280
+ });
2281
+ },
2282
+ children: [
2283
+ /* @__PURE__ */ jsxs(Flex, { gap: 8, justify: "space-between", className: styles_module_default4.quickAskItemHeader, children: [
2284
+ /* @__PURE__ */ jsx("div", { className: "flex-1 text-ellipsis", children: item.title }),
2285
+ /* @__PURE__ */ jsxs(Space, { size: 4, children: [
2286
+ /* @__PURE__ */ jsx(
2287
+ Button,
2288
+ {
2289
+ type: "primary",
2290
+ size: "small",
2291
+ icon: /* @__PURE__ */ jsx(PushpinOutlined, { rotate: item.isTop ? -45 : 0 }),
2292
+ title: item.isTop ? "\u53D6\u6D88\u7F6E\u9876" : "\u7F6E\u9876",
2293
+ onClick: (e) => {
2294
+ e.stopPropagation();
2295
+ handleTop(item);
2296
+ }
2297
+ },
2298
+ "top"
2299
+ ),
2300
+ /* @__PURE__ */ jsx(
2301
+ Button,
2302
+ {
2303
+ type: "primary",
2304
+ size: "small",
2305
+ icon: /* @__PURE__ */ jsx(CopyOutlined, {}),
2306
+ title: "\u590D\u5236",
2307
+ onClick: (e) => {
2308
+ e.stopPropagation();
2309
+ handleEditConfirm({
2310
+ title: item.title,
2311
+ labelName: item.labelName,
2312
+ content: item.content
2313
+ });
2314
+ }
2315
+ },
2316
+ "copy"
2317
+ ),
2318
+ /* @__PURE__ */ jsx(
2319
+ Button,
2320
+ {
2321
+ type: "primary",
2322
+ size: "small",
2323
+ icon: /* @__PURE__ */ jsx(EditOutlined, {}),
2324
+ title: "\u7F16\u8F91",
2325
+ onClick: (e) => {
2326
+ e.stopPropagation();
2327
+ setEditingItem(item);
2328
+ setEditModalOpen(true);
2329
+ }
2330
+ },
2331
+ "edit"
2332
+ ),
2333
+ item.canDelete && /* @__PURE__ */ jsx(
2334
+ Popconfirm,
2335
+ {
2336
+ title: "\u63D0\u793A",
2337
+ okText: "\u786E\u5B9A",
2338
+ cancelText: "\u53D6\u6D88",
2339
+ description: "\u786E\u8BA4\u5220\u9664\u95EE\u9898\u5417?",
2340
+ onConfirm: (e) => {
2341
+ e.stopPropagation();
2342
+ handleDelete(item.id);
2343
+ },
2344
+ children: /* @__PURE__ */ jsx(Button, { type: "primary", size: "small", icon: /* @__PURE__ */ jsx(DeleteOutlined, {}), title: "\u5220\u9664", onClick: (e) => e.stopPropagation() })
2345
+ },
2346
+ "delete"
2347
+ )
2348
+ ] })
2349
+ ] }),
2350
+ /* @__PURE__ */ jsx("div", { className: classNames11(styles_module_default4.quickAskItemBody), children: /* @__PURE__ */ jsx("div", { className: "text-ellipsis-3", children: item.content }) })
2351
+ ]
2352
+ },
2353
+ item.id
2354
+ )) }) }),
2355
+ editModalOpen && /* @__PURE__ */ jsx(
2356
+ QuickAskEditModal_default,
2357
+ {
2358
+ open: editModalOpen,
2359
+ onCancel: () => setEditModalOpen(false),
2360
+ onConfirm: handleEditConfirm,
2361
+ loading,
2362
+ initialValues: editingItem,
2363
+ categories
2364
+ }
2365
+ )
2366
+ ] });
2367
+ };
2368
+ var FeaturesRenderer_default = () => {
2369
+ const chatStore = useChatStore();
2370
+ const receiverState = useSnapshot(chatStore.receiver);
2371
+ const conversationState = useSnapshot(chatStore.conversation);
2372
+ const chatMessage = useMemo(
2373
+ () => conversationState.messages[conversationState.active.id] || {},
2374
+ [conversationState.messages[conversationState.active.id]]
2375
+ );
2376
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
2377
+ receiverState.active.feature?.deepThink && /* @__PURE__ */ jsx(
2378
+ Button,
2379
+ {
2380
+ size: "small",
2381
+ color: receiverState.params.thinkMode === "1" ? "primary" : "default",
2382
+ variant: "filled",
2383
+ onClick: () => chatStore.setReceiverParams({ thinkMode: receiverState.params.thinkMode === "1" ? "2" : "1" }),
2384
+ children: "\u6DF1\u5EA6\u601D\u8003"
2385
+ }
2386
+ ),
2387
+ receiverState.active.feature?.switchManual && /* @__PURE__ */ jsx(
2388
+ Button,
2389
+ {
2390
+ size: "small",
2391
+ 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",
2392
+ shape: "round",
2393
+ icon: /* @__PURE__ */ jsx(UserSwitchOutlined, {}),
2394
+ color: chatMessage?.speakHuman ? "primary" : "default",
2395
+ variant: "filled",
2396
+ onClick: () => {
2397
+ chatStore.setSpeakHuman?.(!chatMessage?.speakHuman);
2398
+ },
2399
+ children: "\u5411\u4E13\u5BB6\u54A8\u8BE2"
2400
+ }
2401
+ ),
2402
+ /* @__PURE__ */ jsx(
2403
+ Popover,
2404
+ {
2405
+ trigger: "click",
2406
+ placement: "topLeft",
2407
+ content: /* @__PURE__ */ jsx(QuickAskPanel_default, {}),
2408
+ children: /* @__PURE__ */ jsx(
2409
+ Button,
2410
+ {
2411
+ size: "small",
2412
+ color: "primary",
2413
+ variant: "filled",
2414
+ children: "\u5FEB\u901F\u63D0\u95EE"
2415
+ }
2416
+ )
2417
+ }
2418
+ )
2419
+ ] });
2420
+ };
2421
+
1863
2422
  // src/ui/common/SenderPromptsItems.tsx
1864
2423
  init_Context();
1865
2424
  var SenderPromptsItems_default = () => {
@@ -1878,14 +2437,14 @@ var SenderPromptsItems_default = () => {
1878
2437
  split: false,
1879
2438
  className: styles_module_default3.nsSenderList,
1880
2439
  dataSource: question.items,
1881
- renderItem: (item) => /* @__PURE__ */ jsx(List.Item, { onClick: () => chatStore.sendMessage(item.question), className: styles_module_default3.nsSenderListItem, children: item.question }),
2440
+ renderItem: (item) => /* @__PURE__ */ jsx(List.Item, { onClick: () => chatStore.sendMessage(item.question), className: styles_module_default3.nsSenderListItem, children: /* @__PURE__ */ jsx("div", { className: "text-ellipsis", children: item.question }) }),
1882
2441
  footer: /* @__PURE__ */ jsx(Flex, { justify: "end", className: styles_module_default3.nsSenderListFooter, children: "(\u60A8\u53EF\u70B9\u51FB\u4EE5\u4E0A\u95EE\u9898\u5F00\u542FAI\u4F53\u9A8C)" })
1883
2442
  }
1884
2443
  ),
1885
2444
  title: /* @__PURE__ */ jsx(
1886
2445
  "div",
1887
2446
  {
1888
- className: classNames9(styles_module_default3.nsSenderListTitle, "text-ellipsis"),
2447
+ className: classNames11(styles_module_default3.nsSenderListTitle, "text-ellipsis"),
1889
2448
  children: `${receiverState.active.name}\u5F00\u59CB\u5173\u6CE8${question.name}\u5185\u5BB9\uFF01`
1890
2449
  }
1891
2450
  ),
@@ -1943,31 +2502,7 @@ var ChatSender_default2 = forwardRef(
1943
2502
  sendBtnProps: isFunction(sendBtnProps) ? sendBtnProps() : {},
1944
2503
  extraFooterBelow: /* @__PURE__ */ jsx(RenderWrapper, { control: footerBelow }),
1945
2504
  extraFooter: /* @__PURE__ */ jsxs(Fragment, { children: [
1946
- receiverState.active.feature?.deepThink && /* @__PURE__ */ jsx(
1947
- Button,
1948
- {
1949
- size: "small",
1950
- color: receiverState.params.thinkMode === "1" ? "primary" : "default",
1951
- variant: "filled",
1952
- onClick: () => chatStore.setReceiverParams({ thinkMode: receiverState.params.thinkMode === "1" ? "2" : "1" }),
1953
- children: "\u6DF1\u5EA6\u601D\u8003"
1954
- }
1955
- ),
1956
- receiverState.active.feature?.switchManual && /* @__PURE__ */ jsx(
1957
- Button,
1958
- {
1959
- size: "small",
1960
- 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",
1961
- shape: "round",
1962
- icon: /* @__PURE__ */ jsx(UserSwitchOutlined, {}),
1963
- color: chatMessage?.speakHuman ? "primary" : "default",
1964
- variant: "filled",
1965
- onClick: () => {
1966
- chatStore.setSpeakHuman?.(!chatMessage?.speakHuman);
1967
- },
1968
- children: "\u5411\u4E13\u5BB6\u54A8\u8BE2"
1969
- }
1970
- ),
2505
+ /* @__PURE__ */ jsx(FeaturesRenderer_default, {}),
1971
2506
  /* @__PURE__ */ jsx(RenderWrapper, { control: extraBtn })
1972
2507
  ] }),
1973
2508
  extraHeader: /* @__PURE__ */ jsx(
@@ -2018,7 +2553,7 @@ var ConversationListHeader_default = () => {
2018
2553
  type: "primary",
2019
2554
  shape: "round",
2020
2555
  onClick: () => chatStore.createConversation(),
2021
- className: classNames9("m-t-16"),
2556
+ className: classNames11("m-t-16"),
2022
2557
  icon: /* @__PURE__ */ jsx(PlusOutlined, {}),
2023
2558
  children: "\u65B0\u5EFA\u4F1A\u8BDD"
2024
2559
  }
@@ -2026,14 +2561,14 @@ var ConversationListHeader_default = () => {
2026
2561
  ] });
2027
2562
  };
2028
2563
  var ConversationListPanel_default = ({ header }) => {
2029
- return /* @__PURE__ */ jsxs(Flex, { vertical: true, className: classNames9("height-full", "zero-chat-conversations", styles_module_default3.nsConversationListPanel), children: [
2564
+ return /* @__PURE__ */ jsxs(Flex, { vertical: true, className: classNames11("height-full", "zero-chat-conversations", styles_module_default3.nsConversationListPanel), children: [
2030
2565
  /* @__PURE__ */ jsx(RenderWrapper, { control: header, DefaultComponent: ConversationListHeader_default }),
2031
2566
  /* @__PURE__ */ jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsx(ConversationList_default, {}) })
2032
2567
  ] });
2033
2568
  };
2034
2569
 
2035
2570
  // src/ui/layouts/styles.module.less
2036
- var styles_module_default4 = {
2571
+ var styles_module_default5 = {
2037
2572
  nsPreviewHeader: "styles_module_nsPreviewHeader",
2038
2573
  nsPreviewHeaderTitle: "styles_module_nsPreviewHeaderTitle",
2039
2574
  nsChatSenderHeader: "styles_module_nsChatSenderHeader",
@@ -2080,6 +2615,7 @@ var layouts_default = forwardRef(({ theme, params, userInfo, hooks, layout, conf
2080
2615
  createConversation: chatStore.createConversation,
2081
2616
  setReferences: chatStore.setReferences,
2082
2617
  setMessage: chatStore.setContent,
2618
+ setMessageParams: chatStore.setContentParams,
2083
2619
  setFiles: chatStore.setFileList,
2084
2620
  setServices: chatStore.setServices,
2085
2621
  setParams: chatStore.setParams,
@@ -2118,7 +2654,7 @@ var layouts_default = forwardRef(({ theme, params, userInfo, hooks, layout, conf
2118
2654
  useEffect(() => {
2119
2655
  configState.hooks?.onBeforeInit?.();
2120
2656
  }, []);
2121
- return /* @__PURE__ */ jsx(XProvider, { theme: { cssVar: true, ...theme }, children: /* @__PURE__ */ jsx(ChatProvider, { store: chatStore, children: /* @__PURE__ */ jsx(Spin, { spinning: receiverState.loading, wrapperClassName: "full-spin", children: /* @__PURE__ */ jsxs(Flex, { vertical: true, className: classNames9(styles_module_default4.nsChatLayout, "zero-chat-layout", "height-full"), children: [
2657
+ return /* @__PURE__ */ jsx(XProvider, { theme: { cssVar: true, ...theme }, children: /* @__PURE__ */ jsx(ChatProvider, { store: chatStore, children: /* @__PURE__ */ jsx(Spin, { spinning: receiverState.loading, wrapperClassName: "full-spin", children: /* @__PURE__ */ jsxs(Flex, { vertical: true, className: classNames11(styles_module_default5.nsChatLayout, "zero-chat-layout", "height-full"), children: [
2122
2658
  /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.globalHeader, DefaultComponent: ChatHeader_default }),
2123
2659
  /* @__PURE__ */ jsxs(Flex, { className: "full-scroll", children: [
2124
2660
  /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.leftPanel }),
@@ -2126,8 +2662,8 @@ var layouts_default = forwardRef(({ theme, params, userInfo, hooks, layout, conf
2126
2662
  /* @__PURE__ */ jsxs(Splitter, { className: "flex-1", onResize: setSplitterSizes, children: [
2127
2663
  /* @__PURE__ */ jsx(Splitter.Panel, { collapsible: false, min: 600, size: sizes[0], children: hasPreView && /* @__PURE__ */ jsxs(Fragment, { children: [
2128
2664
  configState.preview.file.fileUrl && /* @__PURE__ */ jsxs(Flex, { vertical: true, className: "height-full", children: [
2129
- /* @__PURE__ */ jsxs(Flex, { justify: "space-between", align: "center", gap: 16, className: styles_module_default4.nsPreviewHeader, children: [
2130
- /* @__PURE__ */ jsx("div", { className: classNames9(styles_module_default4.nsPreviewHeaderTitle, "text-ellipsis"), title: configState.preview.file.fileName, children: configState.preview.file.fileName }),
2665
+ /* @__PURE__ */ jsxs(Flex, { justify: "space-between", align: "center", gap: 16, className: styles_module_default5.nsPreviewHeader, children: [
2666
+ /* @__PURE__ */ jsx("div", { className: classNames11(styles_module_default5.nsPreviewHeaderTitle, "text-ellipsis"), title: configState.preview.file.fileName, children: configState.preview.file.fileName }),
2131
2667
  /* @__PURE__ */ jsxs(Flex, { gap: 8, justify: "center", align: "center", children: [
2132
2668
  /* @__PURE__ */ jsx(
2133
2669
  Button,
@@ -2171,15 +2707,15 @@ var layouts_default = forwardRef(({ theme, params, userInfo, hooks, layout, conf
2171
2707
  }
2172
2708
  )
2173
2709
  ] }) }),
2174
- /* @__PURE__ */ jsx(Splitter.Panel, { collapsible: false, max: 800, min: 400, size: sizes[1], children: /* @__PURE__ */ jsxs(Flex, { vertical: true, className: classNames9("height-full"), children: [
2710
+ /* @__PURE__ */ jsx(Splitter.Panel, { collapsible: false, max: 800, min: 400, size: sizes[1], children: /* @__PURE__ */ jsxs(Flex, { vertical: true, className: classNames11("height-full"), children: [
2175
2711
  /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.chatHeader, DefaultComponent: ChatHeader_default }),
2176
- /* @__PURE__ */ jsx(Flex, { vertical: true, className: classNames9("full-scroll"), children: /* @__PURE__ */ jsxs(
2712
+ /* @__PURE__ */ jsx(Flex, { vertical: true, className: classNames11("full-scroll"), children: /* @__PURE__ */ jsxs(
2177
2713
  Flex,
2178
2714
  {
2179
2715
  justify: "center",
2180
2716
  vertical: true,
2181
2717
  gap: 24,
2182
- className: classNames9("height-full", styles_module_default4.nsChatBody, "zero-chat-body", styles_module_default4.nsBodyWidth),
2718
+ className: classNames11("height-full", styles_module_default5.nsChatBody, "zero-chat-body", styles_module_default5.nsBodyWidth),
2183
2719
  children: [
2184
2720
  shouldRender(configState.layout.messageList) && /* @__PURE__ */ jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.messageList, DefaultComponent: BubbleListItems_default }) }),
2185
2721
  /* @__PURE__ */ jsxs(Flex, { vertical: true, gap: 8, children: [
@@ -2187,7 +2723,7 @@ var layouts_default = forwardRef(({ theme, params, userInfo, hooks, layout, conf
2187
2723
  RenderWrapper,
2188
2724
  {
2189
2725
  control: configState.layout.senderHeader,
2190
- DefaultComponent: /* @__PURE__ */ jsxs("div", { className: styles_module_default4.nsChatSenderHeader, children: [
2726
+ DefaultComponent: /* @__PURE__ */ jsxs("div", { className: styles_module_default5.nsChatSenderHeader, children: [
2191
2727
  "\u6211\u662F ",
2192
2728
  receiverState.active.name
2193
2729
  ] })
@@ -2198,7 +2734,26 @@ var layouts_default = forwardRef(({ theme, params, userInfo, hooks, layout, conf
2198
2734
  RenderWrapper,
2199
2735
  {
2200
2736
  control: configState.layout.disclaimerNotice,
2201
- DefaultComponent: /* @__PURE__ */ jsx("div", { className: styles_module_default4.nsDisclaimerNotice, children: "\u5185\u5BB9\u7531AI\u751F\u6210\uFF0C\u4EC5\u4F9B\u53C2\u8003\uFF0C\u8BF7\u4ED4\u7EC6\u7504\u522B" })
2737
+ DefaultComponent: /* @__PURE__ */ jsx("div", { className: styles_module_default5.nsDisclaimerNotice, children: "\u5185\u5BB9\u7531AI\u751F\u6210\uFF0C\u4EC5\u4F9B\u53C2\u8003\uFF0C\u8BF7\u4ED4\u7EC6\u7504\u522B" })
2738
+ }
2739
+ ),
2740
+ /* @__PURE__ */ jsx(
2741
+ RenderWrapper,
2742
+ {
2743
+ control: configState.layout.recommendQuestions,
2744
+ DefaultComponent: receiverState?.recommendQuestions?.length > 0 && /* @__PURE__ */ jsx(
2745
+ Prompts,
2746
+ {
2747
+ vertical: true,
2748
+ title: "\u63A8\u8350\u95EE\u9898:",
2749
+ onItemClick: ({ data }) => chatStore.sendMessage(data.key),
2750
+ items: receiverState?.recommendQuestions.map((question) => ({
2751
+ key: question,
2752
+ icon: /* @__PURE__ */ jsx(FileSearchOutlined, {}),
2753
+ description: question
2754
+ }))
2755
+ }
2756
+ )
2202
2757
  }
2203
2758
  )
2204
2759
  ] }),