mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-11-13 12:43:42 +08:00
feat: claude function call
This commit is contained in:
@@ -18,7 +18,7 @@ export class EdgeTool {
|
||||
|
||||
private model: BaseLanguageModel;
|
||||
|
||||
private embeddings: Embeddings;
|
||||
private embeddings: Embeddings | null;
|
||||
|
||||
private callback?: (data: string) => Promise<void>;
|
||||
|
||||
@@ -26,7 +26,7 @@ export class EdgeTool {
|
||||
apiKey: string | undefined,
|
||||
baseUrl: string,
|
||||
model: BaseLanguageModel,
|
||||
embeddings: Embeddings,
|
||||
embeddings: Embeddings | null,
|
||||
callback?: (data: string) => Promise<void>,
|
||||
) {
|
||||
this.apiKey = apiKey;
|
||||
@@ -37,10 +37,6 @@ export class EdgeTool {
|
||||
}
|
||||
|
||||
async getCustomTools(): Promise<any[]> {
|
||||
const webBrowserTool = new WebBrowser({
|
||||
model: this.model,
|
||||
embeddings: this.embeddings,
|
||||
});
|
||||
const calculatorTool = new Calculator();
|
||||
const dallEAPITool = new DallEAPIWrapper(
|
||||
this.apiKey,
|
||||
@@ -56,7 +52,7 @@ export class EdgeTool {
|
||||
const bilibiliMusicRecognitionTool = new BilibiliMusicRecognitionTool();
|
||||
let tools = [
|
||||
calculatorTool,
|
||||
webBrowserTool,
|
||||
// webBrowserTool,
|
||||
dallEAPITool,
|
||||
stableDiffusionTool,
|
||||
arxivAPITool,
|
||||
@@ -66,6 +62,13 @@ export class EdgeTool {
|
||||
bilibiliMusicRecognitionTool,
|
||||
bilibiliVideoConclusionTool,
|
||||
];
|
||||
if (this.embeddings != null) {
|
||||
const webBrowserTool = new WebBrowser({
|
||||
model: this.model,
|
||||
embeddings: this.embeddings,
|
||||
});
|
||||
tools.push(webBrowserTool);
|
||||
}
|
||||
return tools;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ export class NodeJSTool {
|
||||
private apiKey: string | undefined;
|
||||
private baseUrl: string;
|
||||
private model: BaseLanguageModel;
|
||||
private embeddings: Embeddings;
|
||||
private embeddings: Embeddings | null;
|
||||
private sessionId: string;
|
||||
private ragEmbeddings: Embeddings;
|
||||
private callback?: (data: string) => Promise<void>;
|
||||
@@ -26,7 +26,7 @@ export class NodeJSTool {
|
||||
apiKey: string | undefined,
|
||||
baseUrl: string,
|
||||
model: BaseLanguageModel,
|
||||
embeddings: Embeddings,
|
||||
embeddings: Embeddings | null,
|
||||
sessionId: string,
|
||||
ragEmbeddings: Embeddings,
|
||||
callback?: (data: string) => Promise<void>,
|
||||
@@ -41,10 +41,6 @@ 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,
|
||||
@@ -54,24 +50,32 @@ export class NodeJSTool {
|
||||
const stableDiffusionTool = new StableDiffusionNodeWrapper();
|
||||
const arxivAPITool = new ArxivAPIWrapper();
|
||||
const wolframAlphaTool = new WolframAlphaTool();
|
||||
const pdfBrowserTool = new PDFBrowser(this.model, this.embeddings);
|
||||
const bilibiliVideoInfoTool = new BilibiliVideoInfoTool();
|
||||
const bilibiliVideoSearchTool = new BilibiliVideoSearchTool();
|
||||
const bilibiliVideoConclusionTool = new BilibiliVideoConclusionTool();
|
||||
const bilibiliMusicRecognitionTool = new BilibiliMusicRecognitionTool();
|
||||
let tools: any = [
|
||||
// webBrowserTool,
|
||||
// pdfBrowserTool,
|
||||
calculatorTool,
|
||||
webBrowserTool,
|
||||
dallEAPITool,
|
||||
stableDiffusionTool,
|
||||
arxivAPITool,
|
||||
wolframAlphaTool,
|
||||
pdfBrowserTool,
|
||||
bilibiliVideoInfoTool,
|
||||
bilibiliVideoSearchTool,
|
||||
bilibiliMusicRecognitionTool,
|
||||
bilibiliVideoConclusionTool,
|
||||
];
|
||||
if (this.embeddings != null) {
|
||||
const webBrowserTool = new WebBrowser({
|
||||
model: this.model,
|
||||
embeddings: this.embeddings,
|
||||
});
|
||||
const pdfBrowserTool = new PDFBrowser(this.model, this.embeddings);
|
||||
tools.push(webBrowserTool);
|
||||
tools.push(pdfBrowserTool);
|
||||
}
|
||||
if (!!process.env.ENABLE_RAG) {
|
||||
tools.push(
|
||||
new MyFilesBrowser(this.sessionId, this.model, this.ragEmbeddings),
|
||||
|
||||
Reference in New Issue
Block a user