mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 21:00:58 +03:00
fix build error
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import fetch from 'node-fetch'
|
||||
import { Tool } from 'langchain/tools'
|
||||
|
||||
export const desc = `A portal to the internet. Use this when you need to get specific content from a website.
|
||||
@@ -31,11 +32,14 @@ export class RequestsGetTool extends Tool {
|
||||
|
||||
/** @ignore */
|
||||
async _call(input: string) {
|
||||
const inputUrl = this.url ?? input
|
||||
const inputUrl = !this.url ? input : this.url
|
||||
|
||||
if (process.env.DEBUG === 'true') console.info(`Making GET API call to ${inputUrl}`)
|
||||
|
||||
const res = await fetch(inputUrl, {
|
||||
headers: this.headers
|
||||
})
|
||||
|
||||
const text = await res.text()
|
||||
return text.slice(0, this.maxOutputLength)
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Tool } from 'langchain/tools'
|
||||
import fetch from 'node-fetch'
|
||||
|
||||
export const desc = `Use this when you want to POST to a website.
|
||||
Input should be a json string with two keys: "url" and "data".
|
||||
@@ -53,12 +54,15 @@ export class RequestsPostTool extends Tool {
|
||||
inputUrl = url
|
||||
inputBody = data
|
||||
}
|
||||
|
||||
if (process.env.DEBUG === 'true') console.info(`Making POST API call to ${inputUrl} with body ${JSON.stringify(inputBody)}`)
|
||||
|
||||
const res = await fetch(inputUrl, {
|
||||
method: 'POST',
|
||||
headers: this.headers,
|
||||
body: JSON.stringify(inputBody)
|
||||
})
|
||||
|
||||
const text = await res.text()
|
||||
return text.slice(0, this.maxOutputLength)
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user