From 1bdfb143eb9df5b7e0d2bcc2fb3a335975882710 Mon Sep 17 00:00:00 2001 From: Danny Avila Date: Wed, 20 Aug 2025 00:56:39 -0400 Subject: [PATCH] refactor: separate manifest logic into its own module --- api/app/clients/tools/index.js | 19 ++----------------- api/app/clients/tools/manifest.js | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 17 deletions(-) create mode 100644 api/app/clients/tools/manifest.js diff --git a/api/app/clients/tools/index.js b/api/app/clients/tools/index.js index 87b1884e88..90d1545a5a 100644 --- a/api/app/clients/tools/index.js +++ b/api/app/clients/tools/index.js @@ -1,4 +1,4 @@ -const availableTools = require('./manifest.json'); +const manifest = require('./manifest'); // Structured Tools const DALLE3 = require('./structured/DALLE3'); @@ -13,23 +13,8 @@ const TraversaalSearch = require('./structured/TraversaalSearch'); const createOpenAIImageTools = require('./structured/OpenAIImageTools'); const TavilySearchResults = require('./structured/TavilySearchResults'); -/** @type {Record} */ -const manifestToolMap = {}; - -/** @type {Array} */ -const toolkits = []; - -availableTools.forEach((tool) => { - manifestToolMap[tool.pluginKey] = tool; - if (tool.toolkit === true) { - toolkits.push(tool); - } -}); - module.exports = { - toolkits, - availableTools, - manifestToolMap, + ...manifest, // Structured Tools DALLE3, FluxAPI, diff --git a/api/app/clients/tools/manifest.js b/api/app/clients/tools/manifest.js new file mode 100644 index 0000000000..302d9c3dfe --- /dev/null +++ b/api/app/clients/tools/manifest.js @@ -0,0 +1,20 @@ +const availableTools = require('./manifest.json'); + +/** @type {Record} */ +const manifestToolMap = {}; + +/** @type {Array} */ +const toolkits = []; + +availableTools.forEach((tool) => { + manifestToolMap[tool.pluginKey] = tool; + if (tool.toolkit === true) { + toolkits.push(tool); + } +}); + +module.exports = { + toolkits, + availableTools, + manifestToolMap, +};