mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 09:00:52 +03:00
add autogpt, readfile and writefile tools
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import { INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||
import { getBaseClasses } from '../../../src/utils'
|
||||
import { WriteFileTool } from 'langchain/tools'
|
||||
import { NodeFileStore } from 'langchain/stores/file/node'
|
||||
|
||||
class WriteFile_Tools implements INode {
|
||||
label: string
|
||||
name: string
|
||||
description: string
|
||||
type: string
|
||||
icon: string
|
||||
category: string
|
||||
baseClasses: string[]
|
||||
inputs: INodeParams[]
|
||||
|
||||
constructor() {
|
||||
this.label = 'Write File'
|
||||
this.name = 'writeFile'
|
||||
this.type = 'WriteFile'
|
||||
this.icon = 'writefile.svg'
|
||||
this.category = 'Tools'
|
||||
this.description = 'Write file to disk'
|
||||
this.baseClasses = [this.type, 'Tool', ...getBaseClasses(WriteFileTool)]
|
||||
this.inputs = [
|
||||
{
|
||||
label: 'Base Path',
|
||||
name: 'basePath',
|
||||
placeholder: `C:\\Users\\User\\Desktop`,
|
||||
type: 'string',
|
||||
optional: true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
async init(nodeData: INodeData): Promise<any> {
|
||||
const basePath = nodeData.inputs?.basePath as string
|
||||
const store = basePath ? new NodeFileStore(basePath) : new NodeFileStore()
|
||||
return new WriteFileTool({ store })
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { nodeClass: WriteFile_Tools }
|
||||
@@ -0,0 +1,6 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-file-pencil" 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="M14 3v4a1 1 0 0 0 1 1h4"></path>
|
||||
<path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path>
|
||||
<path d="M10 18l5 -5a1.414 1.414 0 0 0 -2 -2l-5 5v2h2z"></path>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 502 B |
Reference in New Issue
Block a user