diff --git a/packages/components/credentials/TavilyApi.credential.ts b/packages/components/credentials/TavilyApi.credential.ts new file mode 100644 index 000000000..161ff4df0 --- /dev/null +++ b/packages/components/credentials/TavilyApi.credential.ts @@ -0,0 +1,25 @@ +import { INodeParams, INodeCredential } from '../src/Interface' + +class TavilyApi implements INodeCredential { + label: string + name: string + version: number + description: string + inputs: INodeParams[] + + constructor() { + this.label = 'Tavily API' + this.name = 'tavilyApi' + this.version = 1.0 + this.description = 'Tavily API is a real-time API to access Google search results' + this.inputs = [ + { + label: 'Tavily Api Key', + name: 'tavilyApiKey', + type: 'password' + } + ] + } +} + +module.exports = { credClass: TavilyApi } diff --git a/packages/components/nodes/tools/TavilyAPI/TavilyAPI.ts b/packages/components/nodes/tools/TavilyAPI/TavilyAPI.ts new file mode 100644 index 000000000..68e44c546 --- /dev/null +++ b/packages/components/nodes/tools/TavilyAPI/TavilyAPI.ts @@ -0,0 +1,42 @@ +import { TavilySearchResults } from '@langchain/community/tools/tavily_search' +import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface' +import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils' + +class TavilyAPI_Tools implements INode { + label: string + name: string + version: number + description: string + type: string + icon: string + category: string + baseClasses: string[] + credential: INodeParams + inputs: INodeParams[] + + constructor() { + this.label = 'Tavily API' + this.name = 'tavilyAPI' + this.version = 1.0 + this.type = 'TavilyAPI' + this.icon = 'tavily.svg' + this.category = 'Tools' + this.description = 'Wrapper around TavilyAPI - a real-time API to access Google search results' + this.inputs = [] + this.credential = { + label: 'Connect Credential', + name: 'credential', + type: 'credential', + credentialNames: ['tavilyApi'] + } + this.baseClasses = [this.type, ...getBaseClasses(TavilySearchResults)] + } + + async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { + const credentialData = await getCredentialData(nodeData.credential ?? '', options) + const tavilyApiKey = getCredentialParam('tavilyApiKey', credentialData, nodeData) + return new TavilySearchResults({ apiKey: tavilyApiKey }) + } +} + +module.exports = { nodeClass: TavilyAPI_Tools } diff --git a/packages/components/nodes/tools/TavilyAPI/tavily.svg b/packages/components/nodes/tools/TavilyAPI/tavily.svg new file mode 100644 index 000000000..141d1d3d6 --- /dev/null +++ b/packages/components/nodes/tools/TavilyAPI/tavily.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/ui/src/views/canvas/ButtonEdge.jsx b/packages/ui/src/views/canvas/ButtonEdge.jsx index 3e93534b6..0e6810e06 100644 --- a/packages/ui/src/views/canvas/ButtonEdge.jsx +++ b/packages/ui/src/views/canvas/ButtonEdge.jsx @@ -4,6 +4,7 @@ import { useDispatch } from 'react-redux' import { useContext } from 'react' import { SET_DIRTY } from '@/store/actions' import { flowContext } from '@/store/context/ReactFlowContext' +import { IconX } from '@tabler/icons-react' import './index.css' @@ -53,7 +54,7 @@ const ButtonEdge = ({ id, sourceX, sourceY, targetX, targetY, sourcePosition, ta >
diff --git a/packages/ui/src/views/canvas/index.css b/packages/ui/src/views/canvas/index.css index e13d875e6..3ad926786 100644 --- a/packages/ui/src/views/canvas/index.css +++ b/packages/ui/src/views/canvas/index.css @@ -1,12 +1,14 @@ .edgebutton { width: 20px; height: 20px; + display: flex; + justify-content: center; + align-items: center; + padding: 0; background: #eee; border: 1px solid #fff; cursor: pointer; border-radius: 50%; - font-size: 12px; - line-height: 1; } .edgebutton:hover {