rhua-chatgpt-web 1.0.93 → 1.0.95
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +223 -223
- package/dist/{api_chain-WFRw5ML6.js → api_chain-20qmBmlt.js} +2 -2
- package/dist/{api_chain-CIsWCKgO.cjs → api_chain-BZSxhO6w.cjs} +1 -1
- package/dist/{combine_docs_chain-DqweE4hu.js → combine_docs_chain-CDmPC9j3.js} +2 -2
- package/dist/{combine_docs_chain-CkTm-Y6L.cjs → combine_docs_chain-CbIBHz_O.cjs} +1 -1
- package/dist/{few_shot-CmdeM2Sr.cjs → few_shot-Cse9lSUl.cjs} +1 -1
- package/dist/{few_shot-kQ1bURcp.js → few_shot-DfBa9t3B.js} +1 -1
- package/dist/{index-CtmkEXCG.cjs → index-31BZbUUr.cjs} +1 -1
- package/dist/{index-Nt9bzxJ_.cjs → index-B41f3XKz.cjs} +1 -1
- package/dist/{index-D_TuMfnS.cjs → index-BM6gAiMn.cjs} +1 -1
- package/dist/{index-C8bFGXwg.js → index-Bpr1h_Sb.js} +154 -43
- package/dist/index-CEO5NUwI.js +4 -0
- package/dist/{index-BPX5EZOq.js → index-CMZ1iYNF.js} +1 -1
- package/dist/{index-bPzWh1YX.cjs → index-CadWq4hy.cjs} +1 -1
- package/dist/{index-BvWfN0UD.cjs → index-CpQhSxWi.cjs} +1 -1
- package/dist/{index-vxdzUOjI.cjs → index-D0xSgOzS.cjs} +1 -1
- package/dist/{index-wmWIMjxl.cjs → index-D7oNp3Pm.cjs} +3 -3
- package/dist/{index-DCl8PutS.cjs → index-DGmNs476.cjs} +1 -1
- package/dist/{index-D8eBKhCD.js → index-DKUZgpc6.js} +1 -1
- package/dist/{index-BwqspcrS.js → index-DLqxbJWX.js} +1 -1
- package/dist/index-DM1nrsZt.js +4 -0
- package/dist/{index-DGYrYxhA.cjs → index-DTEXidrg.cjs} +1 -1
- package/dist/{index-CESOAxk0.cjs → index-DVReuqWr.cjs} +1 -1
- package/dist/{index-Ibj7Di2W.js → index-Da-y319P.js} +2 -2
- package/dist/{index-CkLkNVjI.cjs → index-DvTAMnrH.cjs} +1 -1
- package/dist/index-DvzltS2g.js +4 -0
- package/dist/{index-Bx-JSxcE.cjs → index-EmBbPCdW.cjs} +1 -1
- package/dist/index-_1gNyqhr.js +4 -0
- package/dist/{index-RVAEf-1O.js → index-tBT9gQsn.js} +1 -1
- package/dist/{index-BQaCU-Zp.js → index-yZJRezRU.js} +1 -1
- package/dist/{index-DbigX4D6.js → index-zHbud3WS.js} +2 -2
- package/dist/index.cjs.js +1 -1
- package/dist/{index.es-C-eoW8oA.js → index.es-Blj5Atj5.js} +11 -11
- package/dist/{index.es-Cz-8rjns.cjs → index.es-CNLqGQVd.cjs} +2 -2
- package/dist/index.esm.js +1 -1
- package/dist/{llm_chain-BJGCHbKb.js → llm_chain-2sbPhu7X.js} +1 -1
- package/dist/{llm_chain-DNHnACm7.cjs → llm_chain-DmZ1DWv0.cjs} +1 -1
- package/dist/{sequential_chain-o9cEEPAB.cjs → sequential_chain-CdTyj5LA.cjs} +1 -1
- package/dist/{sequential_chain-DYCvZ3do.js → sequential_chain-MJvo-IhJ.js} +1 -1
- package/dist/tauri.svg +6 -6
- package/dist/{vector_db_qa-l1JxA-2O.js → vector_db_qa-C6Krwg5m.js} +3 -3
- package/dist/{vector_db_qa-B2bEMYL1.cjs → vector_db_qa-ayOVjhbO.cjs} +1 -1
- package/package.json +135 -135
- package/dist/index-7PhG3Bul.js +0 -4
- package/dist/index-BLKrtdG3.js +0 -4
- package/dist/index-BeyeAUBa.js +0 -4
- package/dist/index-DdHqkr9E.js +0 -4
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $, a0, a4, a2, a3, a1 } from "./index-
|
|
1
|
+
import { $, a0, a4, a2, a3, a1 } from "./index-Bpr1h_Sb.js";
|
|
2
2
|
import "katex/dist/katex.min.css";
|
|
3
3
|
import "@semi-bot/semi-theme-xiangshuishidai/scss/index.scss";
|
|
4
4
|
import "@semi-bot/semi-theme-xiangshuishidai/scss/global.scss";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { j as BaseOutputParser, i as BaseChain, k as BasePromptTemplate, l as BaseLanguageModel, R as Runnable } from "./index-
|
|
1
|
+
import { j as BaseOutputParser, i as BaseChain, k as BasePromptTemplate, l as BaseLanguageModel, R as Runnable } from "./index-Bpr1h_Sb.js";
|
|
2
2
|
import "zod";
|
|
3
3
|
class NoOpOutputParser extends BaseOutputParser {
|
|
4
4
|
constructor() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-D7oNp3Pm.cjs");require("zod");class t extends e.BaseOutputParser{constructor(){super(...arguments),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","output_parsers","default"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0})}static lc_name(){return"NoOpOutputParser"}parse(e){return Promise.resolve(e)}getFormatInstructions(){return""}}function r(t){if(function(e){return"function"==typeof e._llmType}(t))return t;if("bound"in t&&e.Runnable.isRunnable(t.bound))return r(t.bound);if("runnable"in t&&"fallbacks"in t&&e.Runnable.isRunnable(t.runnable))return r(t.runnable);if("default"in t&&e.Runnable.isRunnable(t.default))return r(t.default);throw new Error("Unable to extract BaseLanguageModel from llmLike object.")}class i extends e.BaseChain{static lc_name(){return"LLMChain"}get inputKeys(){return this.prompt.inputVariables}get outputKeys(){return[this.outputKey]}constructor(e){if(super(e),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"prompt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"llm",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"llmKwargs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"outputKey",{enumerable:!0,configurable:!0,writable:!0,value:"text"}),Object.defineProperty(this,"outputParser",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.prompt=e.prompt,this.llm=e.llm,this.llmKwargs=e.llmKwargs,this.outputKey=e.outputKey??this.outputKey,this.outputParser=e.outputParser??new t,this.prompt.outputParser){if(e.outputParser)throw new Error("Cannot set both outputParser and prompt.outputParser");this.outputParser=this.prompt.outputParser}}getCallKeys(){return"callKeys"in this.llm?this.llm.callKeys:[]}_selectMemoryInputs(e){const t=super._selectMemoryInputs(e),r=this.getCallKeys();for(const i of r)i in e&&delete t[i];return t}async _getFinalOutput(e,t,r){let i;return i=this.outputParser?await this.outputParser.parseResultWithPrompt(e,t,null==r?void 0:r.getChild()):e[0].text,i}call(e,t){return super.call(e,t)}async _call(e,t){const r={...e},i={...this.llmKwargs},l=this.getCallKeys();for(const s of l)s in e&&i&&(i[s]=e[s],delete r[s]);const a=await this.prompt.formatPromptValue(r);if("generatePrompt"in this.llm){const{generations:e}=await this.llm.generatePrompt([a],i,null==t?void 0:t.getChild());return{[this.outputKey]:await this._getFinalOutput(e[0],a,t)}}const n=this.outputParser?this.llm.pipe(this.outputParser):this.llm,u=await n.invoke(a,null==t?void 0:t.getChild());return{[this.outputKey]:u}}async predict(e,t){return(await this.call(e,t))[this.outputKey]}_chainType(){return"llm"}static async deserialize(t){const{llm:r,prompt:l}=t;if(!r)throw new Error("LLMChain must have llm");if(!l)throw new Error("LLMChain must have prompt");return new i({llm:await e.BaseLanguageModel.deserialize(r),prompt:await e.BasePromptTemplate.deserialize(l)})}serialize(){const e="serialize"in this.llm?this.llm.serialize():void 0;return{_type:`${this._chainType()}_chain`,llm:e,prompt:this.prompt.serialize()}}_getNumTokens(e){return r(this.llm).getNumTokens(e)}}exports.LLMChain=i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-D7oNp3Pm.cjs");function t(e,t){const i=new Set;for(const n of t)e.has(n)&&i.add(n);return i}function i(e,t){const i=new Set(e);for(const n of t)i.delete(n);return i}function n(e){return Array.from(e).map(e=>`"${e}"`).join(", ")}class a extends e.BaseChain{static lc_name(){return"SequentialChain"}get inputKeys(){return this.inputVariables}get outputKeys(){return this.outputVariables}constructor(e){if(super(e),Object.defineProperty(this,"chains",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"inputVariables",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"outputVariables",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"returnAll",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.chains=e.chains,this.inputVariables=e.inputVariables,this.outputVariables=e.outputVariables??[],this.outputVariables.length>0&&e.returnAll)throw new Error("Either specify variables to return using `outputVariables` or use `returnAll` param. Cannot apply both conditions at the same time.");this.returnAll=e.returnAll??!1,this._validateChains()}_validateChains(){var e;if(0===this.chains.length)throw new Error("Sequential chain must have at least one chain.");const a=(null==(e=this.memory)?void 0:e.memoryKeys)??[],r=new Set(this.inputKeys),s=new Set(a),o=t(r,s);if(o.size>0)throw new Error(`The following keys: ${n(o)} are overlapping between memory and input keys of the chain variables. This can lead to unexpected behaviour. Please use input and memory keys that don't overlap.`);const u=function(e,t){const i=new Set(e);for(const n of t)i.add(n);return i}(r,s);for(const l of this.chains){let e=i(new Set(l.inputKeys),u);if(l.memory&&(e=i(e,new Set(l.memory.memoryKeys))),e.size>0)throw new Error(`Missing variables for chain "${l._chainType()}": ${n(e)}. Only got the following variables: ${n(u)}.`);const a=new Set(l.outputKeys),r=t(u,a);if(r.size>0)throw new Error(`The following output variables for chain "${l._chainType()}" are overlapping: ${n(r)}. This can lead to unexpected behaviour.`);for(const t of a)u.add(t)}if(0===this.outputVariables.length)if(this.returnAll){const e=i(u,r);this.outputVariables=Array.from(e)}else this.outputVariables=this.chains[this.chains.length-1].outputKeys;else{const e=i(new Set(this.outputVariables),new Set(u));if(e.size>0)throw new Error(`The following output variables were expected to be in the final chain output but were not found: ${n(e)}.`)}}async _call(e,t){let i={};const n=e;let a=0;for(const s of this.chains){a+=1,i=await s.call(n,null==t?void 0:t.getChild(`step_${a}`));for(const e of Object.keys(i))n[e]=i[e]}const r={};for(const s of this.outputVariables)r[s]=n[s];return r}_chainType(){return"sequential_chain"}static async deserialize(t){const i=[],n=t.input_variables,r=t.output_variables,s=t.chains;for(const a of s){const t=await e.BaseChain.deserialize(a);i.push(t)}return new a({chains:i,inputVariables:n,outputVariables:r})}serialize(){const e=[];for(const t of this.chains)e.push(t.serialize());return{_type:this._chainType(),input_variables:this.inputVariables,output_variables:this.outputVariables,chains:e}}}class r extends e.BaseChain{static lc_name(){return"SimpleSequentialChain"}get inputKeys(){return[this.inputKey]}get outputKeys(){return[this.outputKey]}constructor(e){super(e),Object.defineProperty(this,"chains",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"inputKey",{enumerable:!0,configurable:!0,writable:!0,value:"input"}),Object.defineProperty(this,"outputKey",{enumerable:!0,configurable:!0,writable:!0,value:"output"}),Object.defineProperty(this,"trimOutputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.chains=e.chains,this.trimOutputs=e.trimOutputs??!1,this._validateChains()}_validateChains(){for(const e of this.chains){if(1!==e.inputKeys.filter(t=>{var i;return!(null==(i=e.memory)?void 0:i.memoryKeys.includes(t))}).length)throw new Error(`Chains used in SimpleSequentialChain should all have one input, got ${e.inputKeys.length} for ${e._chainType()}.`);if(1!==e.outputKeys.length)throw new Error(`Chains used in SimpleSequentialChain should all have one output, got ${e.outputKeys.length} for ${e._chainType()}.`)}}async _call(e,t){let i=e[this.inputKey],n=0;for(const a of this.chains)n+=1,i=(await a.call({[a.inputKeys[0]]:i,signal:e.signal},null==t?void 0:t.getChild(`step_${n}`)))[a.outputKeys[0]],this.trimOutputs&&(i=i.trim()),await(null==t?void 0:t.handleText(i));return{[this.outputKey]:i}}_chainType(){return"simple_sequential_chain"}static async deserialize(t){const i=[],n=t.chains;for(const a of n){const t=await e.BaseChain.deserialize(a);i.push(t)}return new r({chains:i})}serialize(){const e=[];for(const t of this.chains)e.push(t.serialize());return{_type:this._chainType(),chains:e}}}exports.SequentialChain=a,exports.SimpleSequentialChain=r;
|
package/dist/tauri.svg
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
<svg width="206" height="231" viewBox="0 0 206 231" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path d="M143.143 84C143.143 96.1503 133.293 106 121.143 106C108.992 106 99.1426 96.1503 99.1426 84C99.1426 71.8497 108.992 62 121.143 62C133.293 62 143.143 71.8497 143.143 84Z" fill="#FFC131"/>
|
|
3
|
-
<ellipse cx="84.1426" cy="147" rx="22" ry="22" transform="rotate(180 84.1426 147)" fill="#24C8DB"/>
|
|
4
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M166.738 154.548C157.86 160.286 148.023 164.269 137.757 166.341C139.858 160.282 141 153.774 141 147C141 144.543 140.85 142.121 140.558 139.743C144.975 138.204 149.215 136.139 153.183 133.575C162.73 127.404 170.292 118.608 174.961 108.244C179.63 97.8797 181.207 86.3876 179.502 75.1487C177.798 63.9098 172.884 53.4021 165.352 44.8883C157.82 36.3744 147.99 30.2165 137.042 27.1546C126.095 24.0926 114.496 24.2568 103.64 27.6274C92.7839 30.998 83.1319 37.4317 75.8437 46.1553C74.9102 47.2727 74.0206 48.4216 73.176 49.5993C61.9292 50.8488 51.0363 54.0318 40.9629 58.9556C44.2417 48.4586 49.5653 38.6591 56.679 30.1442C67.0505 17.7298 80.7861 8.57426 96.2354 3.77762C111.685 -1.01901 128.19 -1.25267 143.769 3.10474C159.348 7.46215 173.337 16.2252 184.056 28.3411C194.775 40.457 201.767 55.4101 204.193 71.404C206.619 87.3978 204.374 103.752 197.73 118.501C191.086 133.25 180.324 145.767 166.738 154.548ZM41.9631 74.275L62.5557 76.8042C63.0459 72.813 63.9401 68.9018 65.2138 65.1274C57.0465 67.0016 49.2088 70.087 41.9631 74.275Z" fill="#FFC131"/>
|
|
5
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M38.4045 76.4519C47.3493 70.6709 57.2677 66.6712 67.6171 64.6132C65.2774 70.9669 64 77.8343 64 85.0001C64 87.1434 64.1143 89.26 64.3371 91.3442C60.0093 92.8732 55.8533 94.9092 51.9599 97.4256C42.4128 103.596 34.8505 112.392 30.1816 122.756C25.5126 133.12 23.9357 144.612 25.6403 155.851C27.3449 167.09 32.2584 177.598 39.7906 186.112C47.3227 194.626 57.153 200.784 68.1003 203.846C79.0476 206.907 90.6462 206.743 101.502 203.373C112.359 200.002 122.011 193.568 129.299 184.845C130.237 183.722 131.131 182.567 131.979 181.383C143.235 180.114 154.132 176.91 164.205 171.962C160.929 182.49 155.596 192.319 148.464 200.856C138.092 213.27 124.357 222.426 108.907 227.222C93.458 232.019 76.9524 232.253 61.3736 227.895C45.7948 223.538 31.8055 214.775 21.0867 202.659C10.3679 190.543 3.37557 175.59 0.949823 159.596C-1.47592 143.602 0.768139 127.248 7.41237 112.499C14.0566 97.7497 24.8183 85.2327 38.4045 76.4519ZM163.062 156.711L163.062 156.711C162.954 156.773 162.846 156.835 162.738 156.897C162.846 156.835 162.954 156.773 163.062 156.711Z" fill="#24C8DB"/>
|
|
6
|
-
</svg>
|
|
1
|
+
<svg width="206" height="231" viewBox="0 0 206 231" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M143.143 84C143.143 96.1503 133.293 106 121.143 106C108.992 106 99.1426 96.1503 99.1426 84C99.1426 71.8497 108.992 62 121.143 62C133.293 62 143.143 71.8497 143.143 84Z" fill="#FFC131"/>
|
|
3
|
+
<ellipse cx="84.1426" cy="147" rx="22" ry="22" transform="rotate(180 84.1426 147)" fill="#24C8DB"/>
|
|
4
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M166.738 154.548C157.86 160.286 148.023 164.269 137.757 166.341C139.858 160.282 141 153.774 141 147C141 144.543 140.85 142.121 140.558 139.743C144.975 138.204 149.215 136.139 153.183 133.575C162.73 127.404 170.292 118.608 174.961 108.244C179.63 97.8797 181.207 86.3876 179.502 75.1487C177.798 63.9098 172.884 53.4021 165.352 44.8883C157.82 36.3744 147.99 30.2165 137.042 27.1546C126.095 24.0926 114.496 24.2568 103.64 27.6274C92.7839 30.998 83.1319 37.4317 75.8437 46.1553C74.9102 47.2727 74.0206 48.4216 73.176 49.5993C61.9292 50.8488 51.0363 54.0318 40.9629 58.9556C44.2417 48.4586 49.5653 38.6591 56.679 30.1442C67.0505 17.7298 80.7861 8.57426 96.2354 3.77762C111.685 -1.01901 128.19 -1.25267 143.769 3.10474C159.348 7.46215 173.337 16.2252 184.056 28.3411C194.775 40.457 201.767 55.4101 204.193 71.404C206.619 87.3978 204.374 103.752 197.73 118.501C191.086 133.25 180.324 145.767 166.738 154.548ZM41.9631 74.275L62.5557 76.8042C63.0459 72.813 63.9401 68.9018 65.2138 65.1274C57.0465 67.0016 49.2088 70.087 41.9631 74.275Z" fill="#FFC131"/>
|
|
5
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M38.4045 76.4519C47.3493 70.6709 57.2677 66.6712 67.6171 64.6132C65.2774 70.9669 64 77.8343 64 85.0001C64 87.1434 64.1143 89.26 64.3371 91.3442C60.0093 92.8732 55.8533 94.9092 51.9599 97.4256C42.4128 103.596 34.8505 112.392 30.1816 122.756C25.5126 133.12 23.9357 144.612 25.6403 155.851C27.3449 167.09 32.2584 177.598 39.7906 186.112C47.3227 194.626 57.153 200.784 68.1003 203.846C79.0476 206.907 90.6462 206.743 101.502 203.373C112.359 200.002 122.011 193.568 129.299 184.845C130.237 183.722 131.131 182.567 131.979 181.383C143.235 180.114 154.132 176.91 164.205 171.962C160.929 182.49 155.596 192.319 148.464 200.856C138.092 213.27 124.357 222.426 108.907 227.222C93.458 232.019 76.9524 232.253 61.3736 227.895C45.7948 223.538 31.8055 214.775 21.0867 202.659C10.3679 190.543 3.37557 175.59 0.949823 159.596C-1.47592 143.602 0.768139 127.248 7.41237 112.499C14.0566 97.7497 24.8183 85.2327 38.4045 76.4519ZM163.062 156.711L163.062 156.711C162.954 156.773 162.846 156.835 162.738 156.897C162.846 156.835 162.954 156.773 163.062 156.711Z" fill="#24C8DB"/>
|
|
6
|
+
</svg>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { P as PromptTemplate, C as ChatPromptTemplate, m as SystemMessagePromptTemplate, H as HumanMessagePromptTemplate, i as BaseChain } from "./index-
|
|
2
|
-
import { LLMChain } from "./llm_chain-
|
|
3
|
-
import { StuffDocumentsChain } from "./combine_docs_chain-
|
|
1
|
+
import { P as PromptTemplate, C as ChatPromptTemplate, m as SystemMessagePromptTemplate, H as HumanMessagePromptTemplate, i as BaseChain } from "./index-Bpr1h_Sb.js";
|
|
2
|
+
import { LLMChain } from "./llm_chain-2sbPhu7X.js";
|
|
3
|
+
import { StuffDocumentsChain } from "./combine_docs_chain-CDmPC9j3.js";
|
|
4
4
|
import "zod";
|
|
5
5
|
class BasePromptSelector {
|
|
6
6
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-D7oNp3Pm.cjs"),t=require("./llm_chain-DmZ1DWv0.cjs"),n=require("./combine_docs_chain-CbIBHz_O.cjs");require("zod");class o{async getPromptAsync(e,t){return this.getPrompt(e).partial((null==t?void 0:t.partialVariables)??{})}}class r extends o{constructor(e,t=[]){super(),Object.defineProperty(this,"defaultPrompt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"conditionals",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.defaultPrompt=e,this.conditionals=t}getPrompt(e){for(const[t,n]of this.conditionals)if(t(e))return n;return this.defaultPrompt}}const i=new e.PromptTemplate({template:"Use the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer.\n\n{context}\n\nQuestion: {question}\nHelpful Answer:",inputVariables:["context","question"]}),s=[e.SystemMessagePromptTemplate.fromTemplate("Use the following pieces of context to answer the users question. \nIf you don't know the answer, just say that you don't know, don't try to make up an answer.\n----------------\n{context}"),e.HumanMessagePromptTemplate.fromTemplate("{question}")],a=new r(i,[[function(e){return"base_chat_model"===e._modelType()},e.ChatPromptTemplate.fromMessages(s)]]);class c extends e.BaseChain{static lc_name(){return"VectorDBQAChain"}get inputKeys(){return[this.inputKey]}get outputKeys(){return this.combineDocumentsChain.outputKeys.concat(this.returnSourceDocuments?["sourceDocuments"]:[])}constructor(e){super(e),Object.defineProperty(this,"k",{enumerable:!0,configurable:!0,writable:!0,value:4}),Object.defineProperty(this,"inputKey",{enumerable:!0,configurable:!0,writable:!0,value:"query"}),Object.defineProperty(this,"vectorstore",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"combineDocumentsChain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"returnSourceDocuments",{enumerable:!0,configurable:!0,writable:!0,value:!1}),this.vectorstore=e.vectorstore,this.combineDocumentsChain=e.combineDocumentsChain,this.inputKey=e.inputKey??this.inputKey,this.k=e.k??this.k,this.returnSourceDocuments=e.returnSourceDocuments??this.returnSourceDocuments}async _call(e,t){if(!(this.inputKey in e))throw new Error(`Question key ${this.inputKey} not found.`);const n=e[this.inputKey],o=await this.vectorstore.similaritySearch(n,this.k,e.filter,null==t?void 0:t.getChild("vectorstore")),r={question:n,input_documents:o},i=await this.combineDocumentsChain.call(r,null==t?void 0:t.getChild("combine_documents"));return this.returnSourceDocuments?{...i,sourceDocuments:o}:i}_chainType(){return"vector_db_qa"}static async deserialize(t,n){if(!("vectorstore"in n))throw new Error("Need to pass in a vectorstore to deserialize VectorDBQAChain");const{vectorstore:o}=n;if(!t.combine_documents_chain)throw new Error("VectorDBQAChain must have combine_documents_chain in serialized data");return new c({combineDocumentsChain:await e.BaseChain.deserialize(t.combine_documents_chain),k:t.k,vectorstore:o})}serialize(){return{_type:this._chainType(),combine_documents_chain:this.combineDocumentsChain.serialize(),k:this.k}}static fromLLM(e,o,r){const i=function(e,o={}){const{prompt:r=a.getPrompt(e),verbose:i}=o,s=new t.LLMChain({prompt:r,llm:e,verbose:i});return new n.StuffDocumentsChain({llmChain:s,verbose:i})}(e);return new this({vectorstore:o,combineDocumentsChain:i,...r})}}exports.VectorDBQAChain=c;
|
package/package.json
CHANGED
|
@@ -1,135 +1,135 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "rhua-chatgpt-web",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "一个基于React和Semi Design的ChatGPT Web界面组件库",
|
|
5
|
-
"main": "dist/index.cjs.js",
|
|
6
|
-
"module": "dist/index.esm.js",
|
|
7
|
-
"types": "dist/index.d.ts",
|
|
8
|
-
"files": [
|
|
9
|
-
"dist",
|
|
10
|
-
"README.md",
|
|
11
|
-
"LICENSE"
|
|
12
|
-
],
|
|
13
|
-
"exports": {
|
|
14
|
-
".": {
|
|
15
|
-
"import": "./dist/index.esm.js",
|
|
16
|
-
"require": "./dist/index.cjs.js",
|
|
17
|
-
"types": "./dist/index.d.ts"
|
|
18
|
-
},
|
|
19
|
-
"./styles": "./dist/style.css"
|
|
20
|
-
},
|
|
21
|
-
"type": "module",
|
|
22
|
-
"scripts": {
|
|
23
|
-
"dev": "vite",
|
|
24
|
-
"build": "vite build && tsc --emitDeclarationOnly --outDir dist",
|
|
25
|
-
"build:lib": "vite build --mode library",
|
|
26
|
-
"preview": "vite preview",
|
|
27
|
-
"tauri": "tauri",
|
|
28
|
-
"prepublishOnly": "npm run build:lib"
|
|
29
|
-
},
|
|
30
|
-
"dependencies": {
|
|
31
|
-
"@amap/amap-jsapi-loader": "^1.0.1",
|
|
32
|
-
"@douyinfe/semi-icons": "^2.59.0",
|
|
33
|
-
"@douyinfe/semi-icons-lab": "^2.59.0",
|
|
34
|
-
"@douyinfe/semi-illustrations": "^2.59.0",
|
|
35
|
-
"@douyinfe/semi-ui": "^2.59.0",
|
|
36
|
-
"@langchain/community": "^0.2.2",
|
|
37
|
-
"@langchain/core": "^0.2.0",
|
|
38
|
-
"@langchain/openai": "^0.0.33",
|
|
39
|
-
"@semi-bot/semi-theme-xiangshuishidai": "^1.0.0",
|
|
40
|
-
"ai": "^3.1.14",
|
|
41
|
-
"ai-portal-blocknote-editor": "0.0.26",
|
|
42
|
-
"docx": "^9.5.1",
|
|
43
|
-
"highlight.js": "^11.9.0",
|
|
44
|
-
"html-to-image": "^1.11.11",
|
|
45
|
-
"katex": "^0.16.10",
|
|
46
|
-
"langchain": "^0.2.2",
|
|
47
|
-
"localforage": "^1.10.0",
|
|
48
|
-
"mermaid": "^10.9.1",
|
|
49
|
-
"react-amap": "^1.2.8",
|
|
50
|
-
"react-markdown": "^9.0.1",
|
|
51
|
-
"rehype-highlight": "^7.0.0",
|
|
52
|
-
"rehype-katex": "^7.0.0",
|
|
53
|
-
"remark-breaks": "^4.0.0",
|
|
54
|
-
"remark-gfm": "^4.0.0",
|
|
55
|
-
"remark-math": "^6.0.0",
|
|
56
|
-
"styled-components": "^6.1.11",
|
|
57
|
-
"vue": "^3.4.0",
|
|
58
|
-
"zod": "^3.23.8"
|
|
59
|
-
},
|
|
60
|
-
"peerDependencies": {
|
|
61
|
-
"@douyinfe/semi-icons": "^2.59.0",
|
|
62
|
-
"@douyinfe/semi-icons-lab": "^2.59.0",
|
|
63
|
-
"@douyinfe/semi-illustrations": "^2.59.0",
|
|
64
|
-
"@douyinfe/semi-ui": "^2.59.0",
|
|
65
|
-
"@semi-bot/semi-theme-xiangshuishidai": "^1.0.0",
|
|
66
|
-
"highlight.js": "^11.9.0",
|
|
67
|
-
"katex": "^0.16.10",
|
|
68
|
-
"localforage": "^1.10.0",
|
|
69
|
-
"mermaid": "^10.9.1",
|
|
70
|
-
"react": ">=18.0.0",
|
|
71
|
-
"react-dom": ">=18.0.0",
|
|
72
|
-
"react-router-dom": ">=6.0.0",
|
|
73
|
-
"styled-components": "^6.1.11"
|
|
74
|
-
},
|
|
75
|
-
"peerDependenciesMeta": {
|
|
76
|
-
"react": {
|
|
77
|
-
"optional": false
|
|
78
|
-
},
|
|
79
|
-
"react-dom": {
|
|
80
|
-
"optional": false
|
|
81
|
-
},
|
|
82
|
-
"react-router-dom": {
|
|
83
|
-
"optional": true
|
|
84
|
-
},
|
|
85
|
-
"@douyinfe/semi-ui": {
|
|
86
|
-
"optional": false
|
|
87
|
-
},
|
|
88
|
-
"@douyinfe/semi-icons": {
|
|
89
|
-
"optional": false
|
|
90
|
-
},
|
|
91
|
-
"@douyinfe/semi-icons-lab": {
|
|
92
|
-
"optional": false
|
|
93
|
-
},
|
|
94
|
-
"@douyinfe/semi-illustrations": {
|
|
95
|
-
"optional": false
|
|
96
|
-
},
|
|
97
|
-
"@semi-bot/semi-theme-xiangshuishidai": {
|
|
98
|
-
"optional": false
|
|
99
|
-
},
|
|
100
|
-
"mermaid": {
|
|
101
|
-
"optional": true
|
|
102
|
-
},
|
|
103
|
-
"katex": {
|
|
104
|
-
"optional": true
|
|
105
|
-
},
|
|
106
|
-
"highlight.js": {
|
|
107
|
-
"optional": true
|
|
108
|
-
},
|
|
109
|
-
"localforage": {
|
|
110
|
-
"optional": true
|
|
111
|
-
},
|
|
112
|
-
"styled-components": {
|
|
113
|
-
"optional": true
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
"devDependencies": {
|
|
117
|
-
"@tauri-apps/api": "^1.5.6",
|
|
118
|
-
"@tauri-apps/cli": "^1.5.14",
|
|
119
|
-
"@types/react": "^18.3.3",
|
|
120
|
-
"@types/react-dom": "^18.3.0",
|
|
121
|
-
"@vitejs/plugin-react": "^4.3.0",
|
|
122
|
-
"react": "^18.3.1",
|
|
123
|
-
"react-dom": "^18.3.1",
|
|
124
|
-
"react-router-dom": "^6.23.1",
|
|
125
|
-
"sass": "^1.77.2",
|
|
126
|
-
"terser": "^5.31.0",
|
|
127
|
-
"typescript": "^5.4.5",
|
|
128
|
-
"vite": "^5.2.11"
|
|
129
|
-
},
|
|
130
|
-
"pnpm": {
|
|
131
|
-
"overrides": {
|
|
132
|
-
"@langchain/core": "^0.2.0"
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "rhua-chatgpt-web",
|
|
3
|
+
"version": "1.0.95",
|
|
4
|
+
"description": "一个基于React和Semi Design的ChatGPT Web界面组件库",
|
|
5
|
+
"main": "dist/index.cjs.js",
|
|
6
|
+
"module": "dist/index.esm.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"README.md",
|
|
11
|
+
"LICENSE"
|
|
12
|
+
],
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"import": "./dist/index.esm.js",
|
|
16
|
+
"require": "./dist/index.cjs.js",
|
|
17
|
+
"types": "./dist/index.d.ts"
|
|
18
|
+
},
|
|
19
|
+
"./styles": "./dist/style.css"
|
|
20
|
+
},
|
|
21
|
+
"type": "module",
|
|
22
|
+
"scripts": {
|
|
23
|
+
"dev": "vite",
|
|
24
|
+
"build": "vite build && tsc --emitDeclarationOnly --outDir dist",
|
|
25
|
+
"build:lib": "vite build --mode library",
|
|
26
|
+
"preview": "vite preview",
|
|
27
|
+
"tauri": "tauri",
|
|
28
|
+
"prepublishOnly": "npm run build:lib"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@amap/amap-jsapi-loader": "^1.0.1",
|
|
32
|
+
"@douyinfe/semi-icons": "^2.59.0",
|
|
33
|
+
"@douyinfe/semi-icons-lab": "^2.59.0",
|
|
34
|
+
"@douyinfe/semi-illustrations": "^2.59.0",
|
|
35
|
+
"@douyinfe/semi-ui": "^2.59.0",
|
|
36
|
+
"@langchain/community": "^0.2.2",
|
|
37
|
+
"@langchain/core": "^0.2.0",
|
|
38
|
+
"@langchain/openai": "^0.0.33",
|
|
39
|
+
"@semi-bot/semi-theme-xiangshuishidai": "^1.0.0",
|
|
40
|
+
"ai": "^3.1.14",
|
|
41
|
+
"ai-portal-blocknote-editor": "0.0.26",
|
|
42
|
+
"docx": "^9.5.1",
|
|
43
|
+
"highlight.js": "^11.9.0",
|
|
44
|
+
"html-to-image": "^1.11.11",
|
|
45
|
+
"katex": "^0.16.10",
|
|
46
|
+
"langchain": "^0.2.2",
|
|
47
|
+
"localforage": "^1.10.0",
|
|
48
|
+
"mermaid": "^10.9.1",
|
|
49
|
+
"react-amap": "^1.2.8",
|
|
50
|
+
"react-markdown": "^9.0.1",
|
|
51
|
+
"rehype-highlight": "^7.0.0",
|
|
52
|
+
"rehype-katex": "^7.0.0",
|
|
53
|
+
"remark-breaks": "^4.0.0",
|
|
54
|
+
"remark-gfm": "^4.0.0",
|
|
55
|
+
"remark-math": "^6.0.0",
|
|
56
|
+
"styled-components": "^6.1.11",
|
|
57
|
+
"vue": "^3.4.0",
|
|
58
|
+
"zod": "^3.23.8"
|
|
59
|
+
},
|
|
60
|
+
"peerDependencies": {
|
|
61
|
+
"@douyinfe/semi-icons": "^2.59.0",
|
|
62
|
+
"@douyinfe/semi-icons-lab": "^2.59.0",
|
|
63
|
+
"@douyinfe/semi-illustrations": "^2.59.0",
|
|
64
|
+
"@douyinfe/semi-ui": "^2.59.0",
|
|
65
|
+
"@semi-bot/semi-theme-xiangshuishidai": "^1.0.0",
|
|
66
|
+
"highlight.js": "^11.9.0",
|
|
67
|
+
"katex": "^0.16.10",
|
|
68
|
+
"localforage": "^1.10.0",
|
|
69
|
+
"mermaid": "^10.9.1",
|
|
70
|
+
"react": ">=18.0.0",
|
|
71
|
+
"react-dom": ">=18.0.0",
|
|
72
|
+
"react-router-dom": ">=6.0.0",
|
|
73
|
+
"styled-components": "^6.1.11"
|
|
74
|
+
},
|
|
75
|
+
"peerDependenciesMeta": {
|
|
76
|
+
"react": {
|
|
77
|
+
"optional": false
|
|
78
|
+
},
|
|
79
|
+
"react-dom": {
|
|
80
|
+
"optional": false
|
|
81
|
+
},
|
|
82
|
+
"react-router-dom": {
|
|
83
|
+
"optional": true
|
|
84
|
+
},
|
|
85
|
+
"@douyinfe/semi-ui": {
|
|
86
|
+
"optional": false
|
|
87
|
+
},
|
|
88
|
+
"@douyinfe/semi-icons": {
|
|
89
|
+
"optional": false
|
|
90
|
+
},
|
|
91
|
+
"@douyinfe/semi-icons-lab": {
|
|
92
|
+
"optional": false
|
|
93
|
+
},
|
|
94
|
+
"@douyinfe/semi-illustrations": {
|
|
95
|
+
"optional": false
|
|
96
|
+
},
|
|
97
|
+
"@semi-bot/semi-theme-xiangshuishidai": {
|
|
98
|
+
"optional": false
|
|
99
|
+
},
|
|
100
|
+
"mermaid": {
|
|
101
|
+
"optional": true
|
|
102
|
+
},
|
|
103
|
+
"katex": {
|
|
104
|
+
"optional": true
|
|
105
|
+
},
|
|
106
|
+
"highlight.js": {
|
|
107
|
+
"optional": true
|
|
108
|
+
},
|
|
109
|
+
"localforage": {
|
|
110
|
+
"optional": true
|
|
111
|
+
},
|
|
112
|
+
"styled-components": {
|
|
113
|
+
"optional": true
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
"devDependencies": {
|
|
117
|
+
"@tauri-apps/api": "^1.5.6",
|
|
118
|
+
"@tauri-apps/cli": "^1.5.14",
|
|
119
|
+
"@types/react": "^18.3.3",
|
|
120
|
+
"@types/react-dom": "^18.3.0",
|
|
121
|
+
"@vitejs/plugin-react": "^4.3.0",
|
|
122
|
+
"react": "^18.3.1",
|
|
123
|
+
"react-dom": "^18.3.1",
|
|
124
|
+
"react-router-dom": "^6.23.1",
|
|
125
|
+
"sass": "^1.77.2",
|
|
126
|
+
"terser": "^5.31.0",
|
|
127
|
+
"typescript": "^5.4.5",
|
|
128
|
+
"vite": "^5.2.11"
|
|
129
|
+
},
|
|
130
|
+
"pnpm": {
|
|
131
|
+
"overrides": {
|
|
132
|
+
"@langchain/core": "^0.2.0"
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
package/dist/index-7PhG3Bul.js
DELETED
package/dist/index-BLKrtdG3.js
DELETED
package/dist/index-BeyeAUBa.js
DELETED
package/dist/index-DdHqkr9E.js
DELETED