mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 15:00:57 +03:00
add tools for plugins
This commit is contained in:
@@ -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 |
Reference in New Issue
Block a user