rhua-chatgpt-web 1.1.6 → 1.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dist/{api_chain-CKT4Ohw8.js → api_chain-8rLd0TuD.js} +2 -2
  2. package/dist/{api_chain-N6cO3Z7A.cjs → api_chain-DBmoQA_7.cjs} +1 -1
  3. package/dist/{combine_docs_chain--Y7d6aSy.js → combine_docs_chain-BH4-g2GW.js} +2 -2
  4. package/dist/{combine_docs_chain-BNJxb0Gs.cjs → combine_docs_chain-DfTwsFo0.cjs} +1 -1
  5. package/dist/{few_shot-ChC8aH8b.js → few_shot-DJCpSBvt.js} +1 -1
  6. package/dist/{few_shot-CDBqI2Ys.cjs → few_shot-DQaRrbJw.cjs} +1 -1
  7. package/dist/{index-u8vlzCLe.js → index-BAXNGSXw.js} +1 -1
  8. package/dist/{index-0kEbYI8E.js → index-BDxCvrgc.js} +1 -1
  9. package/dist/{index-BL6aXvwq.cjs → index-BQO11CzB.cjs} +1 -1
  10. package/dist/index-B_x2i-jO.js +4 -0
  11. package/dist/{index-zAP0Ll9a.js → index-BaQU1IvP.js} +229 -17
  12. package/dist/index-C8LQxWL1.js +4 -0
  13. package/dist/{index-zo6xsYrJ.js → index-CD6GBfkZ.js} +1 -1
  14. package/dist/{index-B78sVP5R.cjs → index-CFln1NC2.cjs} +1 -1
  15. package/dist/{index-CosWt-S3.cjs → index-CUnp2vsA.cjs} +1 -1
  16. package/dist/{index-DjJb_SAb.js → index-CXpHNR4F.js} +1 -1
  17. package/dist/index-CYDd-qnF.js +4 -0
  18. package/dist/{index-BoVswZfB.cjs → index-CvCPvUjj.cjs} +1 -1
  19. package/dist/{index-vZBjPhbn.cjs → index-DFYcGKuT.cjs} +11 -11
  20. package/dist/index-DH4SzrZB.js +4 -0
  21. package/dist/{index-By0Xo-m7.cjs → index-DRg4CNkS.cjs} +1 -1
  22. package/dist/{index-Bd66L2W0.js → index-Dy-SzFud.js} +2 -2
  23. package/dist/{index-CFuOi4iF.cjs → index-FAGD8ZFV.cjs} +1 -1
  24. package/dist/{index-DkxD2k9x.js → index-GSRYlXZ2.js} +1 -1
  25. package/dist/{index-Cfepbmtj.cjs → index-PQbFNXZe.cjs} +1 -1
  26. package/dist/{index-B8ZRW_yr.cjs → index-VviEQjAE.cjs} +1 -1
  27. package/dist/{index-DyXL0CeE.js → index-Wbrx5M_5.js} +2 -2
  28. package/dist/{index-CIYMf0qL.cjs → index-faFDPW0m.cjs} +1 -1
  29. package/dist/{index-BllBfWMm.cjs → index-jiGOdiuu.cjs} +1 -1
  30. package/dist/{index-BLUkF_Fj.cjs → index-xDEsnKsG.cjs} +1 -1
  31. package/dist/index.cjs.js +1 -1
  32. package/dist/{index.es-B2TKMjj8.cjs → index.es-DUhQYmQQ.cjs} +3 -3
  33. package/dist/{index.es-mYp333HK.js → index.es-Ofj7pWXh.js} +60 -59
  34. package/dist/index.esm.js +6 -5
  35. package/dist/{llm_chain-EOU4-N68.js → llm_chain-D_TCnPCU.js} +1 -1
  36. package/dist/{llm_chain-Ccdciq6f.cjs → llm_chain-uxhdn-1W.cjs} +1 -1
  37. package/dist/{sequential_chain-YncpdH_1.js → sequential_chain-BIzQ7CWb.js} +1 -1
  38. package/dist/{sequential_chain-B7gSmAiJ.cjs → sequential_chain-CMYssdOR.cjs} +1 -1
  39. package/dist/style.css +1 -1
  40. package/dist/{vector_db_qa-CldcVkud.cjs → vector_db_qa-Bf6oOghB.cjs} +1 -1
  41. package/dist/{vector_db_qa-nw6U0HI5.js → vector_db_qa-DnXdDGBx.js} +3 -3
  42. package/package.json +135 -135
  43. package/dist/index-CB3iLddF.js +0 -4
  44. package/dist/index-CDalpP5C.js +0 -4
  45. package/dist/index-CEh-kRgr.js +0 -4
  46. package/dist/index-Dz9H6mEL.js +0 -4
@@ -1 +1 @@
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
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DFYcGKuT.cjs"),t=require("./llm_chain-uxhdn-1W.cjs"),n=require("./combine_docs_chain-DfTwsFo0.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-zAP0Ll9a.js";
2
- import { LLMChain } from "./llm_chain-EOU4-N68.js";
3
- import { StuffDocumentsChain } from "./combine_docs_chain--Y7d6aSy.js";
1
+ import { P as PromptTemplate, C as ChatPromptTemplate, m as SystemMessagePromptTemplate, H as HumanMessagePromptTemplate, i as BaseChain } from "./index-BaQU1IvP.js";
2
+ import { LLMChain } from "./llm_chain-D_TCnPCU.js";
3
+ import { StuffDocumentsChain } from "./combine_docs_chain-BH4-g2GW.js";
4
4
  import "zod";
5
5
  class BasePromptSelector {
6
6
  /**
package/package.json CHANGED
@@ -1,135 +1,135 @@
1
- {
2
- "name": "rhua-chatgpt-web",
3
- "version": "1.1.6",
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.1.7",
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.27",
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,4 +0,0 @@
1
- import { r } from "./index-zAP0Ll9a.js";
2
- export {
3
- r as default
4
- };
@@ -1,4 +0,0 @@
1
- import { f } from "./index-zAP0Ll9a.js";
2
- export {
3
- f as fromDom
4
- };
@@ -1,4 +0,0 @@
1
- import { u } from "./index-zAP0Ll9a.js";
2
- export {
3
- u as unified
4
- };
@@ -1,4 +0,0 @@
1
- import { a } from "./index-zAP0Ll9a.js";
2
- export {
3
- a as default
4
- };