rhua-chatgpt-web 1.0.99 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dist/{api_chain-C2BsZcfa.js → api_chain-BhV6_Pmq.js} +2 -2
  2. package/dist/{api_chain-D2AEAwf2.cjs → api_chain-DVLnAgiW.cjs} +1 -1
  3. package/dist/{combine_docs_chain-D0ygQAil.js → combine_docs_chain-B9QorZsY.js} +2 -2
  4. package/dist/{combine_docs_chain-BwUcmS0t.cjs → combine_docs_chain-D8mHPBmd.cjs} +1 -1
  5. package/dist/{few_shot-CHQMukLV.js → few_shot-CFSdacSl.js} +1 -1
  6. package/dist/{few_shot-CQMLIcvu.cjs → few_shot-bRG5F-EG.cjs} +1 -1
  7. package/dist/{index-D1EyeOGY.cjs → index-9eExIDsS.cjs} +1 -1
  8. package/dist/{index-DiJKM8e3.cjs → index-B1Wlx-OU.cjs} +1 -1
  9. package/dist/{index-Ddt8e4jQ.js → index-B4QG5JFW.js} +1 -1
  10. package/dist/{index-CUbh3CUk.cjs → index-B9enJf5m.cjs} +1 -1
  11. package/dist/index-BDLTve4Z.js +4 -0
  12. package/dist/{index-DKj4xxCF.cjs → index-BKYMy9rL.cjs} +1 -1
  13. package/dist/{index-DkwjGulR.cjs → index-BUvzgpbD.cjs} +1 -1
  14. package/dist/{index-3uuVdHPW.js → index-B_Zc2AO-.js} +1 -1
  15. package/dist/{index-DDtVKZHe.cjs → index-Bm3Y9HAz.cjs} +1 -1
  16. package/dist/{index-D3WYQbg9.cjs → index-BmJffSUR.cjs} +1 -1
  17. package/dist/{index-NFb6Ikqb.cjs → index-BwGX7L-I.cjs} +1 -1
  18. package/dist/{index-DlDIFIcy.js → index-BxehhQJ1.js} +1 -1
  19. package/dist/{index-D9geeS71.js → index-Bz6sXppL.js} +2 -2
  20. package/dist/{index-DPo7N7-F.js → index-C0mX7ZGP.js} +138 -14
  21. package/dist/{index-vJhPvv3A.js → index-CM5Ei0Fe.js} +2 -2
  22. package/dist/{index-B4HXYy58.js → index-CR8ZslxC.js} +1 -1
  23. package/dist/{index-CvkY01OP.cjs → index-CiJIlOWe.cjs} +1 -1
  24. package/dist/{index-CUTMmRLO.cjs → index-Dg40JuSw.cjs} +1 -1
  25. package/dist/{index-xQlqRtFE.cjs → index-DmZ6JkXr.cjs} +2 -2
  26. package/dist/{index-5hC-EuRW.cjs → index-DrzloHWR.cjs} +1 -1
  27. package/dist/index-NaKA8k_1.js +4 -0
  28. package/dist/index-m3hI35_N.js +4 -0
  29. package/dist/{index-DDNOIr8O.js → index-szMPQlBb.js} +1 -1
  30. package/dist/index-x-JUDIDN.js +4 -0
  31. package/dist/index.cjs.js +1 -1
  32. package/dist/{index.es-B9waF7p1.cjs → index.es-B2V8NsVE.cjs} +2 -2
  33. package/dist/{index.es-muo7iWsn.js → index.es-lGV9_rDo.js} +11 -11
  34. package/dist/index.esm.js +1 -1
  35. package/dist/{llm_chain-FiDBkCHX.js → llm_chain-1pCOifVt.js} +1 -1
  36. package/dist/{llm_chain-BVEQefX9.cjs → llm_chain-D4IZ67iH.cjs} +1 -1
  37. package/dist/{sequential_chain-C89zWQZZ.js → sequential_chain-B9oXR3Bd.js} +1 -1
  38. package/dist/{sequential_chain-hcM_0OeZ.cjs → sequential_chain-DlVTyzea.cjs} +1 -1
  39. package/dist/style.css +1 -1
  40. package/dist/{vector_db_qa-Cxtn-hGw.js → vector_db_qa-BrELsB11.js} +3 -3
  41. package/dist/{vector_db_qa-DpnOTF2e.cjs → vector_db_qa-CYd9aCx5.cjs} +1 -1
  42. package/package.json +1 -1
  43. package/dist/index-BMeyd5Mb.js +0 -4
  44. package/dist/index-CE38VgAV.js +0 -4
  45. package/dist/index-D5IEaWdP.js +0 -4
  46. package/dist/index-Da-yc0Sn.js +0 -4
