mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-05-26 07:30:18 +09:00
chore: update pdf browser plugin
This commit is contained in:
parent
8691e95f12
commit
5e43a4ff2d
@ -11,6 +11,8 @@ import { CallbackManagerForToolRun } from "@langchain/core/callbacks/manager";
|
||||
import { BaseLanguageModel } from "langchain/dist/base_language";
|
||||
import { formatDocumentsAsString } from "langchain/util/document";
|
||||
import { Embeddings } from "langchain/dist/embeddings/base.js";
|
||||
import { RunnableSequence } from "@langchain/core/runnables";
|
||||
import { StringOutputParser } from "@langchain/core/output_parsers";
|
||||
|
||||
export const parseInputs = (inputs: string): [string, string] => {
|
||||
const [baseUrl, task] = inputs.split(",").map((input) => {
|
||||
@ -131,7 +133,10 @@ export class PDFBrowser extends Tool {
|
||||
doSummary ? "a summary" : task
|
||||
} from the above text.`;
|
||||
|
||||
return this.model.predict(input, undefined, runManager?.getChild());
|
||||
console.log("[pdf-browser]", input);
|
||||
|
||||
const chain = RunnableSequence.from([this.model, new StringOutputParser()]);
|
||||
return chain.invoke(input, runManager?.getChild());
|
||||
}
|
||||
|
||||
name = "pdf-browser";
|
||||
|
Loading…
Reference in New Issue
Block a user