rhua-chatgpt-web 1.0.98 → 1.1.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.
Files changed (46) hide show
  1. package/dist/{api_chain-wgmc7e6E.js → api_chain-6WuaFa6d.js} +2 -2
  2. package/dist/{api_chain-CB8GWGIU.cjs → api_chain-z7-hferR.cjs} +1 -1
  3. package/dist/{combine_docs_chain-DgONM3Mw.cjs → combine_docs_chain-CFAXRlyi.cjs} +1 -1
  4. package/dist/{combine_docs_chain-C4dphi5e.js → combine_docs_chain-CO7HVb4R.js} +2 -2
  5. package/dist/{few_shot-CAlLA7_Y.js → few_shot-D1fV7wmE.js} +1 -1
  6. package/dist/{few_shot-D1R-zNl7.cjs → few_shot-GynjP3JZ.cjs} +1 -1
  7. package/dist/{index-Bg5840_w.js → index-B3AeHb0J.js} +1 -1
  8. package/dist/{index-D6StpCel.cjs → index-BcePyLfy.cjs} +1 -1
  9. package/dist/{index-r3AjaSlS.cjs → index-BdHsAk36.cjs} +1 -1
  10. package/dist/index-BiyXJ5nZ.js +4 -0
  11. package/dist/{index-DWSafnCg.cjs → index-BjVIOIdk.cjs} +1 -1
  12. package/dist/index-C4FSTC-Y.js +4 -0
  13. package/dist/{index-DMb9FQJU.cjs → index-CFCSEDxn.cjs} +1 -1
  14. package/dist/{index-Dt6MdEi3.cjs → index-CMmMjajZ.cjs} +1 -1
  15. package/dist/{index-BN7_2Vpx.js → index-CYZSWzuu.js} +2 -2
  16. package/dist/{index-BbYqG4Lp.js → index-Cfz7TnCH.js} +192 -157
  17. package/dist/{index-CymPiKxB.js → index-D0o12JtU.js} +1 -1
  18. package/dist/{index-Bg42RK-4.js → index-DKYlRoiR.js} +2 -2
  19. package/dist/{index-D8gIJjM_.cjs → index-DL_ocleL.cjs} +1 -1
  20. package/dist/{index-CjSvTRsR.cjs → index-DaVkrct-.cjs} +1 -1
  21. package/dist/index-De7_kMn7.js +4 -0
  22. package/dist/{index-cTMOFBXD.cjs → index-Dift2gpr.cjs} +1 -1
  23. package/dist/{index-CI8OM2Jz.js → index-Dkq6Ss_h.js} +1 -1
  24. package/dist/{index-CjmBLRKu.cjs → index-DsPuml45.cjs} +3 -3
  25. package/dist/index-Gi2kGbCW.js +4 -0
  26. package/dist/{index-BekrpxaM.cjs → index-KDG7mz5O.cjs} +1 -1
  27. package/dist/{index-C1T2elxu.js → index-PRwtvON1.js} +1 -1
  28. package/dist/{index-DrDcayhM.js → index-gI4Ks2P3.js} +1 -1
  29. package/dist/{index-Cd_gRf5s.cjs → index-jr5i21r1.cjs} +1 -1
  30. package/dist/{index-CfwXktuP.cjs → index-oel1bTo0.cjs} +1 -1
  31. package/dist/index.cjs.js +1 -1
  32. package/dist/{index.es-67G0dUQ8.js → index.es-Fq7tEj25.js} +11 -11
  33. package/dist/{index.es-CtypdcdJ.cjs → index.es-QDwz4eEz.cjs} +2 -2
  34. package/dist/index.esm.js +1 -1
  35. package/dist/{llm_chain-AXaQuXMt.js → llm_chain-5NVYgTDC.js} +1 -1
  36. package/dist/{llm_chain-RoYoMcLp.cjs → llm_chain-HMEylFLR.cjs} +1 -1
  37. package/dist/{sequential_chain-DVxvWiQQ.js → sequential_chain-B3aNFa_8.js} +1 -1
  38. package/dist/{sequential_chain-9yzJVjdz.cjs → sequential_chain-BIwygM6l.cjs} +1 -1
  39. package/dist/style.css +1 -1
  40. package/dist/{vector_db_qa-Ca-yXUO_.js → vector_db_qa-BlC0aeM2.js} +3 -3
  41. package/dist/{vector_db_qa-4lYMS_5X.cjs → vector_db_qa-C_vzGRYC.cjs} +1 -1
  42. package/package.json +1 -1
  43. package/dist/index-ASKx-pn3.js +0 -4
  44. package/dist/index-B-yz5nX2.js +0 -4
  45. package/dist/index-Ctbtl5KP.js +0 -4
  46. package/dist/index-Cuzto2LI.js +0 -4
@@ -2,7 +2,7 @@ var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
4
  import React__default, { useState, useRef, useCallback, useEffect, useMemo, createRef, forwardRef, useLayoutEffect, useImperativeHandle } from "react";
5
- import { Button, Input, Select, Checkbox, Tooltip, Toast, Typography, Collapsible, Dropdown, Tag, Avatar, Spin, Layout, Switch, Modal, TextArea, Empty, Form, TagGroup, Divider, Tree, SideSheet } from "@douyinfe/semi-ui";
5
+ import { Button, Input, Select, Checkbox, Tooltip, Toast, Typography, Collapsible, Dropdown, Tag, Avatar, Spin, Layout, Modal, TextArea, Empty, Form, TagGroup, Divider, Tree, SideSheet } from "@douyinfe/semi-ui";
6
6
  import { IconChevronDown, IconClose, IconShareStroked, IconPlus, IconSearch, IconEdit2Stroked, IconDeleteStroked, IconCopyStroked, IconDownCircleStroked, IconBulb, IconChevronUp, IconLink, IconTreeTriangleDown, IconImage, IconFile, IconArrowRight, IconArrowLeft, IconBolt, IconEditStroked, IconComment, IconDelete, IconCloud, IconStop, IconSend, IconChevronLeft, IconArrowUp, IconRefresh, IconHistory } from "@douyinfe/semi-icons";
