fix(AI Agent Node): Fix issues with some tools not populating (#10406)

This commit is contained in:
oleg 2024-08-14 15:45:50 +02:00 committed by GitHub
parent 4dc34ba745
commit 51a1eddbf0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -13,7 +13,6 @@ import type { BaseLLM } from '@langchain/core/language_models/llms';
import type { BaseChatMemory } from 'langchain/memory'; import type { BaseChatMemory } from 'langchain/memory';
import type { BaseChatMessageHistory } from '@langchain/core/chat_history'; import type { BaseChatMessageHistory } from '@langchain/core/chat_history';
import { N8nTool } from './N8nTool'; import { N8nTool } from './N8nTool';
import { DynamicTool } from '@langchain/core/tools';
function hasMethods<T>(obj: unknown, ...methodNames: Array<string | symbol>): obj is T { function hasMethods<T>(obj: unknown, ...methodNames: Array<string | symbol>): obj is T {
return methodNames.every( return methodNames.every(
@ -195,8 +194,6 @@ export const getConnectedTools = async (
const finalTools = []; const finalTools = [];
for (const tool of connectedTools) { for (const tool of connectedTools) {
if (!(tool instanceof DynamicTool) && !(tool instanceof N8nTool)) continue;
const { name } = tool; const { name } = tool;
if (seenNames.has(name)) { if (seenNames.has(name)) {
throw new NodeOperationError( throw new NodeOperationError(