rhua-chatgpt-web 1.0.67 → 1.0.68

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 (45) hide show
  1. package/dist/{api_chain-yscHGx8y.cjs → api_chain-B3_1idZG.cjs} +1 -1
  2. package/dist/{api_chain-DqjloRDK.js → api_chain-x7-sx3WZ.js} +2 -2
  3. package/dist/{combine_docs_chain-NeRy0Hbg.js → combine_docs_chain-BuCRFs9X.js} +2 -2
  4. package/dist/{combine_docs_chain-D-MInUmA.cjs → combine_docs_chain-BuKFBaSR.cjs} +1 -1
  5. package/dist/{few_shot-DX4-H9PV.cjs → few_shot-CAkXHDSk.cjs} +1 -1
  6. package/dist/{few_shot-krMIGhtD.js → few_shot-gSVVGxla.js} +1 -1
  7. package/dist/{index-D5DVRfMz.js → index-B2mOy3px.js} +125 -29
  8. package/dist/{index-BwzHvEo6.cjs → index-B6q_-fn0.cjs} +1 -1
  9. package/dist/{index-BmCPSCQs.cjs → index-BNHYcbW9.cjs} +1 -1
  10. package/dist/{index-BLMLClaY.cjs → index-BPOwxSsE.cjs} +1 -1
  11. package/dist/{index-NgRVAZkA.cjs → index-BoJJURzS.cjs} +1 -1
  12. package/dist/{index--JDUSkfF.cjs → index-BxbBMygZ.cjs} +1 -1
  13. package/dist/{index-CQB1mOJA.js → index-C01jKhMN.js} +2 -2
  14. package/dist/index-C1uuK9Oe.js +4 -0
  15. package/dist/{index-DSZ4uL36.cjs → index-C3FsKcaa.cjs} +9 -9
  16. package/dist/{index-mxAsp7TS.cjs → index-CI3-UbHV.cjs} +1 -1
  17. package/dist/{index-CDix1EI6.cjs → index-CUiRCc9R.cjs} +1 -1
  18. package/dist/{index-BzE9-IDy.js → index-CatPU-Tb.js} +2 -2
  19. package/dist/index-CgdXRA9O.js +4 -0
  20. package/dist/{index-Djk2wB5c.cjs → index-CiXFstB4.cjs} +1 -1
  21. package/dist/{index-CkAXoWb4.js → index-D4PAG3Vh.js} +1 -1
  22. package/dist/index-D5qCUOiI.js +4 -0
  23. package/dist/index-DD-fzfB4.js +4 -0
  24. package/dist/{index-q62Pjryf.js → index-DWtskrIL.js} +1 -1
  25. package/dist/{index-DGrstDAa.cjs → index-DuD4ytSh.cjs} +1 -1
  26. package/dist/{index-DYwvfMBR.js → index-Tl0OUfTE.js} +1 -1
  27. package/dist/{index-IYMcsQ_n.js → index-Wc37iNDV.js} +1 -1
  28. package/dist/{index-BlTWmHY_.js → index-nDLsFzji.js} +1 -1
  29. package/dist/{index-YOYYHO0m.cjs → index-wiUXQ0q2.cjs} +1 -1
  30. package/dist/{index-D9DjC28i.cjs → index-xGJekgR3.cjs} +1 -1
  31. package/dist/index.cjs.js +1 -1
  32. package/dist/{index.es-BpFj26El.cjs → index.es-CaH-FE9w.cjs} +2 -2
  33. package/dist/{index.es-DMd0A_6T.js → index.es-DMJt4GKa.js} +11 -11
  34. package/dist/index.esm.js +1 -1
  35. package/dist/{llm_chain-k-esKETa.cjs → llm_chain-CiV6Np6m.cjs} +1 -1
  36. package/dist/{llm_chain-BtiRP0KD.js → llm_chain-w8wntN4h.js} +1 -1
  37. package/dist/{sequential_chain-CIOBgXXk.js → sequential_chain-BM--qOte.js} +1 -1
  38. package/dist/{sequential_chain-DXGtf3bx.cjs → sequential_chain-xMW6CJdQ.cjs} +1 -1
  39. package/dist/{vector_db_qa-CC1-Sfi6.cjs → vector_db_qa-BZwJGY8q.cjs} +1 -1
  40. package/dist/{vector_db_qa-YtLcD1gH.js → vector_db_qa-S7zmkxZD.js} +3 -3
  41. package/package.json +1 -1
  42. package/dist/index-B48CLN0n.js +0 -4
  43. package/dist/index-BEHCc-ln.js +0 -4
  44. package/dist/index-CJvt8-AE.js +0 -4
  45. package/dist/index-GIM3omss.js +0 -4
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DSZ4uL36.cjs"),i=require("./llm_chain-k-esKETa.cjs");require("zod");const t="You are given the below API Documentation:\n{api_docs}\nUsing this documentation, generate the full API url to call for answering the user question.\nYou should build the API url in order to get a response that is as short as possible, while still getting the necessary information to answer the question. Pay attention to deliberately exclude any unnecessary pieces of data in the API call.\n\nQuestion:{question}\nAPI url:",a=new e.PromptTemplate({inputVariables:["api_docs","question"],template:t}),n=`${t} {api_url}\n\nHere is the response from the API:\n\n{api_response}\n\nSummarize this response to answer the original question.\n\nSummary:`,s=new e.PromptTemplate({inputVariables:["api_docs","question","api_url","api_response"],template:n});class r extends e.BaseChain{get inputKeys(){return[this.inputKey]}get outputKeys(){return[this.outputKey]}constructor(e){super(e),Object.defineProperty(this,"apiAnswerChain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiRequestChain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiDocs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"inputKey",{enumerable:!0,configurable:!0,writable:!0,value:"question"}),Object.defineProperty(this,"outputKey",{enumerable:!0,configurable:!0,writable:!0,value:"output"}),this.apiRequestChain=e.apiRequestChain,this.apiAnswerChain=e.apiAnswerChain,this.apiDocs=e.apiDocs,this.inputKey=e.inputKey??this.inputKey,this.outputKey=e.outputKey??this.outputKey,this.headers=e.headers??this.headers}async _call(e,i){const t=e[this.inputKey],a=await this.apiRequestChain.predict({question:t,api_docs:this.apiDocs},null==i?void 0:i.getChild("request")),n=await fetch(a,{headers:this.headers}),s=await n.text(),r=await this.apiAnswerChain.predict({question:t,api_docs:this.apiDocs,api_url:a,api_response:s},null==i?void 0:i.getChild("response"));return{[this.outputKey]:r}}_chainType(){return"api_chain"}static async deserialize(e){const{api_request_chain:t,api_answer_chain:a,api_docs:n}=e;if(!t)throw new Error("LLMChain must have api_request_chain");if(!a)throw new Error("LLMChain must have api_answer_chain");if(!n)throw new Error("LLMChain must have api_docs");return new r({apiAnswerChain:await i.LLMChain.deserialize(a),apiRequestChain:await i.LLMChain.deserialize(t),apiDocs:n})}serialize(){return{_type:this._chainType(),api_answer_chain:this.apiAnswerChain.serialize(),api_request_chain:this.apiRequestChain.serialize(),api_docs:this.apiDocs}}static fromLLMAndAPIDocs(e,t,n={}){const{apiUrlPrompt:r=a,apiResponsePrompt:o=s}=n,u=new i.LLMChain({prompt:r,llm:e});return new this({apiAnswerChain:new i.LLMChain({prompt:o,llm:e}),apiRequestChain:u,apiDocs:t,...n})}}exports.APIChain=r;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-C3FsKcaa.cjs"),i=require("./llm_chain-CiV6Np6m.cjs");require("zod");const t="You are given the below API Documentation:\n{api_docs}\nUsing this documentation, generate the full API url to call for answering the user question.\nYou should build the API url in order to get a response that is as short as possible, while still getting the necessary information to answer the question. Pay attention to deliberately exclude any unnecessary pieces of data in the API call.\n\nQuestion:{question}\nAPI url:",a=new e.PromptTemplate({inputVariables:["api_docs","question"],template:t}),n=`${t} {api_url}\n\nHere is the response from the API:\n\n{api_response}\n\nSummarize this response to answer the original question.\n\nSummary:`,s=new e.PromptTemplate({inputVariables:["api_docs","question","api_url","api_response"],template:n});class r extends e.BaseChain{get inputKeys(){return[this.inputKey]}get outputKeys(){return[this.outputKey]}constructor(e){super(e),Object.defineProperty(this,"apiAnswerChain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiRequestChain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiDocs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"inputKey",{enumerable:!0,configurable:!0,writable:!0,value:"question"}),Object.defineProperty(this,"outputKey",{enumerable:!0,configurable:!0,writable:!0,value:"output"}),this.apiRequestChain=e.apiRequestChain,this.apiAnswerChain=e.apiAnswerChain,this.apiDocs=e.apiDocs,this.inputKey=e.inputKey??this.inputKey,this.outputKey=e.outputKey??this.outputKey,this.headers=e.headers??this.headers}async _call(e,i){const t=e[this.inputKey],a=await this.apiRequestChain.predict({question:t,api_docs:this.apiDocs},null==i?void 0:i.getChild("request")),n=await fetch(a,{headers:this.headers}),s=await n.text(),r=await this.apiAnswerChain.predict({question:t,api_docs:this.apiDocs,api_url:a,api_response:s},null==i?void 0:i.getChild("response"));return{[this.outputKey]:r}}_chainType(){return"api_chain"}static async deserialize(e){const{api_request_chain:t,api_answer_chain:a,api_docs:n}=e;if(!t)throw new Error("LLMChain must have api_request_chain");if(!a)throw new Error("LLMChain must have api_answer_chain");if(!n)throw new Error("LLMChain must have api_docs");return new r({apiAnswerChain:await i.LLMChain.deserialize(a),apiRequestChain:await i.LLMChain.deserialize(t),apiDocs:n})}serialize(){return{_type:this._chainType(),api_answer_chain:this.apiAnswerChain.serialize(),api_request_chain:this.apiRequestChain.serialize(),api_docs:this.apiDocs}}static fromLLMAndAPIDocs(e,t,n={}){const{apiUrlPrompt:r=a,apiResponsePrompt:o=s}=n,u=new i.LLMChain({prompt:r,llm:e});return new this({apiAnswerChain:new i.LLMChain({prompt:o,llm:e}),apiRequestChain:u,apiDocs:t,...n})}}exports.APIChain=r;
@@ -1,5 +1,5 @@
1
- import { P as PromptTemplate, i as BaseChain } from "./index-D5DVRfMz.js";
2
- import { LLMChain } from "./llm_chain-BtiRP0KD.js";
1
+ import { P as PromptTemplate, i as BaseChain } from "./index-B2mOy3px.js";
2
+ import { LLMChain } from "./llm_chain-w8wntN4h.js";
3
3
  import "zod";
