feat: add pdf browser plugin

This commit is contained in:
Hk-Gosuto
2023-11-23 13:32:16 +08:00
parent 787d65fc51
commit a8e19a81ff
5 changed files with 734 additions and 62 deletions

View File

@@ -23,6 +23,7 @@ import { BaiduSearch } from "@/app/api/langchain-tools/baidu_search";
import { GoogleSearch } from "@/app/api/langchain-tools/google_search";
import { StableDiffusionWrapper } from "@/app/api/langchain-tools/stable_diffusion_image_generator";
import { ArxivAPIWrapper } from "@/app/api/langchain-tools/arxiv";
import { PDFBrowser } from "@/app/api/langchain-tools/pdf_browser";
const serverConfig = getServerSideConfig();
@@ -254,6 +255,9 @@ async function handle(req: NextRequest) {
tools.push(stableDiffusionTool);
if (useTools.includes(arxivAPITool.name)) tools.push(arxivAPITool);
const pdfBrowserTool = new PDFBrowser(model, embeddings);
tools.push(pdfBrowserTool);
useTools.forEach((toolName) => {
if (toolName) {
var tool = langchainTools[