@@ -46407,7 +46407,7 @@ const BlockEdit = ({
46407
46407
  const initVueEditor = async () => {
46408
46408
  if (editorRef.current) {
46409
46409
  try {
46410
- const BlockNoteEditorModule = await import("./index.es-muo7iWsn.js");
46410
+ const BlockNoteEditorModule = await import("./index.es-lGV9_rDo.js");
46411
46411
  const BlockNoteEditor = BlockNoteEditorModule.BlockNoteEditor;
46412
46412
  const theme = {
46413
46413
  colors: {
@@ -47330,7 +47330,8 @@ const AiBlockEdit = ({
47330
47330
  getSetBlockContent,
47331
47331
  baseUrl,
47332
47332
  token,
47333
- onBack
47333
+ onBack,
47334
+ onRegenerate
47334
47335
  }) => {
47335
47336
  useNavigate();
47336
47337
  const [searchParams] = useSearchParams();
@@ -47362,7 +47363,7 @@ const AiBlockEdit = ({
47362
47363
  const initVueEditor = async () => {
47363
47364
  if (editorRef.current) {
47364
47365
  try {
47365
- const BlockNoteEditorModule = await import("./index.es-muo7iWsn.js");
47366
+ const BlockNoteEditorModule = await import("./index.es-lGV9_rDo.js");
47366
47367
  const BlockNoteEditor = BlockNoteEditorModule.BlockNoteEditor;
47367
47368
  const theme = {
47368
47369
  colors: {
@@ -47577,6 +47578,78 @@ const AiBlockEdit = ({
47577
47578
  }
47578
47579
  }
47579
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
+ };
47580
47653
  async function handleExportWord() {
47581
47654
  var _a2, _b;
47582
47655
  if (exporting) return;
@@ -47587,6 +47660,28 @@ const AiBlockEdit = ({
47587
47660
  Toast.error("编辑器尚未就绪,稍后再试");
47588
47661
  return;
47589
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
+ }
47590
47685
  const content2 = editor.document;
47591
47686
  const { Document, Packer, Paragraph, TextRun, HeadingLevel } = await import("docx");
47592
47687
  const paragraphs = [];
@@ -47738,7 +47833,14 @@ const AiBlockEdit = ({
47738
47833
  };
47739
47834
  const handleSaveHistory = async () => {
47740
47835
  var _a2, _b;
47741
- console.log("handleSaveHistory", currentConversationId, "baseUrl", baseUrl, "historyList", historyList);
47836
+ console.log(
47837
+ "handleSaveHistory",
47838
+ currentConversationId,
47839
+ "baseUrl",
47840
+ baseUrl,
47841
+ "historyList",
47842
+ historyList
47843
+ );
47742
47844
  const userId = (baseUrl == null ? void 0 : baseUrl.userId) || "";
47743
47845
  if (!userId) {
47744
47846
  Toast.error("获取用户ID失败");
@@ -47842,6 +47944,19 @@ const AiBlockEdit = ({
47842
47944
  setHistoryHasMore(true);
47843
47945
  getHistoryFromIndexedDB();
47844
47946
  };
47947
+ const handleRegenerate = () => {
47948
+ if (!onRegenerate) {
47949
+ return;
47950
+ }
47951
+ let item = historyList.find(
47952
+ (item2) => item2.conversationId == currentConversationId
47953
+ );
47954
+ if (!item) {
47955
+ Toast.error("未找到历史记录");
47956
+ return;
47957
+ }
47958
+ onRegenerate(item);
47959
+ };
47845
47960
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
47846
47961
  "div",
47847
47962
  {
@@ -47867,10 +47982,19 @@ const AiBlockEdit = ({
47867
47982
  ] }),
47868
47983
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "block-edit-right", children: [
47869
47984
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "block-edit-right-header", children: [
47985
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
47986
+ Button,
47987
+ {
47988
+ theme: "outline",
47989
+ type: "tertiary",
47990
+ className: "block-edit-right-header-regenerate",
47991
+ onClick: handleRegenerate,
47992
+ children: "重新生成"
47993
+ }
47994
+ ),
47870
47995
  currentConversationId && /* @__PURE__ */ jsxRuntimeExports.jsx(
47871
47996
  Button,
47872
47997
  {
47873
- theme: "borderless",
47874
47998
  type: "tertiary",
47875
47999
  className: "block-edit-right-header-export",
47876
48000
  onClick: handleSaveHistory,
@@ -48288,7 +48412,7 @@ class BasePromptTemplate extends Runnable {
48288
48412
  return PromptTemplate2.deserialize({ ...data, _type: "prompt" });
48289
48413
  }
48290
48414
  case "few_shot": {
48291
- const { FewShotPromptTemplate } = await import("./few_shot-CHQMukLV.js");
48415
+ const { FewShotPromptTemplate } = await import("./few_shot-CFSdacSl.js");
48292
48416
  return FewShotPromptTemplate.deserialize(data);
48293
48417
  }
48294
48418
  default:
@@ -49860,35 +49984,35 @@ class BaseChain extends BaseLangChain {
49860
49984
  static async deserialize(data, values = {}) {
49861
49985
  switch (data._type) {
49862
49986
  case "llm_chain": {
49863
- const { LLMChain } = await import("./llm_chain-FiDBkCHX.js");
49987
+ const { LLMChain } = await import("./llm_chain-1pCOifVt.js");
49864
49988
  return LLMChain.deserialize(data);
49865
49989
  }
49866
49990
  case "sequential_chain": {
49867
- const { SequentialChain } = await import("./sequential_chain-C89zWQZZ.js");
49991
+ const { SequentialChain } = await import("./sequential_chain-B9oXR3Bd.js");
49868
49992
  return SequentialChain.deserialize(data);
49869
49993
  }
49870
49994
  case "simple_sequential_chain": {
49871
- const { SimpleSequentialChain } = await import("./sequential_chain-C89zWQZZ.js");
49995
+ const { SimpleSequentialChain } = await import("./sequential_chain-B9oXR3Bd.js");
49872
49996
  return SimpleSequentialChain.deserialize(data);
49873
49997
  }
49874
49998
  case "stuff_documents_chain": {
49875
- const { StuffDocumentsChain } = await import("./combine_docs_chain-D0ygQAil.js");
49999
+ const { StuffDocumentsChain } = await import("./combine_docs_chain-B9QorZsY.js");
49876
50000
  return StuffDocumentsChain.deserialize(data);
49877
50001
  }
49878
50002
  case "map_reduce_documents_chain": {
49879
- const { MapReduceDocumentsChain } = await import("./combine_docs_chain-D0ygQAil.js");
50003
+ const { MapReduceDocumentsChain } = await import("./combine_docs_chain-B9QorZsY.js");
49880
50004
  return MapReduceDocumentsChain.deserialize(data);
49881
50005
  }
49882
50006
  case "refine_documents_chain": {
49883
- const { RefineDocumentsChain } = await import("./combine_docs_chain-D0ygQAil.js");
50007
+ const { RefineDocumentsChain } = await import("./combine_docs_chain-B9QorZsY.js");
49884
50008
  return RefineDocumentsChain.deserialize(data);
49885
50009
  }
49886
50010
  case "vector_db_qa": {
49887
- const { VectorDBQAChain } = await import("./vector_db_qa-Cxtn-hGw.js");
50011
+ const { VectorDBQAChain } = await import("./vector_db_qa-BrELsB11.js");
49888
50012
  return VectorDBQAChain.deserialize(data, values);
49889
50013
  }
49890
50014
  case "api_chain": {
49891
- const { APIChain } = await import("./api_chain-C2BsZcfa.js");
50015
+ const { APIChain } = await import("./api_chain-BhV6_Pmq.js");
49892
50016
  return APIChain.deserialize(data);
49893
50017
  }
49894
50018
  default:
@@ -1,5 +1,5 @@
1
- import { O as toText, Q as phrasing$2, T as structuredClone, w as whitespace, U as visit, W as EXIT, X as toString, S as SKIP, Y as position } from "./index-DPo7N7-F.js";
2
- import { m as minifyWhitespace, p as phrasing$1 } from "./index-Ddt8e4jQ.js";
1
+ import { O as toText, Q as phrasing$2, T as structuredClone, w as whitespace, U as visit, W as EXIT, X as toString, S as SKIP, Y as position } from "./index-C0mX7ZGP.js";
2
+ import { m as minifyWhitespace, p as phrasing$1 } from "./index-B4QG5JFW.js";
3
3
  function rehypeMinifyWhitespace(options) {
4
4
  return function(tree) {
5
5
  minifyWhitespace(tree, options);
@@ -1,5 +1,5 @@
1
1
  import { z as zwitch } from "./index-BEZf1ZPW.js";
2
- import { q as formatCodeAsIndented, s as formatHeadingAsSetext, t as decodeString, x as encodeCharacterReference, y as patternInScope, z as handle } from "./index-DPo7N7-F.js";
2
+ import { q as formatCodeAsIndented, s as formatHeadingAsSetext, t as decodeString, x as encodeCharacterReference, y as patternInScope, z as handle } from "./index-C0mX7ZGP.js";
3
3
  const own = {}.hasOwnProperty;
4
4
  function configure(base, extension) {
5
5
  let index = -1;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-xQlqRtFE.cjs");exports.default=e.remarkGfm;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DmZ6JkXr.cjs");exports.default=e.remarkGfm;