4
4
  const API_URL_RAW_PROMPT_TEMPLATE = `You are given the below API Documentation:
5
5
  {api_docs}
@@ -1,6 +1,6 @@
1
1
  import "zod";
2
- import { i as BaseChain, P as PromptTemplate } from "./index-D5DVRfMz.js";
3
- import { LLMChain } from "./llm_chain-BtiRP0KD.js";
2
+ import { i as BaseChain, P as PromptTemplate } from "./index-B2mOy3px.js";
3
+ import { LLMChain } from "./llm_chain-w8wntN4h.js";
4
4
  class StuffDocumentsChain extends BaseChain {
5
5
  static lc_name() {
6
6
  return "StuffDocumentsChain";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),require("zod");const e=require("./index-DSZ4uL36.cjs"),t=require("./llm_chain-k-esKETa.cjs");class i extends e.BaseChain{static lc_name(){return"StuffDocumentsChain"}get inputKeys(){return[this.inputKey,...this.llmChain.inputKeys].filter(e=>e!==this.documentVariableName)}get outputKeys(){return this.llmChain.outputKeys}constructor(e){super(e),Object.defineProperty(this,"llmChain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"inputKey",{enumerable:!0,configurable:!0,writable:!0,value:"input_documents"}),Object.defineProperty(this,"documentVariableName",{enumerable:!0,configurable:!0,writable:!0,value:"context"}),this.llmChain=e.llmChain,this.documentVariableName=e.documentVariableName??this.documentVariableName,this.inputKey=e.inputKey??this.inputKey}_prepInputs(e){if(!(this.inputKey in e))throw new Error(`Document key ${this.inputKey} not found.`);const{[this.inputKey]:t,...i}=e,n=t.map(({pageContent:e})=>e).join("\n\n");return{...i,[this.documentVariableName]:n}}async _call(e,t){return await this.llmChain.call(this._prepInputs(e),null==t?void 0:t.getChild("combine_documents"))}_chainType(){return"stuff_documents_chain"}static async deserialize(e){if(!e.llm_chain)throw new Error("Missing llm_chain");return new i({llmChain:await t.LLMChain.deserialize(e.llm_chain)})}serialize(){return{_type:this._chainType(),llm_chain:this.llmChain.serialize()}}}class n extends e.BaseChain{static lc_name(){return"MapReduceDocumentsChain"}get inputKeys(){return[this.inputKey,...this.combineDocumentChain.inputKeys]}get outputKeys(){return this.combineDocumentChain.outputKeys}constructor(e){super(e),Object.defineProperty(this,"llmChain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"inputKey",{enumerable:!0,configurable:!0,writable:!0,value:"input_documents"}),Object.defineProperty(this,"documentVariableName",{enumerable:!0,configurable:!0,writable:!0,value:"context"}),Object.defineProperty(this,"returnIntermediateSteps",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"maxTokens",{enumerable:!0,configurable:!0,writable:!0,value:3e3}),Object.defineProperty(this,"maxIterations",{enumerable:!0,configurable:!0,writable:!0,value:10}),Object.defineProperty(this,"ensureMapStep",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"combineDocumentChain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.llmChain=e.llmChain,this.combineDocumentChain=e.combineDocumentChain,this.documentVariableName=e.documentVariableName??this.documentVariableName,this.ensureMapStep=e.ensureMapStep??this.ensureMapStep,this.inputKey=e.inputKey??this.inputKey,this.maxTokens=e.maxTokens??this.maxTokens,this.maxIterations=e.maxIterations??this.maxIterations,this.returnIntermediateSteps=e.returnIntermediateSteps??!1}async _call(e,t){if(!(this.inputKey in e))throw new Error(`Document key ${this.inputKey} not found.`);const{[this.inputKey]:i,...n}=e;let a=i,r=[];for(let o=0;o<this.maxIterations;o+=1){const e=a.map(e=>({[this.documentVariableName]:e.pageContent,...n}));if(0!==o||!this.ensureMapStep){const e=await this.combineDocumentChain.llmChain.prompt.format(this.combineDocumentChain._prepInputs({[this.combineDocumentChain.inputKey]:a,...n}));if(await this.combineDocumentChain.llmChain._getNumTokens(e)<this.maxTokens)break}const i=await this.llmChain.apply(e,t?Array.from({length:e.length},(e,i)=>t.getChild(`map_${i+1}`)):void 0),{outputKey:s}=this.llmChain;this.returnIntermediateSteps&&(r=r.concat(i.map(e=>e[s]))),a=i.map(e=>({pageContent:e[s],metadata:{}}))}const s={[this.combineDocumentChain.inputKey]:a,...n},u=await this.combineDocumentChain.call(s,null==t?void 0:t.getChild("combine_documents"));return this.returnIntermediateSteps?{...u,intermediateSteps:r}:u}_chainType(){return"map_reduce_documents_chain"}static async deserialize(e){if(!e.llm_chain)throw new Error("Missing llm_chain");if(!e.combine_document_chain)throw new Error("Missing combine_document_chain");return new n({llmChain:await t.LLMChain.deserialize(e.llm_chain),combineDocumentChain:await i.deserialize(e.combine_document_chain)})}serialize(){return{_type:this._chainType(),llm_chain:this.llmChain.serialize(),combine_document_chain:this.combineDocumentChain.serialize()}}}class a extends e.BaseChain{static lc_name(){return"RefineDocumentsChain"}get defaultDocumentPrompt(){return new e.PromptTemplate({inputVariables:["page_content"],template:"{page_content}"})}get inputKeys(){return[...new Set([this.inputKey,...this.llmChain.inputKeys,...this.refineLLMChain.inputKeys])].filter(e=>e!==this.documentVariableName&&e!==this.initialResponseName)}get outputKeys(){return[this.outputKey]}constructor(e){super(e),Object.defineProperty(this,"llmChain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"inputKey",{enumerable:!0,configurable:!0,writable:!0,value:"input_documents"}),Object.defineProperty(this,"outputKey",{enumerable:!0,configurable:!0,writable:!0,value:"output_text"}),Object.defineProperty(this,"documentVariableName",{enumerable:!0,configurable:!0,writable:!0,value:"context"}),Object.defineProperty(this,"initialResponseName",{enumerable:!0,configurable:!0,writable:!0,value:"existing_answer"}),Object.defineProperty(this,"refineLLMChain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"documentPrompt",{enumerable:!0,configurable:!0,writable:!0,value:this.defaultDocumentPrompt}),this.llmChain=e.llmChain,this.refineLLMChain=e.refineLLMChain,this.documentVariableName=e.documentVariableName??this.documentVariableName,this.inputKey=e.inputKey??this.inputKey,this.outputKey=e.outputKey??this.outputKey,this.documentPrompt=e.documentPrompt??this.documentPrompt,this.initialResponseName=e.initialResponseName??this.initialResponseName}async _constructInitialInputs(e,t){const i={page_content:e.pageContent,...e.metadata},n={};this.documentPrompt.inputVariables.forEach(e=>{n[e]=i[e]});return{...{[this.documentVariableName]:await this.documentPrompt.format({...n})},...t}}async _constructRefineInputs(e,t){const i={page_content:e.pageContent,...e.metadata},n={};this.documentPrompt.inputVariables.forEach(e=>{n[e]=i[e]});const a={[this.documentVariableName]:await this.documentPrompt.format({...n})};return{[this.initialResponseName]:t,...a}}async _call(e,t){if(!(this.inputKey in e))throw new Error(`Document key ${this.inputKey} not found.`);const{[this.inputKey]:i,...n}=e,a=i,r=await this._constructInitialInputs(a[0],n);let s=await this.llmChain.predict({...r},null==t?void 0:t.getChild("answer"));for(let u=1;u<a.length;u+=1){const e={...await this._constructRefineInputs(a[u],s),...n};s=await this.refineLLMChain.predict({...e},null==t?void 0:t.getChild("refine"))}return{[this.outputKey]:s}}_chainType(){return"refine_documents_chain"}static async deserialize(e){const i=e.llm_chain;if(!i)throw new Error("Missing llm_chain");const n=e.refine_llm_chain;if(!n)throw new Error("Missing refine_llm_chain");return new a({llmChain:await t.LLMChain.deserialize(i),refineLLMChain:await t.LLMChain.deserialize(n)})}serialize(){return{_type:this._chainType(),llm_chain:this.llmChain.serialize(),refine_llm_chain:this.refineLLMChain.serialize()}}}exports.MapReduceDocumentsChain=n,exports.RefineDocumentsChain=a,exports.StuffDocumentsChain=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),require("zod");const e=require("./index-C3FsKcaa.cjs"),t=require("./llm_chain-CiV6Np6m.cjs");class i extends e.BaseChain{static lc_name(){return"StuffDocumentsChain"}get inputKeys(){return[this.inputKey,...this.llmChain.inputKeys].filter(e=>e!==this.documentVariableName)}get outputKeys(){return this.llmChain.outputKeys}constructor(e){super(e),Object.defineProperty(this,"llmChain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"inputKey",{enumerable:!0,configurable:!0,writable:!0,value:"input_documents"}),Object.defineProperty(this,"documentVariableName",{enumerable:!0,configurable:!0,writable:!0,value:"context"}),this.llmChain=e.llmChain,this.documentVariableName=e.documentVariableName??this.documentVariableName,this.inputKey=e.inputKey??this.inputKey}_prepInputs(e){if(!(this.inputKey in e))throw new Error(`Document key ${this.inputKey} not found.`);const{[this.inputKey]:t,...i}=e,n=t.map(({pageContent:e})=>e).join("\n\n");return{...i,[this.documentVariableName]:n}}async _call(e,t){return await this.llmChain.call(this._prepInputs(e),null==t?void 0:t.getChild("combine_documents"))}_chainType(){return"stuff_documents_chain"}static async deserialize(e){if(!e.llm_chain)throw new Error("Missing llm_chain");return new i({llmChain:await t.LLMChain.deserialize(e.llm_chain)})}serialize(){return{_type:this._chainType(),llm_chain:this.llmChain.serialize()}}}class n extends e.BaseChain{static lc_name(){return"MapReduceDocumentsChain"}get inputKeys(){return[this.inputKey,...this.combineDocumentChain.inputKeys]}get outputKeys(){return this.combineDocumentChain.outputKeys}constructor(e){super(e),Object.defineProperty(this,"llmChain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"inputKey",{enumerable:!0,configurable:!0,writable:!0,value:"input_documents"}),Object.defineProperty(this,"documentVariableName",{enumerable:!0,configurable:!0,writable:!0,value:"context"}),Object.defineProperty(this,"returnIntermediateSteps",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"maxTokens",{enumerable:!0,configurable:!0,writable:!0,value:3e3}),Object.defineProperty(this,"maxIterations",{enumerable:!0,configurable:!0,writable:!0,value:10}),Object.defineProperty(this,"ensureMapStep",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"combineDocumentChain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.llmChain=e.llmChain,this.combineDocumentChain=e.combineDocumentChain,this.documentVariableName=e.documentVariableName??this.documentVariableName,this.ensureMapStep=e.ensureMapStep??this.ensureMapStep,this.inputKey=e.inputKey??this.inputKey,this.maxTokens=e.maxTokens??this.maxTokens,this.maxIterations=e.maxIterations??this.maxIterations,this.returnIntermediateSteps=e.returnIntermediateSteps??!1}async _call(e,t){if(!(this.inputKey in e))throw new Error(`Document key ${this.inputKey} not found.`);const{[this.inputKey]:i,...n}=e;let a=i,r=[];for(let o=0;o<this.maxIterations;o+=1){const e=a.map(e=>({[this.documentVariableName]:e.pageContent,...n}));if(0!==o||!this.ensureMapStep){const e=await this.combineDocumentChain.llmChain.prompt.format(this.combineDocumentChain._prepInputs({[this.combineDocumentChain.inputKey]:a,...n}));if(await this.combineDocumentChain.llmChain._getNumTokens(e)<this.maxTokens)break}const i=await this.llmChain.apply(e,t?Array.from({length:e.length},(e,i)=>t.getChild(`map_${i+1}`)):void 0),{outputKey:s}=this.llmChain;this.returnIntermediateSteps&&(r=r.concat(i.map(e=>e[s]))),a=i.map(e=>({pageContent:e[s],metadata:{}}))}const s={[this.combineDocumentChain.inputKey]:a,...n},u=await this.combineDocumentChain.call(s,null==t?void 0:t.getChild("combine_documents"));return this.returnIntermediateSteps?{...u,intermediateSteps:r}:u}_chainType(){return"map_reduce_documents_chain"}static async deserialize(e){if(!e.llm_chain)throw new Error("Missing llm_chain");if(!e.combine_document_chain)throw new Error("Missing combine_document_chain");return new n({llmChain:await t.LLMChain.deserialize(e.llm_chain),combineDocumentChain:await i.deserialize(e.combine_document_chain)})}serialize(){return{_type:this._chainType(),llm_chain:this.llmChain.serialize(),combine_document_chain:this.combineDocumentChain.serialize()}}}class a extends e.BaseChain{static lc_name(){return"RefineDocumentsChain"}get defaultDocumentPrompt(){return new e.PromptTemplate({inputVariables:["page_content"],template:"{page_content}"})}get inputKeys(){return[...new Set([this.inputKey,...this.llmChain.inputKeys,...this.refineLLMChain.inputKeys])].filter(e=>e!==this.documentVariableName&&e!==this.initialResponseName)}get outputKeys(){return[this.outputKey]}constructor(e){super(e),Object.defineProperty(this,"llmChain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"inputKey",{enumerable:!0,configurable:!0,writable:!0,value:"input_documents"}),Object.defineProperty(this,"outputKey",{enumerable:!0,configurable:!0,writable:!0,value:"output_text"}),Object.defineProperty(this,"documentVariableName",{enumerable:!0,configurable:!0,writable:!0,value:"context"}),Object.defineProperty(this,"initialResponseName",{enumerable:!0,configurable:!0,writable:!0,value:"existing_answer"}),Object.defineProperty(this,"refineLLMChain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"documentPrompt",{enumerable:!0,configurable:!0,writable:!0,value:this.defaultDocumentPrompt}),this.llmChain=e.llmChain,this.refineLLMChain=e.refineLLMChain,this.documentVariableName=e.documentVariableName??this.documentVariableName,this.inputKey=e.inputKey??this.inputKey,this.outputKey=e.outputKey??this.outputKey,this.documentPrompt=e.documentPrompt??this.documentPrompt,this.initialResponseName=e.initialResponseName??this.initialResponseName}async _constructInitialInputs(e,t){const i={page_content:e.pageContent,...e.metadata},n={};this.documentPrompt.inputVariables.forEach(e=>{n[e]=i[e]});return{...{[this.documentVariableName]:await this.documentPrompt.format({...n})},...t}}async _constructRefineInputs(e,t){const i={page_content:e.pageContent,...e.metadata},n={};this.documentPrompt.inputVariables.forEach(e=>{n[e]=i[e]});const a={[this.documentVariableName]:await this.documentPrompt.format({...n})};return{[this.initialResponseName]:t,...a}}async _call(e,t){if(!(this.inputKey in e))throw new Error(`Document key ${this.inputKey} not found.`);const{[this.inputKey]:i,...n}=e,a=i,r=await this._constructInitialInputs(a[0],n);let s=await this.llmChain.predict({...r},null==t?void 0:t.getChild("answer"));for(let u=1;u<a.length;u+=1){const e={...await this._constructRefineInputs(a[u],s),...n};s=await this.refineLLMChain.predict({...e},null==t?void 0:t.getChild("refine"))}return{[this.outputKey]:s}}_chainType(){return"refine_documents_chain"}static async deserialize(e){const i=e.llm_chain;if(!i)throw new Error("Missing llm_chain");const n=e.refine_llm_chain;if(!n)throw new Error("Missing refine_llm_chain");return new a({llmChain:await t.LLMChain.deserialize(i),refineLLMChain:await t.LLMChain.deserialize(n)})}serialize(){return{_type:this._chainType(),llm_chain:this.llmChain.serialize(),refine_llm_chain:this.refineLLMChain.serialize()}}}exports.MapReduceDocumentsChain=n,exports.RefineDocumentsChain=a,exports.StuffDocumentsChain=i;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DSZ4uL36.cjs");require("zod");class t extends e.BaseStringPromptTemplate{constructor(t){if(super(t),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"examples",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"exampleSelector",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"examplePrompt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"suffix",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"exampleSeparator",{enumerable:!0,configurable:!0,writable:!0,value:"\n\n"}),Object.defineProperty(this,"prefix",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"templateFormat",{enumerable:!0,configurable:!0,writable:!0,value:"f-string"}),Object.defineProperty(this,"validateTemplate",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.assign(this,t),void 0!==this.examples&&void 0!==this.exampleSelector)throw new Error("Only one of 'examples' and 'example_selector' should be provided");if(void 0===this.examples&&void 0===this.exampleSelector)throw new Error("One of 'examples' and 'example_selector' should be provided");if(this.validateTemplate){let t=this.inputVariables;this.partialVariables&&(t=t.concat(Object.keys(this.partialVariables))),e.checkValidTemplate(this.prefix+this.suffix,this.templateFormat,t)}}_getPromptType(){return"few_shot"}static lc_name(){return"FewShotPromptTemplate"}async getExamples(e){if(void 0!==this.examples)return this.examples;if(void 0!==this.exampleSelector)return this.exampleSelector.selectExamples(e);throw new Error("One of 'examples' and 'example_selector' should be provided")}async partial(e){const r=this.inputVariables.filter(t=>!(t in e)),a={...this.partialVariables??{},...e},i={...this,inputVariables:r,partialVariables:a};return new t(i)}async format(t){const r=await this.mergePartialAndUserVariables(t),a=await this.getExamples(r),i=await Promise.all(a.map(e=>this.examplePrompt.format(e))),l=[this.prefix,...i,this.suffix].join(this.exampleSeparator);return e.renderTemplate(l,this.templateFormat,r)}serialize(){if(this.exampleSelector||!this.examples)throw new Error("Serializing an example selector is not currently supported");if(void 0!==this.outputParser)throw new Error("Serializing an output parser is not currently supported");return{_type:this._getPromptType(),input_variables:this.inputVariables,example_prompt:this.examplePrompt.serialize(),example_separator:this.exampleSeparator,suffix:this.suffix,prefix:this.prefix,template_format:this.templateFormat,examples:this.examples}}static async deserialize(r){const{example_prompt:a}=r;if(!a)throw new Error("Missing example prompt");const i=await e.PromptTemplate.deserialize(a);let l;if(!Array.isArray(r.examples))throw new Error("Invalid examples format. Only list or string are supported.");return l=r.examples,new t({inputVariables:r.input_variables,examplePrompt:i,examples:l,exampleSeparator:r.example_separator,prefix:r.prefix,suffix:r.suffix,templateFormat:r.template_format})}}exports.FewShotPromptTemplate=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-C3FsKcaa.cjs");require("zod");class t extends e.BaseStringPromptTemplate{constructor(t){if(super(t),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"examples",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"exampleSelector",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"examplePrompt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"suffix",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"exampleSeparator",{enumerable:!0,configurable:!0,writable:!0,value:"\n\n"}),Object.defineProperty(this,"prefix",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"templateFormat",{enumerable:!0,configurable:!0,writable:!0,value:"f-string"}),Object.defineProperty(this,"validateTemplate",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.assign(this,t),void 0!==this.examples&&void 0!==this.exampleSelector)throw new Error("Only one of 'examples' and 'example_selector' should be provided");if(void 0===this.examples&&void 0===this.exampleSelector)throw new Error("One of 'examples' and 'example_selector' should be provided");if(this.validateTemplate){let t=this.inputVariables;this.partialVariables&&(t=t.concat(Object.keys(this.partialVariables))),e.checkValidTemplate(this.prefix+this.suffix,this.templateFormat,t)}}_getPromptType(){return"few_shot"}static lc_name(){return"FewShotPromptTemplate"}async getExamples(e){if(void 0!==this.examples)return this.examples;if(void 0!==this.exampleSelector)return this.exampleSelector.selectExamples(e);throw new Error("One of 'examples' and 'example_selector' should be provided")}async partial(e){const r=this.inputVariables.filter(t=>!(t in e)),a={...this.partialVariables??{},...e},i={...this,inputVariables:r,partialVariables:a};return new t(i)}async format(t){const r=await this.mergePartialAndUserVariables(t),a=await this.getExamples(r),i=await Promise.all(a.map(e=>this.examplePrompt.format(e))),l=[this.prefix,...i,this.suffix].join(this.exampleSeparator);return e.renderTemplate(l,this.templateFormat,r)}serialize(){if(this.exampleSelector||!this.examples)throw new Error("Serializing an example selector is not currently supported");if(void 0!==this.outputParser)throw new Error("Serializing an output parser is not currently supported");return{_type:this._getPromptType(),input_variables:this.inputVariables,example_prompt:this.examplePrompt.serialize(),example_separator:this.exampleSeparator,suffix:this.suffix,prefix:this.prefix,template_format:this.templateFormat,examples:this.examples}}static async deserialize(r){const{example_prompt:a}=r;if(!a)throw new Error("Missing example prompt");const i=await e.PromptTemplate.deserialize(a);let l;if(!Array.isArray(r.examples))throw new Error("Invalid examples format. Only list or string are supported.");return l=r.examples,new t({inputVariables:r.input_variables,examplePrompt:i,examples:l,exampleSeparator:r.example_separator,prefix:r.prefix,suffix:r.suffix,templateFormat:r.template_format})}}exports.FewShotPromptTemplate=t;
@@ -1,4 +1,4 @@
1
- import { B as BaseStringPromptTemplate, e as checkValidTemplate, g as renderTemplate, P as PromptTemplate } from "./index-D5DVRfMz.js";
1
+ import { B as BaseStringPromptTemplate, e as checkValidTemplate, g as renderTemplate, P as PromptTemplate } from "./index-B2mOy3px.js";
2
2
  import "zod";
3
3
  class FewShotPromptTemplate extends BaseStringPromptTemplate {
4
4
  constructor(input) {
@@ -44603,8 +44603,11 @@ function CommentIndex({
44603
44603
  const [selectedAgentId, setSelectedAgentId] = useState("");
44604
44604
  const [pendingAgentFromList, setPendingAgentFromList] = useState(null);
44605
44605
  const [pendingAiContent, setPendingAiContent] = useState(null);
44606
+ const [pendingAiFiles, setPendingAiFiles] = useState(null);
44606
44607
  const [pendingAiContentToSend, setPendingAiContentToSend] = useState(null);
44608
+ const [pendingAiFilesToSend, setPendingAiFilesToSend] = useState(null);
44607
44609
  const isProcessingAgentSelectRef = useRef(false);
44610
+ const pendingAiFilesRef = useRef(null);
44608
44611
  const isNewSessionRef = useRef(false);
44609
44612
  const isUserSendingMessageRef = useRef(false);
44610
44613
  const prevSessionIdRef = useRef("");
@@ -44656,6 +44659,8 @@ function CommentIndex({
44656
44659
  );
44657
44660
  console.log("[XinXiaoYi] aiContent 字段值:", parsed.aiContent);
44658
44661
  console.log("[XinXiaoYi] aiContent 类型:", typeof parsed.aiContent);
44662
+ console.log("[XinXiaoYi] aiFiles 字段值:", parsed.aiFiles);
44663
+ console.log("[XinXiaoYi] aiFiles 类型:", typeof parsed.aiFiles);
44659
44664
  setPendingAgentFromList(parsed.id);
44660
44665
  if (parsed.aiContent && typeof parsed.aiContent === "string") {
44661
44666
  setPendingAiContent(parsed.aiContent);
@@ -44666,6 +44671,15 @@ function CommentIndex({
44666
44671
  } else {
44667
44672
  console.log("[XinXiaoYi] 未检测到有效的 aiContent 字段");
44668
44673
  }
44674
+ if (parsed.aiFiles && Array.isArray(parsed.aiFiles)) {
44675
+ setPendingAiFiles(parsed.aiFiles);
44676
+ console.log(
44677
+ "[XinXiaoYi] 检测到 aiFiles,已保存到状态:",
44678
+ parsed.aiFiles
44679
+ );
44680
+ } else {
44681
+ console.log("[XinXiaoYi] 未检测到有效的 aiFiles 字段");
44682
+ }
44669
44683
  } else {
44670
44684
  window.localStorage.removeItem("selectedAgent");
44671
44685
  }
@@ -44694,9 +44708,16 @@ function CommentIndex({
44694
44708
  parsed.aiContent
44695
44709
  );
44696
44710
  }
44711
+ if (parsed && parsed.aiFiles && Array.isArray(parsed.aiFiles)) {
44712
+ setPendingAiFiles(parsed.aiFiles);
44713
+ console.log(
44714
+ "[XinXiaoYi] 从 localStorage 读取到 aiFiles:",
44715
+ parsed.aiFiles
44716
+ );
44717
+ }
44697
44718
  }
44698
44719
  } catch (error) {
44699
- console.warn("[XinXiaoYi] 读取 aiContent 失败:", error);
44720
+ console.warn("[XinXiaoYi] 读取 aiContent 或 aiFiles 失败:", error);
44700
44721
  }
44701
44722
  }
44702
44723
  }, [incomingAgent]);
@@ -44892,6 +44913,12 @@ function CommentIndex({
44892
44913
  fileIds: currentSession.fileIds || []
44893
44914
  // 确保fileIds字段存在
44894
44915
  });
44916
+ if ((currentSession == null ? void 0 : currentSession.fileUploadEnabled) !== void 0) {
44917
+ setFileUploadEnabled(currentSession.fileUploadEnabled);
44918
+ console.log(`[初始化] 恢复文件上传按钮显示状态:`, currentSession.fileUploadEnabled);
44919
+ } else {
44920
+ setFileUploadEnabled(false);
44921
+ }
44895
44922
  if (currentSession == null ? void 0 : currentSession.agentId) {
44896
44923
  setSelectedAgentId(currentSession.agentId);
44897
44924
  }
@@ -44982,6 +45009,12 @@ function CommentIndex({
44982
45009
  );
44983
45010
  if (sessionIndex >= 0) {
44984
45011
  const currentSession = sessionList[sessionIndex];
45012
+ if (currentSession.fileUploadEnabled !== void 0) {
45013
+ setFileUploadEnabled(currentSession.fileUploadEnabled);
45014
+ console.log(`[会话切换] 恢复文件上传按钮显示状态:`, currentSession.fileUploadEnabled);
45015
+ } else {
45016
+ setFileUploadEnabled(false);
45017
+ }
44985
45018
  setCurrentCommentSession({
44986
45019
  ...currentSession,
44987
45020
  fileIds: [],
@@ -45421,6 +45454,15 @@ function CommentIndex({
45421
45454
  console.log("添加新上传的文件到files字段:", filesArray);
45422
45455
  console.log("请求体中的inputs字段保持不变:", requestBody.inputs);
45423
45456
  }
45457
+ if (pendingAiFilesRef.current && Array.isArray(pendingAiFilesRef.current) && pendingAiFilesRef.current.length > 0) {
45458
+ console.log("添加外部传入的 aiFiles 到 files 字段:", pendingAiFilesRef.current);
45459
+ if (requestBody.files && Array.isArray(requestBody.files)) {
45460
+ requestBody.files = [...requestBody.files, ...pendingAiFilesRef.current];
45461
+ } else {
45462
+ requestBody.files = [...pendingAiFilesRef.current];
45463
+ }
45464
+ pendingAiFilesRef.current = null;
45465
+ }
45424
45466
  console.log("完整的请求体:", JSON.stringify(requestBody, null, 2));
45425
45467
  let apiUrl = DEFAULT_API_ENDPOINT;
45426
45468
  if (formConfig2 && formConfig2.apiEndpoint) {
@@ -45648,13 +45690,18 @@ function CommentIndex({
45648
45690
  isUserSendingMessageRef.current = false;
45649
45691
  setNewUploadedFileIds([]);
45650
45692
  setNewUploadedFileNamesMap({});
45651
- setFileUploadEnabled(false);
45652
45693
  setCurrentCommentSessionId(sessionId);
45653
45694
  setCommentSessionList((sessionList) => {
45654
45695
  const selectedSession = sessionList.find(
45655
45696
  (session) => session.id === sessionId
45656
45697
  );
45657
45698
  if (selectedSession) {
45699
+ if (selectedSession.fileUploadEnabled !== void 0) {
45700
+ setFileUploadEnabled(selectedSession.fileUploadEnabled);
45701
+ console.log(`[切换会话] 恢复文件上传按钮显示状态:`, selectedSession.fileUploadEnabled);
45702
+ } else {
45703
+ setFileUploadEnabled(false);
45704
+ }
45658
45705
  setCurrentCommentSession({
45659
45706
  ...selectedSession,
45660
45707
  fileIds: [],
@@ -45675,6 +45722,8 @@ function CommentIndex({
45675
45722
  LocalForageService.setItem("session_list", updatedSessionList);
45676
45723
  return updatedSessionList;
45677
45724
  }
45725
+ } else {
45726
+ setFileUploadEnabled(false);
45678
45727
  }
45679
45728
  if (selectedSession == null ? void 0 : selectedSession.agentId) {
45680
45729
  setSelectedAgentId(selectedSession.agentId);
@@ -45863,10 +45912,11 @@ function CommentIndex({
45863
45912
  []
45864
45913
  );
45865
45914
  const createSessionWithAgent = useCallback(
45866
- async (agent, aiContent) => {
45915
+ async (agent, aiContent, aiFiles) => {
45867
45916
  var _a3, _b;
45868
45917
  let openingContent = agent.description || `你好!我是${agent.name},很高兴为您服务!有什么我可以帮助您的吗?`;
45869
45918
  let openingPrompts = ((_a3 = agent.config) == null ? void 0 : _a3.openingPrompts) || void 0;
45919
+ let fileUploadEnabledValue = false;
45870
45920
  if (agent.apiKeys) {
45871
45921
  try {
45872
45922
  console.log(
@@ -45888,6 +45938,7 @@ function CommentIndex({
45888
45938
  console.log(`[推荐词接口] 接口未返回推荐问题,使用默认配置`);
45889
45939
  }
45890
45940
  if (openingData.fileUploadEnabled !== void 0) {
45941
+ fileUploadEnabledValue = openingData.fileUploadEnabled;
45891
45942
  setFileUploadEnabled(openingData.fileUploadEnabled);
45892
45943
  console.log(`[推荐词接口] 文件上传功能启用状态:`, openingData.fileUploadEnabled);
45893
45944
  }
@@ -45994,6 +46045,8 @@ function CommentIndex({
45994
46045
  fileIds: initialFormData.fileIds ?? [],
45995
46046
  fileNamesMap: initialFormData.fileNamesMap ?? {},
45996
46047
  openingPrompts,
46048
+ fileUploadEnabled: fileUploadEnabledValue,
46049
+ // 保存文件上传按钮显示状态
45997
46050
  // 根据 uiType 配置初始化表单数据
45998
46051
  ...initialFormData.translationData && {
45999
46052
  translationData: initialFormData.translationData
@@ -46047,6 +46100,10 @@ function CommentIndex({
46047
46100
  "[XinXiaoYi] createSessionWithAgent - aiContent 参数值:",
46048
46101
  aiContent
46049
46102
  );
46103
+ console.log(
46104
+ "[XinXiaoYi] createSessionWithAgent - aiFiles 参数值:",
46105
+ aiFiles
46106
+ );
46050
46107
  console.log(
46051
46108
  "[XinXiaoYi] createSessionWithAgent - 会话已创建,会话ID:",
46052
46109
  newSession.id
@@ -46063,6 +46120,13 @@ function CommentIndex({
46063
46120
  aiContent.trim()
46064
46121
  );
46065
46122
  setPendingAiContentToSend(aiContent.trim());
46123
+ if (aiFiles && Array.isArray(aiFiles) && aiFiles.length > 0) {
46124
+ console.log(
46125
+ "[XinXiaoYi] 设置 pendingAiFilesToSend:",
46126
+ aiFiles
46127
+ );
46128
+ setPendingAiFilesToSend(aiFiles);
46129
+ }
46066
46130
  }, 50);
46067
46131
  } else {
46068
46132
  console.log(
@@ -46073,7 +46137,7 @@ function CommentIndex({
46073
46137
  [sessionSetting, fetchOpeningStatement, chatSubmit]
46074
46138
  );
46075
46139
  const handleAgentSelect = useCallback(
46076
- async (agentId, aiContent) => {
46140
+ async (agentId, aiContent, aiFiles) => {
46077
46141
  console.log("[XinXiaoYi] handleAgentSelect 被调用");
46078
46142
  console.log("[XinXiaoYi] agentId:", agentId);
46079
46143
  console.log("[XinXiaoYi] aiContent 参数:", aiContent);
@@ -46121,9 +46185,16 @@ function CommentIndex({
46121
46185
  console.log("[XinXiaoYi] 当前会话ID:", latestSession.id);
46122
46186
  console.log("[XinXiaoYi] 当前选中的智能体ID:", agentId);
46123
46187
  setPendingAiContentToSend(aiContent.trim());
46188
+ if (aiFiles && Array.isArray(aiFiles) && aiFiles.length > 0) {
46189
+ console.log(
46190
+ "[XinXiaoYi] 切换到历史会话,设置待发送的 aiFiles:",
46191
+ aiFiles
46192
+ );
46193
+ setPendingAiFilesToSend(aiFiles);
46194
+ }
46124
46195
  }
46125
46196
  } else {
46126
- await createSessionWithAgent(agent, aiContent);
46197
+ await createSessionWithAgent(agent, aiContent, aiFiles);
46127
46198
  }
46128
46199
  } catch (error) {
46129
46200
  console.error("处理智能体选择时发生错误:", error);
@@ -46151,11 +46222,13 @@ function CommentIndex({
46151
46222
  console.log("[XinXiaoYi] pendingAiContent:", pendingAiContent);
46152
46223
  await handleAgentSelect(
46153
46224
  pendingAgentFromList,
46154
- pendingAiContent || void 0
46225
+ pendingAiContent || void 0,
46226
+ pendingAiFiles || void 0
46155
46227
  );
46156
46228
  window.localStorage.removeItem("selectedAgent");
46157
46229
  setPendingAgentFromList(null);
46158
46230
  setPendingAiContent(null);
46231
+ setPendingAiFiles(null);
46159
46232
  onIncomingAgentConsumed == null ? void 0 : onIncomingAgentConsumed();
46160
46233
  } catch (error) {
46161
46234
  console.error("[XinXiaoYi] 处理智能体选择失败:", error);
@@ -46168,6 +46241,7 @@ function CommentIndex({
46168
46241
  agentList2,
46169
46242
  pendingAgentFromList,
46170
46243
  pendingAiContent,
46244
+ pendingAiFiles,
46171
46245
  handleAgentSelect,
46172
46246
  onIncomingAgentConsumed
46173
46247
  ]);
@@ -46187,6 +46261,13 @@ function CommentIndex({
46187
46261
  currentCommentSession
46188
46262
  );
46189
46263
  if (pendingAiContentToSend && selectedAgentId && currentCommentSessionId && currentCommentSession) {
46264
+ const hasAiFiles = pendingAiFilesToSend && Array.isArray(pendingAiFilesToSend) && pendingAiFilesToSend.length > 0;
46265
+ if (hasAiFiles) {
46266
+ console.log(
46267
+ "[XinXiaoYi] useEffect - 检测到待发送的文件信息:",
46268
+ pendingAiFilesToSend
46269
+ );
46270
+ }
46190
46271
  console.log(
46191
46272
  "[XinXiaoYi] useEffect - 检测到状态已准备好,准备发送 aiContent"
46192
46273
  );
@@ -46199,8 +46280,20 @@ function CommentIndex({
46199
46280
  "[XinXiaoYi] useEffect - 调用 chatSubmit,消息内容:",
46200
46281
  pendingAiContentToSend
46201
46282
  );
46283
+ console.log(
46284
+ "[XinXiaoYi] useEffect - 待发送的文件信息:",
46285
+ pendingAiFilesToSend
46286
+ );
46202
46287
  const contentToSend = pendingAiContentToSend;
46288
+ if (pendingAiFilesToSend && pendingAiFilesToSend.length > 0) {
46289
+ pendingAiFilesRef.current = pendingAiFilesToSend;
46290
+ console.log(
46291
+ "[XinXiaoYi] useEffect - 设置待发送的文件信息到 ref:",
46292
+ pendingAiFilesToSend
46293
+ );
46294
+ }
46203
46295
  setPendingAiContentToSend(null);
46296
+ setPendingAiFilesToSend(null);
46204
46297
  chatSubmit(contentToSend);
46205
46298
  }, 300);
46206
46299
  return () => {
@@ -46228,6 +46321,7 @@ function CommentIndex({
46228
46321
  }
46229
46322
  }, [
46230
46323
  pendingAiContentToSend,
46324
+ pendingAiFilesToSend,
46231
46325
  selectedAgentId,
46232
46326
  currentCommentSessionId,
46233
46327
  currentCommentSession,
@@ -46501,10 +46595,14 @@ function CommentIndex({
46501
46595
  if (agent) {
46502
46596
  console.log("找到智能体,开始创建会话:", agent);
46503
46597
  const aiContentToSend = pendingAiContent || void 0;
46504
- await createSessionWithAgent(agent, aiContentToSend);
46598
+ const aiFilesToSend = pendingAiFiles || void 0;
46599
+ await createSessionWithAgent(agent, aiContentToSend, aiFilesToSend);
46505
46600
  if (aiContentToSend) {
46506
46601
  setPendingAiContent(null);
46507
46602
  }
46603
+ if (aiFilesToSend) {
46604
+ setPendingAiFiles(null);
46605
+ }
46508
46606
  } else {
46509
46607
  console.error("未找到对应的智能体:", agentId);
46510
46608
  Toast.error({
@@ -47511,7 +47609,7 @@ const BlockEdit = ({
47511
47609
  const initVueEditor = async () => {
47512
47610
  if (editorRef.current) {
47513
47611
  try {
47514
- const BlockNoteEditorModule = await import("./index.es-DMd0A_6T.js");
47612
+ const BlockNoteEditorModule = await import("./index.es-DMJt4GKa.js");
47515
47613
  const BlockNoteEditor = BlockNoteEditorModule.BlockNoteEditor;
47516
47614
  const theme = {
47517
47615
  colors: {
@@ -47649,7 +47747,8 @@ const AgentWebIndex = ({
47649
47747
  description: baseUrl.agentCard.description,
47650
47748
  category: baseUrl.agentCard.category,
47651
47749
  tags: baseUrl.agentCard.tags,
47652
- aiContent: baseUrl.agentCard.aiContent || ""
47750
+ aiContent: baseUrl.agentCard.aiContent || "",
47751
+ aiFiles: baseUrl.agentCard.aiFiles ? JSON.parse(baseUrl.agentCard.aiFiles) : []
47653
47752
  };
47654
47753
  console.log("agentData:信息", agentData);
47655
47754
  localStorage.setItem("selectedAgent", JSON.stringify(agentData));
@@ -47669,7 +47768,8 @@ const AgentWebIndex = ({
47669
47768
  avatar: ((_b = baseUrl == null ? void 0 : baseUrl.user) == null ? void 0 : _b.avatar) || ""
47670
47769
  },
47671
47770
  baseApi: (baseUrl == null ? void 0 : baseUrl.baseApi) || "",
47672
- token: token || ""
47771
+ token: token || "",
47772
+ difyApi: (baseUrl == null ? void 0 : baseUrl.difyApi) || ""
47673
47773
  };
47674
47774
  localStorage.setItem("agentWebCache", JSON.stringify(data));
47675
47775
  console.log("缓存数据已保存:", data);
@@ -47947,7 +48047,7 @@ const Chat3 = forwardRef(
47947
48047
  setInputMsg("");
47948
48048
  };
47949
48049
  const getAnswer = async (id, content2) => {
47950
- var _a2, _b, _c, _d;
48050
+ var _a2, _b, _c;
47951
48051
  setMsgList((prev) => [
47952
48052
  ...prev,
47953
48053
  {
@@ -47970,12 +48070,8 @@ const Chat3 = forwardRef(
47970
48070
  query.content = `${query.content} 以下内容:${aiActionText}`;
47971
48071
  }
47972
48072
  console.log("query123", query);
47973
- const host = (_a2 = window == null ? void 0 : window.location) == null ? void 0 : _a2.hostname;
47974
- let apiUrl = "http://111.6.44.42:30000/v1/chat-messages";
47975
- const intelligentQaApiKey = ((_b = baseUrl == null ? void 0 : baseUrl.aiAnswerAgent) == null ? void 0 : _b.tokens) || ((_c = JSON.parse(localStorage.getItem("aiAnswerAgent") || "{}")) == null ? void 0 : _c.tokens) || "app-U9WTcWVUrU9LL6Z01FHxsMMS";
47976
- if (host === "62.168.243.3") {
47977
- apiUrl = "http://62.168.243.3:8899/v1/chat-messages";
47978
- }
48073
+ let apiUrl = (baseUrl == null ? void 0 : baseUrl.difyApi) || localStorage.getItem("difyApi") || "http://62.168.243.3:8899";
48074
+ const intelligentQaApiKey = ((_a2 = baseUrl == null ? void 0 : baseUrl.aiAnswerAgent) == null ? void 0 : _a2.tokens) || ((_b = JSON.parse(localStorage.getItem("aiAnswerAgent") || "{}")) == null ? void 0 : _b.tokens) || "app-U9WTcWVUrU9LL6Z01FHxsMMS";
47979
48075
  const requestBody = {
47980
48076
  files: [],
47981
48077
  response_mode: "streaming",
@@ -47984,7 +48080,7 @@ const Chat3 = forwardRef(
47984
48080
  user: "admin1"
47985
48081
  };
47986
48082
  try {
47987
- const response = await fetch(apiUrl, {
48083
+ const response = await fetch(`${apiUrl}/v1/chat-messages`, {
47988
48084
  method: "POST",
47989
48085
  headers: {
47990
48086
  Authorization: `Bearer ${intelligentQaApiKey}`,
@@ -48013,7 +48109,7 @@ const Chat3 = forwardRef(
48013
48109
  console.log("response123", errorData.error, "currentIndex");
48014
48110
  return;
48015
48111
  }
48016
- const reader = (_d = response.body) == null ? void 0 : _d.getReader();
48112
+ const reader = (_c = response.body) == null ? void 0 : _c.getReader();
48017
48113
  if (!reader) {
48018
48114
  throw new Error("无法获取响应流");
48019
48115
  }
@@ -48331,7 +48427,7 @@ const AiBlockEdit = ({
48331
48427
  const initVueEditor = async () => {
48332
48428
  if (editorRef.current) {
48333
48429
  try {
48334
- const BlockNoteEditorModule = await import("./index.es-DMd0A_6T.js");
48430
+ const BlockNoteEditorModule = await import("./index.es-DMJt4GKa.js");
48335
48431
  const BlockNoteEditor = BlockNoteEditorModule.BlockNoteEditor;
48336
48432
  const theme = {
48337
48433
  colors: {
@@ -49075,7 +49171,7 @@ class BasePromptTemplate extends Runnable {
49075
49171
  return PromptTemplate2.deserialize({ ...data, _type: "prompt" });
49076
49172
  }
49077
49173
  case "few_shot": {
49078
- const { FewShotPromptTemplate } = await import("./few_shot-krMIGhtD.js");
49174
+ const { FewShotPromptTemplate } = await import("./few_shot-gSVVGxla.js");
49079
49175
  return FewShotPromptTemplate.deserialize(data);
49080
49176
  }
49081
49177
  default:
@@ -50647,35 +50743,35 @@ class BaseChain extends BaseLangChain {
50647
50743
  static async deserialize(data, values = {}) {
50648
50744
  switch (data._type) {
50649
50745
  case "llm_chain": {
50650
- const { LLMChain } = await import("./llm_chain-BtiRP0KD.js");
50746
+ const { LLMChain } = await import("./llm_chain-w8wntN4h.js");
50651
50747
  return LLMChain.deserialize(data);
50652
50748
  }
50653
50749
  case "sequential_chain": {
50654
- const { SequentialChain } = await import("./sequential_chain-CIOBgXXk.js");
50750
+ const { SequentialChain } = await import("./sequential_chain-BM--qOte.js");
50655
50751
  return SequentialChain.deserialize(data);
50656
50752
  }
50657
50753
  case "simple_sequential_chain": {
50658
- const { SimpleSequentialChain } = await import("./sequential_chain-CIOBgXXk.js");
50754
+ const { SimpleSequentialChain } = await import("./sequential_chain-BM--qOte.js");
50659
50755
  return SimpleSequentialChain.deserialize(data);
50660
50756
  }
50661
50757
  case "stuff_documents_chain": {
50662
- const { StuffDocumentsChain } = await import("./combine_docs_chain-NeRy0Hbg.js");
50758
+ const { StuffDocumentsChain } = await import("./combine_docs_chain-BuCRFs9X.js");
50663
50759
  return StuffDocumentsChain.deserialize(data);
50664
50760
  }
50665
50761
  case "map_reduce_documents_chain": {
50666
- const { MapReduceDocumentsChain } = await import("./combine_docs_chain-NeRy0Hbg.js");
50762
+ const { MapReduceDocumentsChain } = await import("./combine_docs_chain-BuCRFs9X.js");
50667
50763
  return MapReduceDocumentsChain.deserialize(data);
50668
50764
  }
50669
50765
  case "refine_documents_chain": {
50670
- const { RefineDocumentsChain } = await import("./combine_docs_chain-NeRy0Hbg.js");
50766
+ const { RefineDocumentsChain } = await import("./combine_docs_chain-BuCRFs9X.js");
50671
50767
  return RefineDocumentsChain.deserialize(data);
50672
50768
  }
50673
50769
  case "vector_db_qa": {
50674
- const { VectorDBQAChain } = await import("./vector_db_qa-YtLcD1gH.js");
50770
+ const { VectorDBQAChain } = await import("./vector_db_qa-S7zmkxZD.js");
50675
50771
  return VectorDBQAChain.deserialize(data, values);
50676
50772
  }
50677
50773
  case "api_chain": {
50678
- const { APIChain } = await import("./api_chain-DqjloRDK.js");
50774
+ const { APIChain } = await import("./api_chain-x7-sx3WZ.js");
50679
50775
  return APIChain.deserialize(data);
50680
50776
  }
50681
50777
  default:
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DSZ4uL36.cjs");exports.fromDom=e.fromDom;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-C3FsKcaa.cjs");exports.fromDom=e.fromDom;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DSZ4uL36.cjs");exports.unified=e.unified;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-C3FsKcaa.cjs");exports.unified=e.unified;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-2yo2kUGy.cjs"),t=require("./index-DSZ4uL36.cjs"),n={}.hasOwnProperty;function r(e,t){let o,i=-1;if(t.extensions)for(;++i<t.extensions.length;)r(e,t.extensions[i]);for(o in t)if(n.call(t,o))switch(o){case"extensions":break;case"unsafe":case"join":c(e[o],t[o]);break;case"handlers":a(e[o],t[o]);break;default:e.options[o]=t[o]}return e}function c(e,t){t&&e.push(...t)}function a(e,t){t&&Object.assign(e,t)}const o=[function(e,n,r,c){if("code"===n.type&&t.formatCodeAsIndented(n,c)&&("list"===e.type||e.type===n.type&&t.formatCodeAsIndented(e,c)))return!1;if("spread"in r&&"boolean"==typeof r.spread){if("paragraph"===e.type&&(e.type===n.type||"definition"===n.type||"heading"===n.type&&t.formatHeadingAsSetext(n,c)))return;return r.spread?1:0}}];const i=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],s=[{character:"\t",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"\t",before:"[\\r\\n]",inConstruct:"phrasing"},{character:"\t",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"\r",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:"\n",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"!",after:"\\[",inConstruct:"phrasing",notInConstruct:i},{character:'"',inConstruct:"titleQuote"},{atBreak:!0,character:"#"},{character:"#",inConstruct:"headingAtx",after:"(?:[\r\n]|$)"},{character:"&",after:"[#A-Za-z]",inConstruct:"phrasing"},{character:"'",inConstruct:"titleApostrophe"},{character:"(",inConstruct:"destinationRaw"},{before:"\\]",character:"(",inConstruct:"phrasing",notInConstruct:i},{atBreak:!0,before:"\\d+",character:")"},{character:")",inConstruct:"destinationRaw"},{atBreak:!0,character:"*",after:"(?:[ \t\r\n*])"},{character:"*",inConstruct:"phrasing",notInConstruct:i},{atBreak:!0,character:"+",after:"(?:[ \t\r\n])"},{atBreak:!0,character:"-",after:"(?:[ \t\r\n-])"},{atBreak:!0,before:"\\d+",character:".",after:"(?:[ \t\r\n]|$)"},{atBreak:!0,character:"<",after:"[!/?A-Za-z]"},{character:"<",after:"[!/?A-Za-z]",inConstruct:"phrasing",notInConstruct:i},{character:"<",inConstruct:"destinationLiteral"},{atBreak:!0,character:"="},{atBreak:!0,character:">"},{character:">",inConstruct:"destinationLiteral"},{atBreak:!0,character:"["},{character:"[",inConstruct:"phrasing",notInConstruct:i},{character:"[",inConstruct:["label","reference"]},{character:"\\",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"]",inConstruct:["label","reference"]},{atBreak:!0,character:"_"},{character:"_",inConstruct:"phrasing",notInConstruct:i},{atBreak:!0,character:"`"},{character:"`",inConstruct:["codeFencedLangGraveAccent","codeFencedMetaGraveAccent"]},{character:"`",inConstruct:"phrasing",notInConstruct:i},{atBreak:!0,character:"~"}];function h(e){return e.label||!e.identifier?e.label||"":t.decodeString(e.identifier)}function u(e){if(!e._compiled){const t=(e.atBreak?"[\\r\\n][\\t ]*":"")+(e.before?"(?:"+e.before+")":"");e._compiled=new RegExp((t?"("+t+")":"")+(/[|\\{}()[\]^$+*?.-]/.test(e.character)?"\\":"")+e.character+(e.after?"(?:"+e.after+")":""),"g")}return e._compiled}function f(e,t,n,r){let c=r.join.length;for(;c--;){const a=r.join[c](e,t,n,r);if(!0===a||1===a)break;if("number"==typeof a)return"\n".repeat(1+a);if(!1===a)return"\n\n\x3c!----\x3e\n\n"}return"\n\n"}const l=/\r?\n|\r/g;function d(e,t){const n=[];let r,c=0,a=0;for(;r=l.exec(e);)o(e.slice(c,r.index)),n.push(r[0]),c=r.index+r[0].length,a++;return o(e.slice(c)),n.join("");function o(e){n.push(t(e,a,!e))}}function p(e,t){return e-t}function g(e,t){const n=/\\(?=[!-/:-@[-`{-~])/g,r=[],c=[],a=e+t;let o,i=-1,s=0;for(;o=n.exec(a);)r.push(o.index);for(;++i<r.length;)s!==r[i]&&c.push(e.slice(s,r[i])),c.push("\\"),s=r[i];return c.push(e.slice(s)),c.join("")}function C(e){const t=e||{},n=t.now||{};let r=t.lineShift||0,c=n.line||1,a=n.column||1;return{move:function(e){const t=e||"",n=t.split(/\r?\n|\r/g),o=n[n.length-1];return c+=n.length-1,a=1===n.length?a+o.length:1+o.length+r,t},current:function(){return{now:{line:c,column:a},lineShift:r}},shift:function(e){r+=e}}}function b(n,c){const a=c||{},i={associationId:h,containerPhrasing:y,containerFlow:v,createTracker:C,compilePattern:u,enter:function(e){return i.stack.push(e),function(){i.stack.pop()}},handlers:{...t.handle},handle:void 0,indentLines:d,indexStack:[],join:[...o],options:{},safe:m,stack:[],unsafe:[...s]};r(i,a),i.options.tightDefinitions&&i.join.push(A),i.handle=e.zwitch("type",{invalid:k,unknown:x,handlers:i.handlers});let f=i.handle(n,void 0,i,{before:"\n",after:"\n",now:{line:1,column:1},lineShift:0});return f&&10!==f.charCodeAt(f.length-1)&&13!==f.charCodeAt(f.length-1)&&(f+="\n"),f}function k(e){throw new Error("Cannot handle value `"+e+"`, expected node")}function x(e){throw new Error("Cannot handle unknown node `"+e.type+"`")}function A(e,t){if("definition"===e.type&&e.type===t.type)return 0}function y(e,n){return function(e,n,r){const c=n.indexStack,a=e.children||[],o=[];let i,s=-1,h=r.before;c.push(-1);let u=n.createTracker(r);for(;++s<a.length;){const f=a[s];let l;if(c[c.length-1]=s,s+1<a.length){let t=n.handle.handlers[a[s+1].type];t&&t.peek&&(t=t.peek),l=t?t(a[s+1],e,n,{before:"",after:"",...u.current()}).charAt(0):""}else l=r.after;o.length>0&&("\r"===h||"\n"===h)&&"html"===f.type&&(o[o.length-1]=o[o.length-1].replace(/(\r?\n|\r)$/," "),h=" ",u=n.createTracker(r),u.move(o.join("")));let d=n.handle(f,e,n,{...u.current(),after:l,before:h});i&&i===d.slice(0,1)&&(d=t.encodeCharacterReference(i.charCodeAt(0))+d.slice(1));const p=n.attentionEncodeSurroundingInfo;n.attentionEncodeSurroundingInfo=void 0,i=void 0,p&&(o.length>0&&p.before&&h===o[o.length-1].slice(-1)&&(o[o.length-1]=o[o.length-1].slice(0,-1)+t.encodeCharacterReference(h.charCodeAt(0))),p.after&&(i=l)),u.move(d),o.push(d),h=d.slice(-1)}return c.pop(),o.join("")}(e,this,n)}function v(e,t){return function(e,t,n){const r=t.indexStack,c=e.children||[],a=t.createTracker(n),o=[];let i=-1;for(r.push(-1);++i<c.length;){const n=c[i];r[r.length-1]=i,o.push(a.move(t.handle(n,e,t,{before:"\n",after:"\n",...a.current()}))),"list"!==n.type&&(t.bulletLastUsed=void 0),i<c.length-1&&o.push(a.move(f(n,c[i+1],e,t)))}return r.pop(),o.join("")}(e,this,t)}function m(e,n){return function(e,n,r){const c=(r.before||"")+(n||"")+(r.after||""),a=[],o=[],i={};let s=-1;for(;++s<e.unsafe.length;){const n=e.unsafe[s];if(!t.patternInScope(e.stack,n))continue;const r=e.compilePattern(n);let o;for(;o=r.exec(c);){const e="before"in n||Boolean(n.atBreak),t="after"in n,r=o.index+(e?o[1].length:0);a.includes(r)?(i[r].before&&!e&&(i[r].before=!1),i[r].after&&!t&&(i[r].after=!1)):(a.push(r),i[r]={before:e,after:t})}}a.sort(p);let h=r.before?r.before.length:0;const u=c.length-(r.after?r.after.length:0);for(s=-1;++s<a.length;){const e=a[s];e<h||e>=u||e+1<u&&a[s+1]===e+1&&i[e].after&&!i[e+1].before&&!i[e+1].after||a[s-1]===e-1&&i[e].before&&!i[e-1].before&&!i[e-1].after||(h!==e&&o.push(g(c.slice(h,e),"\\")),h=e,!/[!-/:-@[-`{-~]/.test(c.charAt(e))||r.encode&&r.encode.includes(c.charAt(e))?(o.push(t.encodeCharacterReference(c.charCodeAt(e))),h++):o.push("\\"))}return o.push(g(c.slice(h,u),r.after)),o.join("")}(this,e,n)}exports.default=function(e){const t=this;t.compiler=function(n){return b(n,{...t.data("settings"),...e,extensions:t.data("toMarkdownExtensions")||[]})}};
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-2yo2kUGy.cjs"),t=require("./index-C3FsKcaa.cjs"),n={}.hasOwnProperty;function r(e,t){let o,i=-1;if(t.extensions)for(;++i<t.extensions.length;)r(e,t.extensions[i]);for(o in t)if(n.call(t,o))switch(o){case"extensions":break;case"unsafe":case"join":c(e[o],t[o]);break;case"handlers":a(e[o],t[o]);break;default:e.options[o]=t[o]}return e}function c(e,t){t&&e.push(...t)}function a(e,t){t&&Object.assign(e,t)}const o=[function(e,n,r,c){if("code"===n.type&&t.formatCodeAsIndented(n,c)&&("list"===e.type||e.type===n.type&&t.formatCodeAsIndented(e,c)))return!1;if("spread"in r&&"boolean"==typeof r.spread){if("paragraph"===e.type&&(e.type===n.type||"definition"===n.type||"heading"===n.type&&t.formatHeadingAsSetext(n,c)))return;return r.spread?1:0}}];const i=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],s=[{character:"\t",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"\t",before:"[\\r\\n]",inConstruct:"phrasing"},{character:"\t",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"\r",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:"\n",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"!",after:"\\[",inConstruct:"phrasing",notInConstruct:i},{character:'"',inConstruct:"titleQuote"},{atBreak:!0,character:"#"},{character:"#",inConstruct:"headingAtx",after:"(?:[\r\n]|$)"},{character:"&",after:"[#A-Za-z]",inConstruct:"phrasing"},{character:"'",inConstruct:"titleApostrophe"},{character:"(",inConstruct:"destinationRaw"},{before:"\\]",character:"(",inConstruct:"phrasing",notInConstruct:i},{atBreak:!0,before:"\\d+",character:")"},{character:")",inConstruct:"destinationRaw"},{atBreak:!0,character:"*",after:"(?:[ \t\r\n*])"},{character:"*",inConstruct:"phrasing",notInConstruct:i},{atBreak:!0,character:"+",after:"(?:[ \t\r\n])"},{atBreak:!0,character:"-",after:"(?:[ \t\r\n-])"},{atBreak:!0,before:"\\d+",character:".",after:"(?:[ \t\r\n]|$)"},{atBreak:!0,character:"<",after:"[!/?A-Za-z]"},{character:"<",after:"[!/?A-Za-z]",inConstruct:"phrasing",notInConstruct:i},{character:"<",inConstruct:"destinationLiteral"},{atBreak:!0,character:"="},{atBreak:!0,character:">"},{character:">",inConstruct:"destinationLiteral"},{atBreak:!0,character:"["},{character:"[",inConstruct:"phrasing",notInConstruct:i},{character:"[",inConstruct:["label","reference"]},{character:"\\",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"]",inConstruct:["label","reference"]},{atBreak:!0,character:"_"},{character:"_",inConstruct:"phrasing",notInConstruct:i},{atBreak:!0,character:"`"},{character:"`",inConstruct:["codeFencedLangGraveAccent","codeFencedMetaGraveAccent"]},{character:"`",inConstruct:"phrasing",notInConstruct:i},{atBreak:!0,character:"~"}];function h(e){return e.label||!e.identifier?e.label||"":t.decodeString(e.identifier)}function u(e){if(!e._compiled){const t=(e.atBreak?"[\\r\\n][\\t ]*":"")+(e.before?"(?:"+e.before+")":"");e._compiled=new RegExp((t?"("+t+")":"")+(/[|\\{}()[\]^$+*?.-]/.test(e.character)?"\\":"")+e.character+(e.after?"(?:"+e.after+")":""),"g")}return e._compiled}function f(e,t,n,r){let c=r.join.length;for(;c--;){const a=r.join[c](e,t,n,r);if(!0===a||1===a)break;if("number"==typeof a)return"\n".repeat(1+a);if(!1===a)return"\n\n\x3c!----\x3e\n\n"}return"\n\n"}const l=/\r?\n|\r/g;function d(e,t){const n=[];let r,c=0,a=0;for(;r=l.exec(e);)o(e.slice(c,r.index)),n.push(r[0]),c=r.index+r[0].length,a++;return o(e.slice(c)),n.join("");function o(e){n.push(t(e,a,!e))}}function p(e,t){return e-t}function g(e,t){const n=/\\(?=[!-/:-@[-`{-~])/g,r=[],c=[],a=e+t;let o,i=-1,s=0;for(;o=n.exec(a);)r.push(o.index);for(;++i<r.length;)s!==r[i]&&c.push(e.slice(s,r[i])),c.push("\\"),s=r[i];return c.push(e.slice(s)),c.join("")}function C(e){const t=e||{},n=t.now||{};let r=t.lineShift||0,c=n.line||1,a=n.column||1;return{move:function(e){const t=e||"",n=t.split(/\r?\n|\r/g),o=n[n.length-1];return c+=n.length-1,a=1===n.length?a+o.length:1+o.length+r,t},current:function(){return{now:{line:c,column:a},lineShift:r}},shift:function(e){r+=e}}}function b(n,c){const a=c||{},i={associationId:h,containerPhrasing:y,containerFlow:v,createTracker:C,compilePattern:u,enter:function(e){return i.stack.push(e),function(){i.stack.pop()}},handlers:{...t.handle},handle:void 0,indentLines:d,indexStack:[],join:[...o],options:{},safe:m,stack:[],unsafe:[...s]};r(i,a),i.options.tightDefinitions&&i.join.push(A),i.handle=e.zwitch("type",{invalid:k,unknown:x,handlers:i.handlers});let f=i.handle(n,void 0,i,{before:"\n",after:"\n",now:{line:1,column:1},lineShift:0});return f&&10!==f.charCodeAt(f.length-1)&&13!==f.charCodeAt(f.length-1)&&(f+="\n"),f}function k(e){throw new Error("Cannot handle value `"+e+"`, expected node")}function x(e){throw new Error("Cannot handle unknown node `"+e.type+"`")}function A(e,t){if("definition"===e.type&&e.type===t.type)return 0}function y(e,n){return function(e,n,r){const c=n.indexStack,a=e.children||[],o=[];let i,s=-1,h=r.before;c.push(-1);let u=n.createTracker(r);for(;++s<a.length;){const f=a[s];let l;if(c[c.length-1]=s,s+1<a.length){let t=n.handle.handlers[a[s+1].type];t&&t.peek&&(t=t.peek),l=t?t(a[s+1],e,n,{before:"",after:"",...u.current()}).charAt(0):""}else l=r.after;o.length>0&&("\r"===h||"\n"===h)&&"html"===f.type&&(o[o.length-1]=o[o.length-1].replace(/(\r?\n|\r)$/," "),h=" ",u=n.createTracker(r),u.move(o.join("")));let d=n.handle(f,e,n,{...u.current(),after:l,before:h});i&&i===d.slice(0,1)&&(d=t.encodeCharacterReference(i.charCodeAt(0))+d.slice(1));const p=n.attentionEncodeSurroundingInfo;n.attentionEncodeSurroundingInfo=void 0,i=void 0,p&&(o.length>0&&p.before&&h===o[o.length-1].slice(-1)&&(o[o.length-1]=o[o.length-1].slice(0,-1)+t.encodeCharacterReference(h.charCodeAt(0))),p.after&&(i=l)),u.move(d),o.push(d),h=d.slice(-1)}return c.pop(),o.join("")}(e,this,n)}function v(e,t){return function(e,t,n){const r=t.indexStack,c=e.children||[],a=t.createTracker(n),o=[];let i=-1;for(r.push(-1);++i<c.length;){const n=c[i];r[r.length-1]=i,o.push(a.move(t.handle(n,e,t,{before:"\n",after:"\n",...a.current()}))),"list"!==n.type&&(t.bulletLastUsed=void 0),i<c.length-1&&o.push(a.move(f(n,c[i+1],e,t)))}return r.pop(),o.join("")}(e,this,t)}function m(e,n){return function(e,n,r){const c=(r.before||"")+(n||"")+(r.after||""),a=[],o=[],i={};let s=-1;for(;++s<e.unsafe.length;){const n=e.unsafe[s];if(!t.patternInScope(e.stack,n))continue;const r=e.compilePattern(n);let o;for(;o=r.exec(c);){const e="before"in n||Boolean(n.atBreak),t="after"in n,r=o.index+(e?o[1].length:0);a.includes(r)?(i[r].before&&!e&&(i[r].before=!1),i[r].after&&!t&&(i[r].after=!1)):(a.push(r),i[r]={before:e,after:t})}}a.sort(p);let h=r.before?r.before.length:0;const u=c.length-(r.after?r.after.length:0);for(s=-1;++s<a.length;){const e=a[s];e<h||e>=u||e+1<u&&a[s+1]===e+1&&i[e].after&&!i[e+1].before&&!i[e+1].after||a[s-1]===e-1&&i[e].before&&!i[e-1].before&&!i[e-1].after||(h!==e&&o.push(g(c.slice(h,e),"\\")),h=e,!/[!-/:-@[-`{-~]/.test(c.charAt(e))||r.encode&&r.encode.includes(c.charAt(e))?(o.push(t.encodeCharacterReference(c.charCodeAt(e))),h++):o.push("\\"))}return o.push(g(c.slice(h,u),r.after)),o.join("")}(this,e,n)}exports.default=function(e){const t=this;t.compiler=function(n){return b(n,{...t.data("settings"),...e,extensions:t.data("toMarkdownExtensions")||[]})}};
@@ -1 +1 @@
1
- "use strict";const e=require("./index-DSZ4uL36.cjs"),t=e.convertElement(function(e){return"audio"===e.tagName||"canvas"===e.tagName||"embed"===e.tagName||"iframe"===e.tagName||"img"===e.tagName||"math"===e.tagName||"object"===e.tagName||"picture"===e.tagName||"svg"===e.tagName||"video"===e.tagName}),r=["address","article","aside","blockquote","body","br","caption","center","col","colgroup","dd","dialog","dir","div","dl","dt","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","legend","li","li","listing","main","menu","nav","ol","optgroup","option","p","plaintext","pre","section","summary","table","tbody","td","td","tfoot","th","th","thead","tr","ul","wbr","xmp"],n=["button","input","select","textarea"],a=["area","base","basefont","dialog","datalist","head","link","meta","noembed","noframes","param","rp","script","source","style","template","track","title"],i={},o=e.convert(["comment","doctype"]);function s(e,t){if("children"in e){const r={...t};return("root"===e.type||u(e))&&(r.before=!0,r.after=!0),r.whitespace=function(e,t){if("tagName"in e&&e.properties)switch(e.tagName){case"listing":case"plaintext":case"script":case"style":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return e.properties.wrap?"pre-wrap":"pre";case"td":case"th":return e.properties.noWrap?"nowrap":t.whitespace;case"textarea":return"pre-wrap"}return t.whitespace}(e,t),function(e,t){let r=t.before;const n=t.after,a=e.children;let i=a.length,o=-1;for(;++o<i;){const e=s(a[o],{...t,after:c(a,o,n),before:r});e.remove?(a.splice(o,1),o--,i--):e.ignore||(r=e.stripAtStart),l(a[o])&&(r=!1)}return{ignore:!1,stripAtStart:Boolean(r||n),remove:!1}}(e,r)}if("text"===e.type){if("normal"===t.whitespace)return function(e,t){const r=t.collapse(e.value),n={ignore:!1,stripAtStart:!1,remove:!1};let a=0,i=r.length;t.before&&f(r.charAt(0))&&a++;a!==i&&f(r.charAt(i-1))&&(t.after?i--:n.stripAtStart=!0);a===i?n.remove=!0:e.value=r.slice(a,i);return n}(e,t);"nowrap"===t.whitespace&&(e.value=t.collapse(e.value))}return{ignore:o(e),stripAtStart:!1,remove:!1}}function c(e,t,r){for(;++t<e.length;){const r=e[t];let n=p(r);if(void 0===n&&"children"in r&&!m(r)&&(n=c(r.children,-1)),"boolean"==typeof n)return n}return r}function p(t){if("element"===t.type){if(l(t))return!1;if(u(t))return!0}else if("text"===t.type){if(!e.whitespace(t))return!1}else if(!o(t))return!1}function l(r){return t(r)||e.isElement(r,n)}function u(t){return e.isElement(t,r)}function m(t){return Boolean("element"===t.type&&t.properties.hidden)||o(t)||e.isElement(t,a)}function f(e){return" "===e||"\n"===e}function d(e){const t=/\r?\n|\r/.exec(e);return t?t[0]:" "}function h(){return" "}function g(e){return function(t){return String(t).replace(/[\t\n\v\f\r ]+/g,e)}}const b={}.hasOwnProperty;const y=new Set(["pingback","prefetch","stylesheet"]);const v=e.convertElement(["a","abbr","area","b","bdi","bdo","br","button","cite","code","data","datalist","del","dfn","em","i","input","ins","kbd","keygen","label","map","mark","meter","noscript","output","progress","q","ruby","s","samp","script","select","small","span","strong","sub","sup","template","textarea","time","u","var","wbr"]),w=e.convertElement("meta");exports.embedded=t,exports.minifyWhitespace=function(e,t){s(e,{collapse:g((t||i).newlines?d:h),whitespace:"normal"})},exports.phrasing=function(e){return Boolean("text"===e.type||v(e)||t(e)||function(e){if("element"!==e.type||"link"!==e.tagName)return!1;if(e.properties.itemProp)return!0;const t=e.properties.rel;let r=-1;if(!Array.isArray(t)||0===t.length)return!1;for(;++r<t.length;)if(!y.has(String(t[r])))return!1;return!0}(e)||w(e)&&function(e,t){const r="element"===e.type&&b.call(e.properties,t)&&e.properties[t];return null!=r&&!1!==r}(e,"itemProp"))};
1
+ "use strict";const e=require("./index-C3FsKcaa.cjs"),t=e.convertElement(function(e){return"audio"===e.tagName||"canvas"===e.tagName||"embed"===e.tagName||"iframe"===e.tagName||"img"===e.tagName||"math"===e.tagName||"object"===e.tagName||"picture"===e.tagName||"svg"===e.tagName||"video"===e.tagName}),r=["address","article","aside","blockquote","body","br","caption","center","col","colgroup","dd","dialog","dir","div","dl","dt","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","legend","li","li","listing","main","menu","nav","ol","optgroup","option","p","plaintext","pre","section","summary","table","tbody","td","td","tfoot","th","th","thead","tr","ul","wbr","xmp"],n=["button","input","select","textarea"],a=["area","base","basefont","dialog","datalist","head","link","meta","noembed","noframes","param","rp","script","source","style","template","track","title"],i={},o=e.convert(["comment","doctype"]);function s(e,t){if("children"in e){const r={...t};return("root"===e.type||u(e))&&(r.before=!0,r.after=!0),r.whitespace=function(e,t){if("tagName"in e&&e.properties)switch(e.tagName){case"listing":case"plaintext":case"script":case"style":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return e.properties.wrap?"pre-wrap":"pre";case"td":case"th":return e.properties.noWrap?"nowrap":t.whitespace;case"textarea":return"pre-wrap"}return t.whitespace}(e,t),function(e,t){let r=t.before;const n=t.after,a=e.children;let i=a.length,o=-1;for(;++o<i;){const e=s(a[o],{...t,after:c(a,o,n),before:r});e.remove?(a.splice(o,1),o--,i--):e.ignore||(r=e.stripAtStart),l(a[o])&&(r=!1)}return{ignore:!1,stripAtStart:Boolean(r||n),remove:!1}}(e,r)}if("text"===e.type){if("normal"===t.whitespace)return function(e,t){const r=t.collapse(e.value),n={ignore:!1,stripAtStart:!1,remove:!1};let a=0,i=r.length;t.before&&f(r.charAt(0))&&a++;a!==i&&f(r.charAt(i-1))&&(t.after?i--:n.stripAtStart=!0);a===i?n.remove=!0:e.value=r.slice(a,i);return n}(e,t);"nowrap"===t.whitespace&&(e.value=t.collapse(e.value))}return{ignore:o(e),stripAtStart:!1,remove:!1}}function c(e,t,r){for(;++t<e.length;){const r=e[t];let n=p(r);if(void 0===n&&"children"in r&&!m(r)&&(n=c(r.children,-1)),"boolean"==typeof n)return n}return r}function p(t){if("element"===t.type){if(l(t))return!1;if(u(t))return!0}else if("text"===t.type){if(!e.whitespace(t))return!1}else if(!o(t))return!1}function l(r){return t(r)||e.isElement(r,n)}function u(t){return e.isElement(t,r)}function m(t){return Boolean("element"===t.type&&t.properties.hidden)||o(t)||e.isElement(t,a)}function f(e){return" "===e||"\n"===e}function d(e){const t=/\r?\n|\r/.exec(e);return t?t[0]:" "}function h(){return" "}function g(e){return function(t){return String(t).replace(/[\t\n\v\f\r ]+/g,e)}}const b={}.hasOwnProperty;const y=new Set(["pingback","prefetch","stylesheet"]);const v=e.convertElement(["a","abbr","area","b","bdi","bdo","br","button","cite","code","data","datalist","del","dfn","em","i","input","ins","kbd","keygen","label","map","mark","meter","noscript","output","progress","q","ruby","s","samp","script","select","small","span","strong","sub","sup","template","textarea","time","u","var","wbr"]),w=e.convertElement("meta");exports.embedded=t,exports.minifyWhitespace=function(e,t){s(e,{collapse:g((t||i).newlines?d:h),whitespace:"normal"})},exports.phrasing=function(e){return Boolean("text"===e.type||v(e)||t(e)||function(e){if("element"!==e.type||"link"!==e.tagName)return!1;if(e.properties.itemProp)return!0;const t=e.properties.rel;let r=-1;if(!Array.isArray(t)||0===t.length)return!1;for(;++r<t.length;)if(!y.has(String(t[r])))return!1;return!0}(e)||w(e)&&function(e,t){const r="element"===e.type&&b.call(e.properties,t)&&e.properties[t];return null!=r&&!1!==r}(e,"itemProp"))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DSZ4uL36.cjs");exports.default=e.remarkParse;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-C3FsKcaa.cjs");exports.default=e.remarkParse;
@@ -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-D5DVRfMz.js";
2
- import { m as minifyWhitespace, p as phrasing$1 } from "./index-DYwvfMBR.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-B2mOy3px.js";
2
+ import { m as minifyWhitespace, p as phrasing$1 } from "./index-Tl0OUfTE.js";
3
3
  function rehypeMinifyWhitespace(options) {
4
4
  return function(tree) {
5
5
  minifyWhitespace(tree, options);
@@ -0,0 +1,4 @@
1
+ import { f } from "./index-B2mOy3px.js";
2
+ export {
3
+ f as fromDom
4
+ };