7
7
  import styled from "styled-components";
8
8
  import { useNavigate, useSearchParams } from "react-router-dom";
@@ -1021,7 +1021,7 @@ const convertDifyAppToAgent = (difyApp) => {
1021
1021
  const getAgentList = async (type = "app") => {
1022
1022
  let preApi = location.hostname === "localhost" ? "http://111.6.44.42:30001" : location.origin;
1023
1023
  let baseApi = `${preApi}/prod-api/system/apps/list?pageNum=1&pageSize=100&type=${type}`;
1024
- let token = "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsImxvZ2luX3VzZXJfa2V5IjoiOTJhNDljYjMtMDRkMC00MzE5LWEwNmMtODIxNGRjYjMxOGY1In0._W5hAT_pvOlwutPu086G8IyIfdmFqHbNeDpndRC1qejNOJuiQUOAUff2Thg0dbPw2q50_hqy4NtimhC3z-ae2g ";
1024
+ let token = "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsImxvZ2luX3VzZXJfa2V5IjoiOTJhNDljYjMtMDRkMC00MzE5LWEwNmMtODIxNGRjYjMxOGY1In0._W5hAT_pvOlwutPu086G8IyIfdmFqHbNeDpndRC1qejNOJuiQUOAUff2Thg0dbPw2q50_hqy4NtimhC3z-ae2g";
1025
1025
  try {
1026
1026
  const cacheData = localStorage.getItem("agentWebCache");
1027
1027
  console.log("cacheData", cacheData);
@@ -1595,7 +1595,6 @@ const AiList = ({
1595
1595
  handleWrite,
1596
1596
  usageIncrementFn
1597
1597
  }) => {
1598
- console.log("父组件传过来的appTypeOptions:", appTypeOptions);
1599
1598
  const navigate = useNavigate();
1600
1599
  const [activeFilter, setActiveFilter] = useState(() => {
1601
1600
  try {
@@ -42573,15 +42572,12 @@ const CommentHeader = React__default.memo(
42573
42572
  clearCurrentChatList,
42574
42573
  renameSessionTitle,
42575
42574
  triggerSessionSidebar,
42576
- onThinkStatusSend,
42577
42575
  onToggleChatHistory,
42578
42576
  onToggleAgentList,
42579
42577
  chatHistoryVisible,
42580
42578
  agentListVisible,
42581
42579
  onNavigateView,
42582
42580
  currentAgentName,
42583
- currentAgentCustomize,
42584
- isThinkInitial = true,
42585
42581
  onBackToAiList,
42586
42582
  showBackButton = true,
42587
42583
  handleBack
@@ -42589,10 +42585,6 @@ const CommentHeader = React__default.memo(
42589
42585
  const { Header } = Layout;
42590
42586
  const [titleRenameVisible, setTitleRenameVisible] = useState(false);
42591
42587
  const [titleContent, setTitleContent] = useState(sessionTitle);
42592
- const [isThink, setIsThink] = useState(isThinkInitial);
42593
- useEffect(() => {
42594
- setIsThink(isThinkInitial);
42595
- }, [isThinkInitial]);
42596
42588
  const titleContentChange = (content2) => {
42597
42589
  setTitleContent(content2);
42598
42590
  };
@@ -42633,20 +42625,7 @@ const CommentHeader = React__default.memo(
42633
42625
  className: "comment-header-back"
42634
42626
  }
42635
42627
  ),
42636
- currentAgentName && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "comment-header-agent-name", children: currentAgentName }),
42637
- currentAgentCustomize === "智能问答" && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "comment-header-think-switch", style: { marginLeft: "12px", display: "flex", alignItems: "center", gap: "8px" }, children: [
42638
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: { fontSize: "14px", color: "var(--semi-color-text-1)" }, children: "思考过程" }),
42639
- /* @__PURE__ */ jsxRuntimeExports.jsx(
42640
- Switch,
42641
- {
42642
- checked: isThink,
42643
- onChange: (checked) => {
42644
- setIsThink(checked);
42645
- onThinkStatusSend(checked);
42646
- }
42647
- }
42648
- )
42649
- ] })
42628
+ currentAgentName && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "comment-header-agent-name", children: currentAgentName })
42650
42629
  ] }) }),
42651
42630
  /* @__PURE__ */ jsxRuntimeExports.jsx(
42652
42631
  Modal,
@@ -43688,6 +43667,7 @@ function createDynamicFormConfig(userInputForm) {
43688
43667
  };
43689
43668
  }
