From cc6a1f04c620797332074ac0c2a89a7d7c56a84b Mon Sep 17 00:00:00 2001 From: vinodkiran Date: Sun, 4 Feb 2024 15:49:34 -0500 Subject: [PATCH] Marketplace: removing unused server API --- packages/server/src/index.ts | 47 +----------------------------------- 1 file changed, 1 insertion(+), 46 deletions(-) diff --git a/packages/server/src/index.ts b/packages/server/src/index.ts index 8878da948..e69e15bae 100644 --- a/packages/server/src/index.ts +++ b/packages/server/src/index.ts @@ -1223,33 +1223,7 @@ export class App { // Marketplaces // ---------------------------------------- - this.app.get('/api/v1/marketplaces/chatflows', async (req: Request, res: Response) => { - const marketplaceDir = path.join(__dirname, '..', 'marketplaces', 'chatflows') - const jsonsInDir = fs.readdirSync(marketplaceDir).filter((file) => path.extname(file) === '.json') - const templates: any[] = [] - jsonsInDir.forEach((file, index) => { - const filePath = path.join(__dirname, '..', 'marketplaces', 'chatflows', file) - const fileData = fs.readFileSync(filePath) - const fileDataObj = JSON.parse(fileData.toString()) - const template = { - id: index, - name: file.split('.json')[0], - flowData: fileData.toString(), - badge: fileDataObj?.badge, - description: fileDataObj?.description || '' - } - templates.push(template) - }) - const FlowiseDocsQnA = templates.find((tmp) => tmp.name === 'Flowise Docs QnA') - const FlowiseDocsQnAIndex = templates.findIndex((tmp) => tmp.name === 'Flowise Docs QnA') - if (FlowiseDocsQnA && FlowiseDocsQnAIndex > 0) { - templates.splice(FlowiseDocsQnAIndex, 1) - templates.unshift(FlowiseDocsQnA) - } - return res.json(templates) - }) - - // Get all chatflows for marketplaces + // Get all templates for marketplaces this.app.get('/api/v1/marketplaces/templates', async (req: Request, res: Response) => { let marketplaceDir = path.join(__dirname, '..', 'marketplaces', 'chatflows') let jsonsInDir = fs.readdirSync(marketplaceDir).filter((file) => path.extname(file) === '.json') @@ -1292,25 +1266,6 @@ export class App { return res.json(templates.sort((a, b) => a.templateName.localeCompare(b.templateName))) }) - // Get all tools for marketplaces - this.app.get('/api/v1/marketplaces/tools', async (req: Request, res: Response) => { - const marketplaceDir = path.join(__dirname, '..', 'marketplaces', 'tools') - const jsonsInDir = fs.readdirSync(marketplaceDir).filter((file) => path.extname(file) === '.json') - const templates: any[] = [] - jsonsInDir.forEach((file, index) => { - const filePath = path.join(__dirname, '..', 'marketplaces', 'tools', file) - const fileData = fs.readFileSync(filePath) - const fileDataObj = JSON.parse(fileData.toString()) - const template = { - ...fileDataObj, - id: index, - templateName: file.split('.json')[0] - } - templates.push(template) - }) - return res.json(templates) - }) - // ---------------------------------------- // Variables // ----------------------------------------