mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 11:00:55 +03:00
Chore/update deprecating nodes (#2540)
* update deprecating nodes * add filters use cases to marketplace * update log level
This commit is contained in:
@@ -3,6 +3,20 @@ import * as fs from 'fs'
|
||||
import { StatusCodes } from 'http-status-codes'
|
||||
import { InternalFlowiseError } from '../../errors/internalFlowiseError'
|
||||
import { getErrorMessage } from '../../errors/utils'
|
||||
import { IReactFlowEdge, IReactFlowNode } from '../../Interface'
|
||||
|
||||
type ITemplate = {
|
||||
badge: string
|
||||
description: string
|
||||
framework: string[]
|
||||
usecases: string[]
|
||||
nodes: IReactFlowNode[]
|
||||
edges: IReactFlowEdge[]
|
||||
}
|
||||
|
||||
const getCategories = (fileDataObj: ITemplate) => {
|
||||
return Array.from(new Set(fileDataObj?.nodes?.map((node) => node.data.category).filter((category) => category)))
|
||||
}
|
||||
|
||||
// Get all templates for marketplaces
|
||||
const getAllTemplates = async () => {
|
||||
@@ -13,14 +27,16 @@ const getAllTemplates = async () => {
|
||||
jsonsInDir.forEach((file, index) => {
|
||||
const filePath = path.join(__dirname, '..', '..', '..', 'marketplaces', 'chatflows', file)
|
||||
const fileData = fs.readFileSync(filePath)
|
||||
const fileDataObj = JSON.parse(fileData.toString())
|
||||
const fileDataObj = JSON.parse(fileData.toString()) as ITemplate
|
||||
|
||||
const template = {
|
||||
id: index,
|
||||
templateName: file.split('.json')[0],
|
||||
flowData: fileData.toString(),
|
||||
badge: fileDataObj?.badge,
|
||||
framework: fileDataObj?.framework,
|
||||
categories: fileDataObj?.categories,
|
||||
usecases: fileDataObj?.usecases,
|
||||
categories: getCategories(fileDataObj),
|
||||
type: 'Chatflow',
|
||||
description: fileDataObj?.description || ''
|
||||
}
|
||||
@@ -39,7 +55,8 @@ const getAllTemplates = async () => {
|
||||
type: 'Tool',
|
||||
framework: fileDataObj?.framework,
|
||||
badge: fileDataObj?.badge,
|
||||
categories: '',
|
||||
usecases: fileDataObj?.usecases,
|
||||
categories: [],
|
||||
templateName: file.split('.json')[0]
|
||||
}
|
||||
templates.push(template)
|
||||
@@ -57,7 +74,8 @@ const getAllTemplates = async () => {
|
||||
flowData: fileData.toString(),
|
||||
badge: fileDataObj?.badge,
|
||||
framework: fileDataObj?.framework,
|
||||
categories: fileDataObj?.categories,
|
||||
usecases: fileDataObj?.usecases,
|
||||
categories: getCategories(fileDataObj),
|
||||
type: 'Agentflow',
|
||||
description: fileDataObj?.description || ''
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user