43690
43669
  function CommentIndex({
43670
+ appTypeOptions,
43691
43671
  onBackToAiList,
43692
43672
  onNavigateView,
43693
43673
  baseUrl,
@@ -43982,7 +43962,6 @@ function CommentIndex({
43982
43962
  let filesDataMap = {};
43983
43963
  if (filesCache) {
43984
43964
  const filesData = JSON.parse(filesCache);
43985
- console.log("[初始化会话] 找到文件信息缓存:", filesData);
43986
43965
  filesDataMap = filesData.reduce((acc, file) => {
43987
43966
  if (!acc[file.variable]) {
43988
43967
  acc[file.variable] = [];
@@ -44000,7 +43979,6 @@ function CommentIndex({
44000
43979
  (file) => fileIds.includes(file.fileId)
44001
43980
  );
44002
43981
  if (matchedFiles.length > 0) {
44003
- console.log(`[初始化会话] 恢复文件字段 ${variable}:`, matchedFiles);
44004
43982
  matchedFiles.forEach((file) => {
44005
43983
  restoredFileNamesMap[file.fileId] = file.fileName;
44006
43984
  if (file.fileType) {
@@ -44010,20 +43988,15 @@ function CommentIndex({
44010
43988
  }
44011
43989
  }
44012
43990
  });
44013
- console.log("[初始化会话] 恢复的表单数据:", restoredFormData);
44014
43991
  } else {
44015
- console.log("[初始化会话] 未找到表单数据缓存");
44016
43992
  const filesKey = `dialog_files_${newSessionId}`;
44017
43993
  const filesCache = localStorage.getItem(filesKey);
44018
43994
  if (filesCache) {
44019
43995
  const filesData = JSON.parse(filesCache);
44020
- console.log("[初始化会话] 找到文件信息缓存:", filesData);
44021
43996
  } else {
44022
- console.log("[初始化会话] 未找到文件信息缓存");
44023
43997
  }
44024
43998
  }
44025
43999
  } catch (error) {
44026
- console.error("[初始化会话] 查找本地缓存失败:", error);
44027
44000
  }
44028
44001
  setCurrentCommentSession({
44029
44002
  ...currentSession,
@@ -44079,11 +44052,19 @@ function CommentIndex({
44079
44052
  });
44080
44053
  const loadAgents = async () => {
44081
44054
  try {
44082
- const [appAgents, toolsAgents] = await Promise.all([
44083
- getAgentList("app"),
44084
- getAgentList("tools")
44085
- ]);
44086
- const allAgents = [...appAgents, ...toolsAgents];
44055
+ let agentPromises = [];
44056
+ if (appTypeOptions && appTypeOptions.length > 0) {
44057
+ agentPromises = appTypeOptions.map(
44058
+ (option) => getAgentList(option.dictValue)
44059
+ );
44060
+ } else {
44061
+ agentPromises = [
44062
+ getAgentList("app"),
44063
+ getAgentList("tools")
44064
+ ];
44065
+ }
44066
+ const agentResults = await Promise.all(agentPromises);
44067
+ const allAgents = agentResults.flat();
44087
44068
  setAgentList(allAgents);
44088
44069
  const hasPendingAgent = hasIncomingSelectedAgent || typeof window !== "undefined" && window.localStorage.getItem("selectedAgent");
44089
44070
  if (hasPendingAgent) {
@@ -44392,7 +44373,6 @@ function CommentIndex({
44392
44373
  fileType = CommonUtil.getFileTypeFromLocalStorage(fileId);
44393
44374
  typeSource = "localStorage.filesTypeArr";
44394
44375
  } catch (error) {
44395
- console.warn(`[发送消息] 从 filesTypeArr 获取文件类型失败:`, error);
44396
44376
  try {
44397
44377
  const sessionId = currentCommentSessionId;
44398
44378
  if (sessionId) {
@@ -44404,37 +44384,18 @@ function CommentIndex({
44404
44384
  if (fileInfo && fileInfo.fileType) {
44405
44385
  fileType = fileInfo.fileType;
44406
44386
  typeSource = `dialog_files_${sessionId}`;
44407
- console.log(`[发送消息] 从 dialog_files_ 缓存获取文件类型成功:`, {
44408
- 文件ID: fileId,
44409
- 文件类型: fileType,
44410
- 文件名: fileInfo.fileName,
44411
- 来源: typeSource
44412
- });
44413
44387
  } else {
44414
- console.warn(`[发送消息] 在 dialog_files_ 缓存中未找到文件ID: ${fileId}`);
44415
44388
  if (fileInfo && fileInfo.fileName) {
44416
44389
  fileType = CommonUtil.getFileTypeFromFileName(fileInfo.fileName);
44417
44390
  typeSource = `根据文件名判断 (${fileInfo.fileName})`;
44418
- console.log(`[发送消息] 根据文件名判断文件类型:`, {
44419
- 文件ID: fileId,
44420
- 文件名: fileInfo.fileName,
44421
- 判断类型: fileType
44422
- });
44423
44391
  }
44424
44392
  }
44425
44393
  } else {
44426
- console.warn(`[发送消息] 未找到 dialog_files_ 缓存: ${filesKey}`);
44427
44394
  }
44428
44395
  }
44429
44396
  } catch (cacheError) {
44430
- console.error(`[发送消息] 从 dialog_files_ 缓存获取文件类型失败:`, cacheError);
44431
44397
  }
44432
44398
  }
44433
- console.log("[发送消息接口入参] 默认请求体格式 - 文件:", {
44434
- 文件ID: fileId,
44435
- 文件类型: fileType,
44436
- 来源: typeSource
44437
- });
44438
44399
  return {
44439
44400
  type: fileType,
44440
44401
  transfer_method: "local_file",
@@ -44463,11 +44424,6 @@ function CommentIndex({
44463
44424
  if (newUploadedFileIds.length > 0) {
44464
44425
  const filesArray = newUploadedFileIds.filter((fileId) => fileId).map((fileId) => {
44465
44426
  const fileType = CommonUtil.getFileTypeFromLocalStorage(fileId);
44466
- console.log("[发送消息接口入参] files字段 - 新上传文件:", {
44467
- 文件ID: fileId,
44468
- 从filesTypeArr获取的类型: fileType,
44469
- 来源: "localStorage.filesTypeArr"
44470
- });
44471
44427
  return {
44472
44428
  type: fileType,
44473
44429
  transfer_method: "local_file",
@@ -44938,13 +44894,11 @@ function CommentIndex({
44938
44894
  const formDataCache = localStorage.getItem(formDataKey);
44939
44895
  if (formDataCache) {
44940
44896
  const cachedFormData = JSON.parse(formDataCache);
44941
- console.log("[切换会话] 找到表单数据缓存:", cachedFormData);
44942
44897
  const filesKey = `dialog_files_${sessionId}`;
44943
44898
  const filesCache = localStorage.getItem(filesKey);
44944
44899
  let filesDataMap = {};
44945
44900
  if (filesCache) {
44946
44901
  const filesData = JSON.parse(filesCache);
44947
- console.log("[切换会话] 找到文件信息缓存:", filesData);
44948
44902
  filesDataMap = filesData.reduce((acc, file) => {
44949
44903
  if (!acc[file.variable]) {
44950
44904
  acc[file.variable] = [];
@@ -44962,7 +44916,6 @@ function CommentIndex({
44962
44916
  (file) => fileIds.includes(file.fileId)
44963
44917
  );
44964
44918
  if (matchedFiles.length > 0) {
44965
- console.log(`[切换会话] 恢复文件字段 ${variable}:`, matchedFiles);
44966
44919
  matchedFiles.forEach((file) => {
44967
44920
  restoredFileNamesMap[file.fileId] = file.fileName;
44968
44921
  if (file.fileType) {
@@ -44972,20 +44925,15 @@ function CommentIndex({
44972
44925
  }
44973
44926
  }
44974
44927
  });
44975
- console.log("[切换会话] 恢复的表单数据:", restoredFormData);
44976
44928
  } else {
44977
- console.log("[切换会话] 未找到表单数据缓存");
44978
44929
  const filesKey = `dialog_files_${sessionId}`;
44979
44930
  const filesCache = localStorage.getItem(filesKey);
44980
44931
  if (filesCache) {
44981
44932
  const filesData = JSON.parse(filesCache);
44982
- console.log("[切换会话] 找到文件信息缓存:", filesData);
44983
44933
  } else {
44984
- console.log("[切换会话] 未找到文件信息缓存");
44985
44934
  }
44986
44935
  }
44987
44936
  } catch (error) {
44988
- console.error("[切换会话] 查找本地缓存失败:", error);
44989
44937
  }
44990
44938
  setCurrentCommentSession({
44991
44939
  ...selectedSession,
@@ -45439,13 +45387,11 @@ function CommentIndex({
45439
45387
  let restoredFormData = {};
45440
45388
  if (formDataCache) {
45441
45389
  const cachedFormData = JSON.parse(formDataCache);
45442
- console.log("[智能体选择] 找到表单数据缓存:", cachedFormData);
45443
45390
  const filesKey = `dialog_files_${latestSession.id}`;
45444
45391
  const filesCache = localStorage.getItem(filesKey);
45445
45392
  let filesDataMap = {};
45446
45393
  if (filesCache) {
45447
45394
  const filesData = JSON.parse(filesCache);
45448
- console.log("[智能体选择] 找到文件信息缓存:", filesData);
45449
45395
  filesDataMap = filesData.reduce((acc, file) => {
45450
45396
  if (!acc[file.variable]) {
45451
45397
  acc[file.variable] = [];
@@ -45463,7 +45409,6 @@ function CommentIndex({
45463
45409
  (file) => fileIds.includes(file.fileId)
45464
45410
  );
45465
45411
  if (matchedFiles.length > 0) {
45466
- console.log(`[智能体选择] 恢复文件字段 ${variable}:`, matchedFiles);
45467
45412
  const fileNamesMap = { ...latestSession.fileNamesMap };
45468
45413
  const fileTypesMap = { ...latestSession.fileTypesMap };
45469
45414
  matchedFiles.forEach((file) => {
@@ -45481,16 +45426,12 @@ function CommentIndex({
45481
45426
  }
45482
45427
  }
45483
45428
  });
45484
- console.log("[智能体选择] 恢复的表单数据:", restoredFormData);
45485
45429
  } else {
45486
- console.log("[智能体选择] 未找到表单数据缓存");
45487
45430
  const filesKey = `dialog_files_${latestSession.id}`;
45488
45431
  const filesCache = localStorage.getItem(filesKey);
45489
45432
  if (filesCache) {
45490
45433
  const filesData = JSON.parse(filesCache);
45491
- console.log("[智能体选择] 找到文件信息缓存:", filesData);
45492
45434
  } else {
45493
- console.log("[智能体选择] 未找到文件信息缓存");
45494
45435
  }
45495
45436
  }
45496
45437
  if (!formDataCache) {
@@ -45500,7 +45441,6 @@ function CommentIndex({
45500
45441
  } : prev);
45501
45442
  }
45502
45443
  } catch (error) {
45503
- console.error("[智能体选择] 查找本地缓存失败:", error);
45504
45444
  }
45505
45445
  if (aiContent && aiContent.trim()) {
45506
45446
  setPendingAiContentToSend(aiContent.trim());
@@ -45803,13 +45743,6 @@ function CommentIndex({
45803
45743
  return chatList;
45804
45744
  });
45805
45745
  }, []);
45806
- const handleThinkStatus = (status) => {
45807
- if (status) {
45808
- setIsThink(true);
45809
- } else {
45810
- setIsThink(false);
45811
- }
45812
- };
45813
45746
  const handleToggleChatHistory = useCallback(() => {
45814
45747
  setChatHistoryVisible((prevState) => {
45815
45748
  const newState = !prevState;
@@ -45884,11 +45817,19 @@ function CommentIndex({
45884
45817
  }
45885
45818
  if (!agent) {
45886
45819
  try {
45887
- const [appAgents, toolsAgents] = await Promise.all([
45888
- getAgentList("app"),
45889
- getAgentList("tools")
45890
- ]);
45891
- const allAgents = [...appAgents, ...toolsAgents];
45820
+ let agentPromises = [];
45821
+ if (appTypeOptions && appTypeOptions.length > 0) {
45822
+ agentPromises = appTypeOptions.map(
45823
+ (option) => getAgentList(option.dictValue)
45824
+ );
45825
+ } else {
45826
+ agentPromises = [
45827
+ getAgentList("app"),
45828
+ getAgentList("tools")
45829
+ ];
45830
+ }
45831
+ const agentResults = await Promise.all(agentPromises);
45832
+ const allAgents = agentResults.flat();
45892
45833
  setAgentList(allAgents);
45893
45834
  agent = allAgents.find((a) => a.id === agentId);
45894
45835
  } catch (error) {
@@ -45928,17 +45869,12 @@ function CommentIndex({
45928
45869
  clearCurrentChatList,
45929
45870
  renameSessionTitle,
45930
45871
  triggerSessionSidebar,
45931
- onThinkStatusSend: handleThinkStatus,
45932
45872
  onToggleChatHistory: handleToggleChatHistory,
45933
45873
  onToggleAgentList: handleToggleAgentList,
45934
45874
  chatHistoryVisible,
45935
45875
  agentListVisible,
45936
45876
  onNavigateView,
45937
45877
  currentAgentName: (currentCommentSession == null ? void 0 : currentCommentSession.agentName) || ((_a2 = agentList.find((agent) => agent.id === selectedAgentId)) == null ? void 0 : _a2.name) || "",
45938
- currentAgentCustomize: (_b = agentList.find(
45939
- (agent) => agent.id === (currentCommentSession == null ? void 0 : currentCommentSession.agentId) || agent.id === selectedAgentId
45940
- )) == null ? void 0 : _b.customize,
45941
- isThinkInitial: isThink,
45942
45878
  onBackToAiList,
45943
45879
  showBackButton: pageType === "xinXiaoYi" ? false : true,
45944
45880
  handleBack
@@ -46013,12 +45949,6 @@ function CommentIndex({
46013
45949
  }
46014
45950
  },
46015
45951
  onUploadSuccess: (fileId, fileName, variable, mimeType, extension2, fileType) => {
46016
- console.log("[文件上传成功] 开始更新 fileNamesMap:", {
46017
- fileId,
46018
- fileName,
46019
- variable,
46020
- currentCommentSessionId
46021
- });
46022
45952
  if (currentCommentSessionId) {
46023
45953
  LocalForageService.getItem("session_list").then((sessionList) => {
46024
45954
  const newSessionList = [
@@ -46030,18 +45960,7 @@ function CommentIndex({
46030
45960
  if (sessionIndex >= 0) {
46031
45961
  const currentSession = newSessionList[sessionIndex];
46032
45962
  const fileNamesMap = currentSession.fileNamesMap || {};
46033
- console.log("[文件上传成功] 更新前的 fileNamesMap:", {
46034
- fileNamesMap,
46035
- fileNamesMapKeys: Object.keys(fileNamesMap),
46036
- currentSessionFileNamesMap: currentSession.fileNamesMap
46037
- });
46038
45963
  fileNamesMap[fileId] = fileName;
46039
- console.log("[文件上传成功] 更新后的 fileNamesMap:", {
46040
- fileNamesMap,
46041
- fileNamesMapKeys: Object.keys(fileNamesMap),
46042
- newFileId: fileId,
46043
- newFileName: fileName
46044
- });
46045
45964
  newSessionList[sessionIndex] = {
46046
45965
  ...currentSession,
46047
45966
  fileNamesMap
@@ -46056,7 +45975,6 @@ function CommentIndex({
46056
45975
  setCurrentCommentSession(
46057
45976
  newSessionList[sessionIndex]
46058
45977
  );
46059
- console.log("[文件上传成功] fileNamesMap 已保存到存储和状态");
46060
45978
  try {
46061
45979
  const fileInfo = {
46062
45980
  sessionId: currentCommentSessionId,
@@ -46075,7 +45993,6 @@ function CommentIndex({
46075
45993
  try {
46076
45994
  filesList = JSON.parse(existingFilesData);
46077
45995
  } catch (parseError) {
46078
- console.warn("解析已存储的文件列表失败:", parseError);
46079
45996
  filesList = [];
46080
45997
  }
46081
45998
  }
@@ -46086,26 +46003,15 @@ function CommentIndex({
46086
46003
  filesList.push(fileInfo);
46087
46004
  }
46088
46005
  localStorage.setItem(existingFilesKey, JSON.stringify(filesList));
46089
- console.log("文件信息已存储到本地缓存:", fileInfo);
46090
46006
  } catch (error) {
46091
- console.error("存储文件信息到本地缓存失败:", error);
46092
46007
  }
46093
- } else {
46094
- console.warn("[文件上传成功] 未找到会话,sessionIndex:", sessionIndex);
46095
46008
  }
46096
46009
  });
46097
- } else {
46098
- console.warn("[文件上传成功] currentCommentSessionId 为空");
46099
46010
  }
46100
46011
  },
46101
46012
  onUploadError: (error) => {
46102
46013
  },
46103
46014
  onFileDelete: (fileId, variable) => {
46104
- console.log("[文件删除] 开始删除文件缓存:", {
46105
- fileId,
46106
- variable,
46107
- currentCommentSessionId
46108
- });
46109
46015
  if (currentCommentSessionId) {
46110
46016
  try {
46111
46017
  const filesKey = `dialog_files_${currentCommentSessionId}`;
@@ -46115,12 +46021,9 @@ function CommentIndex({
46115
46021
  const updatedFilesData = filesData.filter((file) => file.fileId !== fileId);
46116
46022
  if (updatedFilesData.length !== filesData.length) {
46117
46023
  localStorage.setItem(filesKey, JSON.stringify(updatedFilesData));
46118
- console.log(`[文件删除] 已从缓存中删除文件 ${fileId},剩余文件数量:`, updatedFilesData.length);
46119
46024
  } else {
46120
- console.log(`[文件删除] 缓存中未找到文件 ${fileId}`);
46121
46025
  }
46122
46026
  } else {
46123
- console.log(`[文件删除] 未找到文件缓存: ${filesKey}`);
46124
46027
  }
46125
46028
  LocalForageService.getItem("session_list").then((sessionList) => {
46126
46029
  const newSessionList = [...sessionList || []];
@@ -46139,14 +46042,11 @@ function CommentIndex({
46139
46042
  fileTypesMap
46140
46043
  };
46141
46044
  LocalForageService.setItem("session_list", newSessionList);
46142
- console.log("[测试卡顿]11", newSessionList);
46143
46045
  setCommentSessionList(newSessionList);
46144
46046
  setCurrentCommentSession(newSessionList[sessionIndex]);
46145
- console.log(`[文件删除] 已更新会话中的文件映射,删除文件 ${fileId}`);
46146
46047
  }
46147
46048
  });
46148
46049
  } catch (error) {
46149
- console.error("[文件删除] 删除文件缓存失败:", error);
46150
46050
  }
46151
46051
  }
46152
46052
  },
@@ -46342,19 +46242,36 @@ function CommentIndex({
46342
46242
  }
46343
46243
  }
46344
46244
  ) }),
46345
- /* @__PURE__ */ jsxRuntimeExports.jsx(
46346
- TextArea,
46347
- {
46348
- className: "comment-send-input",
46349
- placeholder: !currentCommentSessionId ? "请先创建对话" : "Enter发送, Shift+Enter换行。",
46350
- value: userChatContent,
46351
- autosize: { minRows: 1, maxRows: 1 },
46352
- onChange: (value) => changeUserChatContent(value),
46353
- onEnterPress: chatEnterPress,
46354
- ref: sendInputRef,
46355
- disabled: !currentCommentSessionId
46356
- }
46357
- ),
46245
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "comment-input-container", children: [
46246
+ ((_b = agentList.find(
46247
+ (agent) => agent.id === selectedAgentId || agent.id === (currentCommentSession == null ? void 0 : currentCommentSession.agentId)
46248
+ )) == null ? void 0 : _b.customize) === "智能问答" && /* @__PURE__ */ jsxRuntimeExports.jsx(
46249
+ Button,
46250
+ {
46251
+ className: `comment-think-button ${isThink ? "active" : ""}`,
46252
+ theme: "borderless",
46253
+ type: "tertiary",
46254
+ onClick: () => {
46255
+ setIsThink(!isThink);
46256
+ },
46257
+ disabled: !currentCommentSessionId,
46258
+ children: "深度思考"
46259
+ }
46260
+ ),
46261
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
46262
+ TextArea,
46263
+ {
46264
+ className: "comment-send-input",
46265
+ placeholder: !currentCommentSessionId ? "请先创建对话" : "Enter发送, Shift+Enter换行。",
46266
+ value: userChatContent,
46267
+ autosize: { minRows: 1, maxRows: 1 },
46268
+ onChange: (value) => changeUserChatContent(value),
46269
+ onEnterPress: chatEnterPress,
46270
+ ref: sendInputRef,
46271
+ disabled: !currentCommentSessionId
46272
+ }
46273
+ )
46274
+ ] }),
46358
46275
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "comment-addon-box", children: [
46359
46276
  /* @__PURE__ */ jsxRuntimeExports.jsx(Divider, { layout: "vertical", margin: "6px" }),
46360
46277
  fileUploadEnabled && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
@@ -46490,7 +46407,7 @@ const BlockEdit = ({
46490
46407
  const initVueEditor = async () => {
46491
46408
  if (editorRef.current) {
46492
46409
  try {
46493
- const BlockNoteEditorModule = await import("./index.es-67G0dUQ8.js");
46410
+ const BlockNoteEditorModule = await import("./index.es-Fq7tEj25.js");
46494
46411
  const BlockNoteEditor = BlockNoteEditorModule.BlockNoteEditor;
46495
46412
  const theme = {
46496
46413
  colors: {
@@ -46768,6 +46685,7 @@ const AgentWebIndex = ({
46768
46685
  {
46769
46686
  baseUrl,
46770
46687
  token,
46688
+ appTypeOptions,
46771
46689
  onBackToAiList: handleBackToAiList,
46772
46690
  onNavigateView: (nextView) => setView(nextView),
46773
46691
  pageType,
@@ -47412,7 +47330,8 @@ const AiBlockEdit = ({
47412
47330
  getSetBlockContent,
47413
47331
  baseUrl,
47414
47332
  token,
47415
- onBack
47333
+ onBack,
47334
+ onRegenerate
47416
47335
  }) => {
47417
47336
  useNavigate();
47418
47337
  const [searchParams] = useSearchParams();
@@ -47444,7 +47363,7 @@ const AiBlockEdit = ({
47444
47363
  const initVueEditor = async () => {
47445
47364
  if (editorRef.current) {
47446
47365
  try {
47447
- const BlockNoteEditorModule = await import("./index.es-67G0dUQ8.js");
47366
+ const BlockNoteEditorModule = await import("./index.es-Fq7tEj25.js");
47448
47367
  const BlockNoteEditor = BlockNoteEditorModule.BlockNoteEditor;
47449
47368
  const theme = {
47450
47369
  colors: {
@@ -47659,6 +47578,78 @@ const AiBlockEdit = ({
47659
47578
  }
47660
47579
  }
47661
47580
  }
47581
+ const hasUnacceptedInsertInDocument = (content2) => {
47582
+ if (!Array.isArray(content2)) return false;
47583
+ const hasUnacceptedInsertInNode = (node2) => {
47584
+ if (!node2 || typeof node2 !== "object") return false;
47585
+ const props = node2.props || node2.attributes || {};
47586
+ const meta = node2.meta || node2.attrs || {};
47587
+ const isPendingFlag = (obj) => {
47588
+ if (!obj || typeof obj !== "object") return false;
47589
+ const status = obj.status || obj.insertStatus || obj.aiStatus || obj.aiInsertStatus || obj.changeStatus || obj.suggestionStatus;
47590
+ const type = obj.type || obj.changeType || obj.actionType;
47591
+ const accepted = obj.accepted ?? obj.resolved ?? obj.confirmed;
47592
+ if (typeof status === "string" && status.toLowerCase().includes("pending")) {
47593
+ return true;
47594
+ }
47595
+ if (typeof type === "string" && type.toLowerCase().includes("insert") && accepted === false) {
47596
+ return true;
47597
+ }
47598
+ if (obj.pending === true || obj.isPending === true) {
47599
+ return true;
47600
+ }
47601
+ if (obj.insertPending === true || obj.unacceptedInsert === true) {
47602
+ return true;
47603
+ }
47604
+ return false;
47605
+ };
47606
+ if (isPendingFlag(props) || isPendingFlag(meta) || isPendingFlag(node2)) {
47607
+ return true;
47608
+ }
47609
+ const marks = node2.marks;
47610
+ if (Array.isArray(marks) && marks.some((m) => isPendingFlag(m))) {
47611
+ return true;
47612
+ }
47613
+ const children = [];
47614
+ if (Array.isArray(node2.content)) {
47615
+ children.push(...node2.content);
47616
+ }
47617
+ if (Array.isArray(node2.children)) {
47618
+ children.push(...node2.children);
47619
+ }
47620
+ return children.some((child) => hasUnacceptedInsertInNode(child));
47621
+ };
47622
+ return content2.some((node2) => hasUnacceptedInsertInNode(node2));
47623
+ };
47624
+ const hasPendingInsertInDom = () => {
47625
+ try {
47626
+ const container = document.querySelector(
47627
+ ".blocknote-editor-container"
47628
+ );
47629
+ if (!container) return false;
47630
+ if (container.querySelector(
47631
+ "[data-ai-insert-pending],[data-insert-pending],[data-pending-insert]"
47632
+ )) {
47633
+ return true;
47634
+ }
47635
+ if (container.querySelector(
47636
+ ".ai-insert-pending,.bn-ai-suggestion,.bn-ai-pending"
47637
+ )) {
47638
+ return true;
47639
+ }
47640
+ const buttons = Array.from(
47641
+ container.querySelectorAll("button")
47642
+ );
47643
+ const hasReviewButtons = buttons.some((btn) => {
47644
+ const text2 = (btn.textContent || "").trim();
47645
+ return text2 === "接受" || text2 === "取消";
47646
+ });
47647
+ return hasReviewButtons;
47648
+ } catch (e) {
47649
+ console.warn("DOM 检查待确认插入内容失败:", e);
47650
+ return false;
47651
+ }
47652
+ };
47662
47653
  async function handleExportWord() {
47663
47654
  var _a2, _b;
47664
47655
  if (exporting) return;
@@ -47669,6 +47660,28 @@ const AiBlockEdit = ({
47669
47660
  Toast.error("编辑器尚未就绪,稍后再试");
47670
47661
  return;
47671
47662
  }
47663
+ let hasPendingInsert = false;
47664
+ try {
47665
+ const anyEditor = editor;
47666
+ if (typeof anyEditor.hasPendingInsert === "function") {
47667
+ hasPendingInsert = !!anyEditor.hasPendingInsert();
47668
+ } else if (typeof anyEditor.hasUnacceptedInsert === "function") {
47669
+ hasPendingInsert = !!anyEditor.hasUnacceptedInsert();
47670
+ } else if (Array.isArray(anyEditor.document)) {
47671
+ hasPendingInsert = hasUnacceptedInsertInDocument(anyEditor.document);
47672
+ }
47673
+ if (!hasPendingInsert) {
47674
+ hasPendingInsert = hasPendingInsertInDom();
47675
+ }
47676
+ } catch (checkErr) {
47677
+ console.warn("检查插入内容状态失败:", checkErr);
47678
+ }
47679
+ if (hasPendingInsert) {
47680
+ Toast.warning(
47681
+ "当前文档中存在待确认的插入内容,请在编辑器中接受或取消后再导出"
47682
+ );
47683
+ return;
47684
+ }
47672
47685
  const content2 = editor.document;
47673
47686
  const { Document, Packer, Paragraph, TextRun, HeadingLevel } = await import("docx");
47674
47687
  const paragraphs = [];
@@ -47820,7 +47833,14 @@ const AiBlockEdit = ({
47820
47833
  };
47821
47834
  const handleSaveHistory = async () => {
47822
47835
  var _a2, _b;
47823
- console.log("handleSaveHistory", currentConversationId, "baseUrl", baseUrl, "historyList", historyList);
47836
+ console.log(
47837
+ "handleSaveHistory",
47838
+ currentConversationId,
47839
+ "baseUrl",
47840
+ baseUrl,
47841
+ "historyList",
47842
+ historyList
47843
+ );
47824
47844
  const userId = (baseUrl == null ? void 0 : baseUrl.userId) || "";
47825
47845
  if (!userId) {
47826
47846
  Toast.error("获取用户ID失败");
@@ -47924,6 +47944,12 @@ const AiBlockEdit = ({
47924
47944
  setHistoryHasMore(true);
47925
47945
  getHistoryFromIndexedDB();
47926
47946
  };
47947
+ const handleRegenerate = () => {
47948
+ console.log("handleRegenerate");
47949
+ if (onRegenerate) {
47950
+ onRegenerate(currentConversationId);
47951
+ }
47952
+ };
47927
47953
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
47928
47954
  "div",
47929
47955
  {
@@ -47949,10 +47975,19 @@ const AiBlockEdit = ({
47949
47975
  ] }),
47950
47976
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "block-edit-right", children: [
47951
47977
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "block-edit-right-header", children: [
47978
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
47979
+ Button,
47980
+ {
47981
+ theme: "outline",
47982
+ type: "tertiary",
47983
+ className: "block-edit-right-header-regenerate",
47984
+ onClick: handleRegenerate,
47985
+ children: "重新生成"
47986
+ }
47987
+ ),
47952
47988
  currentConversationId && /* @__PURE__ */ jsxRuntimeExports.jsx(
47953
47989
  Button,
47954
47990
  {
47955
- theme: "borderless",
47956
47991
  type: "tertiary",
47957
47992
  className: "block-edit-right-header-export",
47958
47993
  onClick: handleSaveHistory,
@@ -48370,7 +48405,7 @@ class BasePromptTemplate extends Runnable {
48370
48405
  return PromptTemplate2.deserialize({ ...data, _type: "prompt" });
48371
48406
  }
48372
48407
  case "few_shot": {
48373
- const { FewShotPromptTemplate } = await import("./few_shot-CAlLA7_Y.js");
48408
+ const { FewShotPromptTemplate } = await import("./few_shot-D1fV7wmE.js");
48374
48409
  return FewShotPromptTemplate.deserialize(data);
48375
48410
  }
48376
48411
  default:
@@ -49942,35 +49977,35 @@ class BaseChain extends BaseLangChain {
49942
49977
  static async deserialize(data, values = {}) {
49943
49978
  switch (data._type) {
49944
49979
  case "llm_chain": {
49945
- const { LLMChain } = await import("./llm_chain-AXaQuXMt.js");
49980
+ const { LLMChain } = await import("./llm_chain-5NVYgTDC.js");
49946
49981
  return LLMChain.deserialize(data);
49947
49982
  }
49948
49983
  case "sequential_chain": {
49949
- const { SequentialChain } = await import("./sequential_chain-DVxvWiQQ.js");
49984
+ const { SequentialChain } = await import("./sequential_chain-B3aNFa_8.js");
49950
49985
  return SequentialChain.deserialize(data);
49951
49986
  }
49952
49987
  case "simple_sequential_chain": {
49953
- const { SimpleSequentialChain } = await import("./sequential_chain-DVxvWiQQ.js");
49988
+ const { SimpleSequentialChain } = await import("./sequential_chain-B3aNFa_8.js");
49954
49989
  return SimpleSequentialChain.deserialize(data);
49955
49990
  }
49956
49991
  case "stuff_documents_chain": {
49957
- const { StuffDocumentsChain } = await import("./combine_docs_chain-C4dphi5e.js");
49992
+ const { StuffDocumentsChain } = await import("./combine_docs_chain-CO7HVb4R.js");
49958
49993
  return StuffDocumentsChain.deserialize(data);
49959
49994
  }
49960
49995
  case "map_reduce_documents_chain": {
49961
- const { MapReduceDocumentsChain } = await import("./combine_docs_chain-C4dphi5e.js");
49996
+ const { MapReduceDocumentsChain } = await import("./combine_docs_chain-CO7HVb4R.js");
49962
49997
  return MapReduceDocumentsChain.deserialize(data);
49963
49998
  }
49964
49999
  case "refine_documents_chain": {
49965
- const { RefineDocumentsChain } = await import("./combine_docs_chain-C4dphi5e.js");
50000
+ const { RefineDocumentsChain } = await import("./combine_docs_chain-CO7HVb4R.js");
49966
50001
  return RefineDocumentsChain.deserialize(data);
49967
50002
  }
49968
50003
  case "vector_db_qa": {
49969
- const { VectorDBQAChain } = await import("./vector_db_qa-Ca-yXUO_.js");
50004
+ const { VectorDBQAChain } = await import("./vector_db_qa-BlC0aeM2.js");
49970
50005
  return VectorDBQAChain.deserialize(data, values);
49971
50006
  }
49972
50007
  case "api_chain": {
49973
- const { APIChain } = await import("./api_chain-wgmc7e6E.js");
50008
+ const { APIChain } = await import("./api_chain-6WuaFa6d.js");
49974
50009
  return APIChain.deserialize(data);
49975
50010
  }
49976
50011
  default: