mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-03-15 12:16:33 +01:00
refactor: separate manifest logic into its own module
This commit is contained in:
parent
20a486a190
commit
1bdfb143eb
2 changed files with 22 additions and 17 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
const availableTools = require('./manifest.json');
|
const manifest = require('./manifest');
|
||||||
|
|
||||||
// Structured Tools
|
// Structured Tools
|
||||||
const DALLE3 = require('./structured/DALLE3');
|
const DALLE3 = require('./structured/DALLE3');
|
||||||
|
|
@ -13,23 +13,8 @@ const TraversaalSearch = require('./structured/TraversaalSearch');
|
||||||
const createOpenAIImageTools = require('./structured/OpenAIImageTools');
|
const createOpenAIImageTools = require('./structured/OpenAIImageTools');
|
||||||
const TavilySearchResults = require('./structured/TavilySearchResults');
|
const TavilySearchResults = require('./structured/TavilySearchResults');
|
||||||
|
|
||||||
/** @type {Record<string, TPlugin | undefined>} */
|
|
||||||
const manifestToolMap = {};
|
|
||||||
|
|
||||||
/** @type {Array<TPlugin>} */
|
|
||||||
const toolkits = [];
|
|
||||||
|
|
||||||
availableTools.forEach((tool) => {
|
|
||||||
manifestToolMap[tool.pluginKey] = tool;
|
|
||||||
if (tool.toolkit === true) {
|
|
||||||
toolkits.push(tool);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
toolkits,
|
...manifest,
|
||||||
availableTools,
|
|
||||||
manifestToolMap,
|
|
||||||
// Structured Tools
|
// Structured Tools
|
||||||
DALLE3,
|
DALLE3,
|
||||||
FluxAPI,
|
FluxAPI,
|
||||||
|
|
|
||||||
20
api/app/clients/tools/manifest.js
Normal file
20
api/app/clients/tools/manifest.js
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
const availableTools = require('./manifest.json');
|
||||||
|
|
||||||
|
/** @type {Record<string, TPlugin | undefined>} */
|
||||||
|
const manifestToolMap = {};
|
||||||
|
|
||||||
|
/** @type {Array<TPlugin>} */
|
||||||
|
const toolkits = [];
|
||||||
|
|
||||||
|
availableTools.forEach((tool) => {
|
||||||
|
manifestToolMap[tool.pluginKey] = tool;
|
||||||
|
if (tool.toolkit === true) {
|
||||||
|
toolkits.push(tool);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
toolkits,
|
||||||
|
availableTools,
|
||||||
|
manifestToolMap,
|
||||||
|
};
|
||||||
Loading…
Add table
Add a link
Reference in a new issue