From c88ec3d0b5ef65ec283483e33da3568f7b517eda Mon Sep 17 00:00:00 2001 From: Noel Schenk Date: Thu, 29 Aug 2024 15:10:13 +0200 Subject: [PATCH] feat: assistant.js update addAssistantTool Check if toolClass is an object or class, and use it directly if it's an object. --- src/experts/assistant.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/experts/assistant.js b/src/experts/assistant.js index 3326fcd..5a10276 100644 --- a/src/experts/assistant.js +++ b/src/experts/assistant.js @@ -118,7 +118,9 @@ class Assistant { } addAssistantTool(toolClass) { - const assistantTool = new toolClass(); + const assistantTool = typeof toolClass === 'function' + ? new toolClass() + : toolClass; assistantTool.parent = this; this.experts.push(assistantTool); if (assistantTool.isParentsTools) {