feat: support local storage

This commit is contained in:
Hk-Gosuto
2024-01-05 18:41:16 +08:00
parent 8e10354109
commit 296df592e0
18 changed files with 181 additions and 56 deletions

View File

@@ -1,7 +1,12 @@
import { BaseLanguageModel } from "langchain/dist/base_language";
import { PDFBrowser } from "@/app/api/langchain-tools/pdf_browser";
import { Embeddings } from "langchain/dist/embeddings/base.js";
import { ArxivAPIWrapper } from "@/app/api/langchain-tools/arxiv";
import { DallEAPINodeWrapper } from "@/app/api/langchain-tools/dalle_image_generator_node";
import { StableDiffusionNodeWrapper } from "@/app/api/langchain-tools/stable_diffusion_image_generator_node";
import { Calculator } from "langchain/tools/calculator";
import { WebBrowser } from "langchain/tools/webbrowser";
import { WolframAlphaTool } from "@/app/api/langchain-tools/wolframalpha";
export class NodeJSTool {
private apiKey: string | undefined;
@@ -29,7 +34,29 @@ export class NodeJSTool {
}
async getCustomTools(): Promise<any[]> {
const webBrowserTool = new WebBrowser({
model: this.model,
embeddings: this.embeddings,
});
const calculatorTool = new Calculator();
const dallEAPITool = new DallEAPINodeWrapper(
this.apiKey,
this.baseUrl,
this.callback,
);
const stableDiffusionTool = new StableDiffusionNodeWrapper();
const arxivAPITool = new ArxivAPIWrapper();
const wolframAlphaTool = new WolframAlphaTool();
const pdfBrowserTool = new PDFBrowser(this.model, this.embeddings);
return [pdfBrowserTool];
let tools = [
calculatorTool,
webBrowserTool,
dallEAPITool,
stableDiffusionTool,
arxivAPITool,
wolframAlphaTool,
pdfBrowserTool,
];
return tools;
}
}