rhua-chatgpt-web 1.0.96 → 1.0.98

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-t_8TRlyv.cjs → api_chain-CB8GWGIU.cjs} +1 -1
  2. package/dist/{api_chain-afAdVHDm.js → api_chain-wgmc7e6E.js} +2 -2
  3. package/dist/{combine_docs_chain-Br1Rr0Rb.js → combine_docs_chain-C4dphi5e.js} +2 -2
  4. package/dist/{combine_docs_chain-EowNvnxN.cjs → combine_docs_chain-DgONM3Mw.cjs} +1 -1
  5. package/dist/{few_shot-CQCo91rD.js → few_shot-CAlLA7_Y.js} +1 -1
  6. package/dist/{few_shot-BKHTU9b_.cjs → few_shot-D1R-zNl7.cjs} +1 -1
  7. package/dist/index-ASKx-pn3.js +4 -0
  8. package/dist/index-B-yz5nX2.js +4 -0
  9. package/dist/{index-CMSCfrvC.js → index-BN7_2Vpx.js} +2 -2
  10. package/dist/{index-DQmVXdK3.js → index-BbYqG4Lp.js} +15 -13
  11. package/dist/{index-CnGjKfJ5.cjs → index-BekrpxaM.cjs} +1 -1
  12. package/dist/{index-kt4FdNzF.js → index-Bg42RK-4.js} +2 -2
  13. package/dist/{index-CLn076kd.js → index-Bg5840_w.js} +1 -1
  14. package/dist/{index-DytXpTiI.js → index-C1T2elxu.js} +1 -1
  15. package/dist/{index-CaBBFgNG.js → index-CI8OM2Jz.js} +1 -1
  16. package/dist/{index-DKIQFTo9.cjs → index-Cd_gRf5s.cjs} +1 -1
  17. package/dist/{index-Cggnoc58.cjs → index-CfwXktuP.cjs} +1 -1
  18. package/dist/{index-DiYQB5L6.cjs → index-CjSvTRsR.cjs} +1 -1
  19. package/dist/{index-CRTTZbZC.cjs → index-CjmBLRKu.cjs} +3 -3
  20. package/dist/index-Ctbtl5KP.js +4 -0
  21. package/dist/index-Cuzto2LI.js +4 -0
  22. package/dist/{index-DUQnnPBy.js → index-CymPiKxB.js} +1 -1
  23. package/dist/{index-CCNn5Bo9.cjs → index-D6StpCel.cjs} +1 -1
  24. package/dist/{index-Vxbq1ojH.cjs → index-D8gIJjM_.cjs} +1 -1
  25. package/dist/{index-CdaYIkhy.cjs → index-DMb9FQJU.cjs} +1 -1
  26. package/dist/{index-B_1f4Jfz.cjs → index-DWSafnCg.cjs} +1 -1
  27. package/dist/{index-CI9mXQPf.js → index-DrDcayhM.js} +1 -1
  28. package/dist/{index-DvPFqEVC.cjs → index-Dt6MdEi3.cjs} +1 -1
  29. package/dist/{index-CDb55MO_.cjs → index-cTMOFBXD.cjs} +1 -1
  30. package/dist/{index-CERVpltu.cjs → index-r3AjaSlS.cjs} +1 -1
  31. package/dist/index.cjs.js +1 -1
  32. package/dist/{index.es-BOZgZD8A.js → index.es-67G0dUQ8.js} +11 -11
  33. package/dist/{index.es-B0nBFNNH.cjs → index.es-CtypdcdJ.cjs} +2 -2
  34. package/dist/index.esm.js +1 -1
  35. package/dist/{llm_chain-DS2Nvm4J.js → llm_chain-AXaQuXMt.js} +1 -1
  36. package/dist/{llm_chain-Do6Bmxc-.cjs → llm_chain-RoYoMcLp.cjs} +1 -1
  37. package/dist/{sequential_chain-Bu7910Yj.cjs → sequential_chain-9yzJVjdz.cjs} +1 -1
  38. package/dist/{sequential_chain-DZ9jTtpY.js → sequential_chain-DVxvWiQQ.js} +1 -1
  39. package/dist/{vector_db_qa-DmJiJnqp.cjs → vector_db_qa-4lYMS_5X.cjs} +1 -1
  40. package/dist/{vector_db_qa-BGFPj0S2.js → vector_db_qa-Ca-yXUO_.js} +3 -3
  41. package/package.json +1 -1
  42. package/dist/index-1z0_mPdy.js +0 -4
  43. package/dist/index-BoBucaw7.js +0 -4
  44. package/dist/index-DOshYiJE.js +0 -4
  45. package/dist/index-XZei6kRJ.js +0 -4
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CRTTZbZC.cjs"),i=require("./llm_chain-Do6Bmxc-.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-CjmBLRKu.cjs"),i=require("./llm_chain-RoYoMcLp.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-DQmVXdK3.js";
2
- import { LLMChain } from "./llm_chain-DS2Nvm4J.js";
1
+ import { P as PromptTemplate, i as BaseChain } from "./index-BbYqG4Lp.js";
2
+ import { LLMChain } from "./llm_chain-AXaQuXMt.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-DQmVXdK3.js";
3
- import { LLMChain } from "./llm_chain-DS2Nvm4J.js";
2
+ import { i as BaseChain, P as PromptTemplate } from "./index-BbYqG4Lp.js";
3
+ import { LLMChain } from "./llm_chain-AXaQuXMt.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-CRTTZbZC.cjs"),t=require("./llm_chain-Do6Bmxc-.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-CjmBLRKu.cjs"),t=require("./llm_chain-RoYoMcLp.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,4 +1,4 @@
1
- import { B as BaseStringPromptTemplate, e as checkValidTemplate, g as renderTemplate, P as PromptTemplate } from "./index-DQmVXdK3.js";
1
+ import { B as BaseStringPromptTemplate, e as checkValidTemplate, g as renderTemplate, P as PromptTemplate } from "./index-BbYqG4Lp.js";
2
2
  import "zod";
3
3
  class FewShotPromptTemplate extends BaseStringPromptTemplate {
4
4
  constructor(input) {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CRTTZbZC.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-CjmBLRKu.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;
@@ -0,0 +1,4 @@
1
+ import { r } from "./index-BbYqG4Lp.js";
2
+ export {
3
+ r as default
4
+ };
@@ -0,0 +1,4 @@
1
+ import { u } from "./index-BbYqG4Lp.js";
2
+ export {
3
+ u as unified
4
+ };
@@ -1,5 +1,5 @@
1
- import { m as minifyWhitespace, e as embedded, p as phrasing } from "./index-CaBBFgNG.js";
2
- import { v as visitParents, S as SKIP, w as whitespace } from "./index-DQmVXdK3.js";
1
+ import { m as minifyWhitespace, e as embedded, p as phrasing } from "./index-CI8OM2Jz.js";
2
+ import { v as visitParents, S as SKIP, w as whitespace } from "./index-BbYqG4Lp.js";
3
3
  const whitespaceSensitiveTagNames = [
4
4
  "pre",
5
5
  "script",
@@ -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.eyJzdWIiOiJhZG1pbiIsImxvZ2luX3VzZXJfa2V5IjoiZjIyNzI3MmUtNWY1Zi00MjU4LWEwZGMtODc1ZjZiZmIwOTE2In0.IpZ4CNgQBKvgmJFBvGly1PTlruaR7yVrqyJKgW_SWVSrHfGjjtUmEInu2tQlj3ETDb15sdXCIV4dlMPu0iqHTA";
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,6 +1595,7 @@ const AiList = ({
1595
1595
  handleWrite,
1596
1596
  usageIncrementFn
1597
1597
  }) => {
1598
+ console.log("父组件传过来的appTypeOptions:", appTypeOptions);
1598
1599
  const navigate = useNavigate();
1599
1600
  const [activeFilter, setActiveFilter] = useState(() => {
1600
1601
  try {
@@ -46489,7 +46490,7 @@ const BlockEdit = ({
46489
46490
  const initVueEditor = async () => {
46490
46491
  if (editorRef.current) {
46491
46492
  try {
46492
- const BlockNoteEditorModule = await import("./index.es-BOZgZD8A.js");
46493
+ const BlockNoteEditorModule = await import("./index.es-67G0dUQ8.js");
46493
46494
  const BlockNoteEditor = BlockNoteEditorModule.BlockNoteEditor;
46494
46495
  const theme = {
46495
46496
  colors: {
@@ -46605,6 +46606,7 @@ const BlockEdit = ({
46605
46606
  const AgentWebIndex = ({
46606
46607
  baseUrl,
46607
46608
  token,
46609
+ appTypeOptions,
46608
46610
  loginOut,
46609
46611
  appClick,
46610
46612
  Add,
@@ -46620,7 +46622,6 @@ const AgentWebIndex = ({
46620
46622
  );
46621
46623
  const [incomingAgent, setIncomingAgent] = useState(null);
46622
46624
  useEffect(() => {
46623
- console.log("baseUrl00", baseUrl);
46624
46625
  if (baseUrl && baseUrl.agentCard) {
46625
46626
  const agentData = {
46626
46627
  id: baseUrl.agentCard.id,
@@ -46747,6 +46748,7 @@ const AgentWebIndex = ({
46747
46748
  {
46748
46749
  baseUrl,
46749
46750
  token,
46751
+ appTypeOptions,
46750
46752
  onOpenCard: handleOpenCard,
46751
46753
  onLogout: handleLogout,
46752
46754
  handleAdd,
@@ -47442,7 +47444,7 @@ const AiBlockEdit = ({
47442
47444
  const initVueEditor = async () => {
47443
47445
  if (editorRef.current) {
47444
47446
  try {
47445
- const BlockNoteEditorModule = await import("./index.es-BOZgZD8A.js");
47447
+ const BlockNoteEditorModule = await import("./index.es-67G0dUQ8.js");
47446
47448
  const BlockNoteEditor = BlockNoteEditorModule.BlockNoteEditor;
47447
47449
  const theme = {
47448
47450
  colors: {
@@ -48368,7 +48370,7 @@ class BasePromptTemplate extends Runnable {
48368
48370
  return PromptTemplate2.deserialize({ ...data, _type: "prompt" });
48369
48371
  }
48370
48372
  case "few_shot": {
48371
- const { FewShotPromptTemplate } = await import("./few_shot-CQCo91rD.js");
48373
+ const { FewShotPromptTemplate } = await import("./few_shot-CAlLA7_Y.js");
48372
48374
  return FewShotPromptTemplate.deserialize(data);
48373
48375
  }
48374
48376
  default:
@@ -49940,35 +49942,35 @@ class BaseChain extends BaseLangChain {
49940
49942
  static async deserialize(data, values = {}) {
49941
49943
  switch (data._type) {
49942
49944
  case "llm_chain": {
49943
- const { LLMChain } = await import("./llm_chain-DS2Nvm4J.js");
49945
+ const { LLMChain } = await import("./llm_chain-AXaQuXMt.js");
49944
49946
  return LLMChain.deserialize(data);
49945
49947
  }
49946
49948
  case "sequential_chain": {
49947
- const { SequentialChain } = await import("./sequential_chain-DZ9jTtpY.js");
49949
+ const { SequentialChain } = await import("./sequential_chain-DVxvWiQQ.js");
49948
49950
  return SequentialChain.deserialize(data);
49949
49951
  }
49950
49952
  case "simple_sequential_chain": {
49951
- const { SimpleSequentialChain } = await import("./sequential_chain-DZ9jTtpY.js");
49953
+ const { SimpleSequentialChain } = await import("./sequential_chain-DVxvWiQQ.js");
49952
49954
  return SimpleSequentialChain.deserialize(data);
49953
49955
  }
49954
49956
  case "stuff_documents_chain": {
49955
- const { StuffDocumentsChain } = await import("./combine_docs_chain-Br1Rr0Rb.js");
49957
+ const { StuffDocumentsChain } = await import("./combine_docs_chain-C4dphi5e.js");
49956
49958
  return StuffDocumentsChain.deserialize(data);
49957
49959
  }
49958
49960
  case "map_reduce_documents_chain": {
49959
- const { MapReduceDocumentsChain } = await import("./combine_docs_chain-Br1Rr0Rb.js");
49961
+ const { MapReduceDocumentsChain } = await import("./combine_docs_chain-C4dphi5e.js");
49960
49962
  return MapReduceDocumentsChain.deserialize(data);
49961
49963
  }
49962
49964
  case "refine_documents_chain": {
49963
- const { RefineDocumentsChain } = await import("./combine_docs_chain-Br1Rr0Rb.js");
49965
+ const { RefineDocumentsChain } = await import("./combine_docs_chain-C4dphi5e.js");
49964
49966
  return RefineDocumentsChain.deserialize(data);
49965
49967
  }
49966
49968
  case "vector_db_qa": {
49967
- const { VectorDBQAChain } = await import("./vector_db_qa-BGFPj0S2.js");
49969
+ const { VectorDBQAChain } = await import("./vector_db_qa-Ca-yXUO_.js");
49968
49970
  return VectorDBQAChain.deserialize(data, values);
49969
49971
  }
49970
49972
  case "api_chain": {
49971
- const { APIChain } = await import("./api_chain-afAdVHDm.js");
49973
+ const { APIChain } = await import("./api_chain-wgmc7e6E.js");
49972
49974
  return APIChain.deserialize(data);
49973
49975
  }
49974
49976
  default:
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CRTTZbZC.cjs");exports.default=e.remarkRehype,exports.defaultFootnoteBackContent=e.defaultFootnoteBackContent,exports.defaultFootnoteBackLabel=e.defaultFootnoteBackLabel,exports.defaultHandlers=e.handlers;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CjmBLRKu.cjs");exports.default=e.remarkRehype,exports.defaultFootnoteBackContent=e.defaultFootnoteBackContent,exports.defaultFootnoteBackLabel=e.defaultFootnoteBackLabel,exports.defaultHandlers=e.handlers;
@@ -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-DQmVXdK3.js";
2
- import { m as minifyWhitespace, p as phrasing$1 } from "./index-CaBBFgNG.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-BbYqG4Lp.js";
2
+ import { m as minifyWhitespace, p as phrasing$1 } from "./index-CI8OM2Jz.js";
3
3
  function rehypeMinifyWhitespace(options) {
4
4
  return function(tree) {
5
5
  minifyWhitespace(tree, options);
@@ -1,4 +1,4 @@
1
- import { w as whitespace, A as svg, I as find, L as stringify, M as stringify$1, N as ccount, D as html$2 } from "./index-DQmVXdK3.js";
1
+ import { w as whitespace, A as svg, I as find, L as stringify, M as stringify$1, N as ccount, D as html$2 } from "./index-BbYqG4Lp.js";
2
2
  import { z as zwitch } from "./index-BEZf1ZPW.js";
3
3
  const htmlVoidElements = [
4
4
  "area",
@@ -1,4 +1,4 @@
1
- import { c, d, b, h } from "./index-DQmVXdK3.js";
1
+ import { c, d, b, h } from "./index-BbYqG4Lp.js";
2
2
  export {
3
3
  c as default,
4
4
  d as defaultFootnoteBackContent,
@@ -1,4 +1,4 @@
1
- import { n as convertElement, o as convert, p as isElement, w as whitespace } from "./index-DQmVXdK3.js";
1
+ import { n as convertElement, o as convert, p as isElement, w as whitespace } from "./index-BbYqG4Lp.js";
2
2
  const embedded = convertElement(
3
3
  /**
4
4
  * @param element