add tools for plugins
This commit is contained in:
parent
02d8284f58
commit
a94d841bb7
|
|
@ -0,0 +1,43 @@
|
||||||
|
import { INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
|
|
||||||
|
class AIPlugin implements INode {
|
||||||
|
label: string
|
||||||
|
name: string
|
||||||
|
description: string
|
||||||
|
type: string
|
||||||
|
icon: string
|
||||||
|
category: string
|
||||||
|
baseClasses: string[]
|
||||||
|
inputs?: INodeParams[]
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.label = 'AI Plugin'
|
||||||
|
this.name = 'aiPlugin'
|
||||||
|
this.type = 'AIPlugin'
|
||||||
|
this.icon = 'aiplugin.svg'
|
||||||
|
this.category = 'Tools'
|
||||||
|
this.description = 'Execute actions using ChatGPT Plugin Url'
|
||||||
|
this.inputs = [
|
||||||
|
{
|
||||||
|
label: 'Plugin Url',
|
||||||
|
name: 'pluginUrl',
|
||||||
|
type: 'string',
|
||||||
|
placeholder: 'https://www.klarna.com/.well-known/ai-plugin.json'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
async getBaseClasses(): Promise<string[]> {
|
||||||
|
return ['Tool']
|
||||||
|
}
|
||||||
|
|
||||||
|
async init(nodeData: INodeData): Promise<any> {
|
||||||
|
const { AIPluginTool } = await import('langchain/tools')
|
||||||
|
const pluginUrl = nodeData.inputs?.pluginUrl as string
|
||||||
|
|
||||||
|
const aiplugin = await AIPluginTool.fromPluginUrl(pluginUrl)
|
||||||
|
return aiplugin
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { nodeClass: AIPlugin }
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-plug" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
||||||
|
<path d="M9.785 6l8.215 8.215l-2.054 2.054a5.81 5.81 0 1 1 -8.215 -8.215l2.054 -2.054z"></path>
|
||||||
|
<path d="M4 20l3.5 -3.5"></path>
|
||||||
|
<path d="M15 4l-3.5 3.5"></path>
|
||||||
|
<path d="M20 9l-3.5 3.5"></path>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 498 B |
|
|
@ -0,0 +1,33 @@
|
||||||
|
import { INode } from '../../../src/Interface'
|
||||||
|
import { getBaseClasses } from '../../../src/utils'
|
||||||
|
|
||||||
|
class RequestsGet implements INode {
|
||||||
|
label: string
|
||||||
|
name: string
|
||||||
|
description: string
|
||||||
|
type: string
|
||||||
|
icon: string
|
||||||
|
category: string
|
||||||
|
baseClasses: string[]
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.label = 'Requests Get'
|
||||||
|
this.name = 'requestsGet'
|
||||||
|
this.type = 'RequestsGet'
|
||||||
|
this.icon = 'requestsget.svg'
|
||||||
|
this.category = 'Tools'
|
||||||
|
this.description = 'Execute HTTP GET requests'
|
||||||
|
}
|
||||||
|
|
||||||
|
async getBaseClasses(): Promise<string[]> {
|
||||||
|
const { RequestsGetTool } = await import('langchain/tools')
|
||||||
|
return getBaseClasses(RequestsGetTool)
|
||||||
|
}
|
||||||
|
|
||||||
|
async init(): Promise<any> {
|
||||||
|
const { RequestsGetTool } = await import('langchain/tools')
|
||||||
|
return new RequestsGetTool()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { nodeClass: RequestsGet }
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-http-get" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
||||||
|
<path d="M7 8h-2a2 2 0 0 0 -2 2v4a2 2 0 0 0 2 2h2v-4h-1"></path>
|
||||||
|
<path d="M14 8h-4v8h4"></path>
|
||||||
|
<path d="M10 12h2.5"></path>
|
||||||
|
<path d="M17 8h4"></path>
|
||||||
|
<path d="M19 8v8"></path>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 487 B |
|
|
@ -0,0 +1,33 @@
|
||||||
|
import { INode } from '../../../src/Interface'
|
||||||
|
import { getBaseClasses } from '../../../src/utils'
|
||||||
|
|
||||||
|
class RequestsPost implements INode {
|
||||||
|
label: string
|
||||||
|
name: string
|
||||||
|
description: string
|
||||||
|
type: string
|
||||||
|
icon: string
|
||||||
|
category: string
|
||||||
|
baseClasses: string[]
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.label = 'Requests Post'
|
||||||
|
this.name = 'requestsPost'
|
||||||
|
this.type = 'RequestsPost'
|
||||||
|
this.icon = 'requestspost.svg'
|
||||||
|
this.category = 'Tools'
|
||||||
|
this.description = 'Execute HTTP POST requests'
|
||||||
|
}
|
||||||
|
|
||||||
|
async getBaseClasses(): Promise<string[]> {
|
||||||
|
const { RequestsPostTool } = await import('langchain/tools')
|
||||||
|
return getBaseClasses(RequestsPostTool)
|
||||||
|
}
|
||||||
|
|
||||||
|
async init(): Promise<any> {
|
||||||
|
const { RequestsPostTool } = await import('langchain/tools')
|
||||||
|
return new RequestsPostTool()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { nodeClass: RequestsPost }
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-http-post" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
||||||
|
<path d="M3 12h2a2 2 0 1 0 0 -4h-2v8"></path>
|
||||||
|
<path d="M12 8a2 2 0 0 1 2 2v4a2 2 0 1 1 -4 0v-4a2 2 0 0 1 2 -2z"></path>
|
||||||
|
<path d="M17 15a1 1 0 0 0 1 1h2a1 1 0 0 0 1 -1v-2a1 1 0 0 0 -1 -1h-2a1 1 0 0 1 -1 -1v-2a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1"></path>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 553 B |
|
|
@ -27,6 +27,7 @@
|
||||||
"langchain": "^0.0.44",
|
"langchain": "^0.0.44",
|
||||||
"moment": "^2.29.3",
|
"moment": "^2.29.3",
|
||||||
"node-fetch": "2",
|
"node-fetch": "2",
|
||||||
|
"openai": "^3.2.1",
|
||||||
"pdfjs-dist": "^3.5.141",
|
"pdfjs-dist": "^3.5.141",
|
||||||
"ws": "^8.9.0"
|
"ws": "^8.9.0"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue