rhua-chatgpt-web 1.1.4 → 1.1.6
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/dist/{api_chain-BydBma6z.js → api_chain-CKT4Ohw8.js} +2 -2
- package/dist/{api_chain-c8nEwmot.cjs → api_chain-N6cO3Z7A.cjs} +1 -1
- package/dist/{combine_docs_chain-DTj2391W.js → combine_docs_chain--Y7d6aSy.js} +2 -2
- package/dist/{combine_docs_chain-CbyS610d.cjs → combine_docs_chain-BNJxb0Gs.cjs} +1 -1
- package/dist/{few_shot-CdebQ5kj.cjs → few_shot-CDBqI2Ys.cjs} +1 -1
- package/dist/{few_shot-Dr2a_vSB.js → few_shot-ChC8aH8b.js} +1 -1
- package/dist/{index-CNZL8JCz.js → index-0kEbYI8E.js} +1 -1
- package/dist/{index-BZmikH2I.cjs → index-B78sVP5R.cjs} +1 -1
- package/dist/{index-CGRli7Xu.cjs → index-B8ZRW_yr.cjs} +1 -1
- package/dist/{index-DyAjztcW.cjs → index-BL6aXvwq.cjs} +1 -1
- package/dist/{index-B-LdfVHm.cjs → index-BLUkF_Fj.cjs} +1 -1
- package/dist/{index-DQjTGvu_.js → index-Bd66L2W0.js} +2 -2
- package/dist/{index-DNLgDu9x.cjs → index-BllBfWMm.cjs} +1 -1
- package/dist/{index-DHhPWOkF.cjs → index-BoVswZfB.cjs} +1 -1
- package/dist/{index-BMmSvEQc.cjs → index-By0Xo-m7.cjs} +1 -1
- package/dist/index-CB3iLddF.js +4 -0
- package/dist/index-CDalpP5C.js +4 -0
- package/dist/index-CEh-kRgr.js +4 -0
- package/dist/{index-CjMiMSME.cjs → index-CFuOi4iF.cjs} +1 -1
- package/dist/{index-r0ADMCt-.cjs → index-CIYMf0qL.cjs} +1 -1
- package/dist/{index-DA-muWZ3.cjs → index-Cfepbmtj.cjs} +1 -1
- package/dist/{index-BRTuC1yI.cjs → index-CosWt-S3.cjs} +1 -1
- package/dist/{index-BFoU0ue3.js → index-DjJb_SAb.js} +1 -1
- package/dist/{index-BV4g85Qw.js → index-DkxD2k9x.js} +1 -1
- package/dist/{index-CoPJQXW-.js → index-DyXL0CeE.js} +2 -2
- package/dist/index-Dz9H6mEL.js +4 -0
- package/dist/{index-DyjQyNTp.js → index-u8vlzCLe.js} +1 -1
- package/dist/{index-DAECv62A.cjs → index-vZBjPhbn.cjs} +33 -33
- package/dist/{index-BiS-zzbc.js → index-zAP0Ll9a.js} +123 -28
- package/dist/{index-CUSKlnIA.js → index-zo6xsYrJ.js} +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/{index.es-DeBEHu3I.cjs → index.es-B2TKMjj8.cjs} +2 -2
- package/dist/{index.es-CfXmOPUR.js → index.es-mYp333HK.js} +11 -11
- package/dist/index.esm.js +1 -1
- package/dist/{llm_chain-CblGjh7C.cjs → llm_chain-Ccdciq6f.cjs} +1 -1
- package/dist/{llm_chain-btHQ9Ypf.js → llm_chain-EOU4-N68.js} +1 -1
- package/dist/{sequential_chain-4_njD1CF.cjs → sequential_chain-B7gSmAiJ.cjs} +1 -1
- package/dist/{sequential_chain-C4uMLvT0.js → sequential_chain-YncpdH_1.js} +1 -1
- package/dist/{vector_db_qa-CJs8ehg0.cjs → vector_db_qa-CldcVkud.cjs} +1 -1
- package/dist/{vector_db_qa-phOaenwb.js → vector_db_qa-nw6U0HI5.js} +3 -3
- package/package.json +1 -1
- package/dist/index-9U6WHC1B.js +0 -4
- package/dist/index-C4FNHxQj.js +0 -4
- package/dist/index-DP32XYQn.js +0 -4
- package/dist/index-DUe6eKSl.js +0 -4
|
@@ -3,7 +3,7 @@ import * as ReactDOM from "react-dom";
|
|
|
3
3
|
import ReactDOM__default, { flushSync, createPortal } from "react-dom";
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import React__default, { useLayoutEffect, useEffect, useRef, useContext, createRef, memo, createContext, createElement, version, forwardRef, useMemo, useState, useCallback, useImperativeHandle, useSyncExternalStore, Fragment as Fragment$1, useId as useId$2, cloneElement, Children } from "react";
|
|
6
|
-
import { Z as getDefaultExportFromCjs, _ as jsxRuntimeExports } from "./index-
|
|
6
|
+
import { Z as getDefaultExportFromCjs, _ as jsxRuntimeExports } from "./index-zAP0Ll9a.js";
|
|
7
7
|
function hasWindow() {
|
|
8
8
|
return typeof window !== "undefined";
|
|
9
9
|
}
|
|
@@ -39841,16 +39841,16 @@ async function et$2() {
|
|
|
39841
39841
|
if (fe$1)
|
|
39842
39842
|
return fe$1;
|
|
39843
39843
|
const e = await Promise.all([
|
|
39844
|
-
import("./index-
|
|
39845
|
-
import("./index-
|
|
39846
|
-
import("./index-
|
|
39847
|
-
import("./index-
|
|
39848
|
-
import("./index-
|
|
39849
|
-
import("./index-
|
|
39850
|
-
import("./index-
|
|
39851
|
-
import("./index-
|
|
39852
|
-
import("./index-
|
|
39853
|
-
import("./index-
|
|
39844
|
+
import("./index-u8vlzCLe.js"),
|
|
39845
|
+
import("./index-0kEbYI8E.js"),
|
|
39846
|
+
import("./index-CEh-kRgr.js"),
|
|
39847
|
+
import("./index-CDalpP5C.js"),
|
|
39848
|
+
import("./index-Bd66L2W0.js"),
|
|
39849
|
+
import("./index-CB3iLddF.js"),
|
|
39850
|
+
import("./index-zo6xsYrJ.js"),
|
|
39851
|
+
import("./index-Dz9H6mEL.js"),
|
|
39852
|
+
import("./index-DkxD2k9x.js"),
|
|
39853
|
+
import("./index-DyXL0CeE.js")
|
|
39854
39854
|
]);
|
|
39855
39855
|
return fe$1 = {
|
|
39856
39856
|
rehypeParse: e[0],
|
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-zAP0Ll9a.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 +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-vZBjPhbn.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,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-zAP0Ll9a.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-vZBjPhbn.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;
|
|
@@ -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-vZBjPhbn.cjs"),t=require("./llm_chain-Ccdciq6f.cjs"),n=require("./combine_docs_chain-BNJxb0Gs.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;
|
|
@@ -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-zAP0Ll9a.js";
|
|
2
|
+
import { LLMChain } from "./llm_chain-EOU4-N68.js";
|
|
3
|
+
import { StuffDocumentsChain } from "./combine_docs_chain--Y7d6aSy.js";
|
|
4
4
|
import "zod";
|
|
5
5
|
class BasePromptSelector {
|
|
6
6
|
/**
|
package/package.json
CHANGED
package/dist/index-9U6WHC1B.js
DELETED
package/dist/index-C4FNHxQj.js
DELETED
package/dist/index-DP32XYQn.js
DELETED
package/dist/index-DUe6eKSl.js
DELETED