MCPcopy Create free account
hub / github.com/FlowiseAI/Flowise / updateEvaluator

Function updateEvaluator

packages/server/src/services/evaluator/index.ts:70–92  ·  view source on GitHub ↗
(id: string, body: any, workspaceId: string)

Source from the content-addressed store, hash-verified

68
69// Update Evaluator
70const updateEvaluator = async (id: string, body: any, workspaceId: string) => {
71 try {
72 const appServer = getRunningExpressApp()
73 const evaluator = await appServer.AppDataSource.getRepository(Evaluator).findOneBy({
74 id: id,
75 workspaceId: workspaceId
76 })
77
78 if (!evaluator) throw new Error(`Evaluator ${id} not found`)
79
80 const updateEvaluator = EvaluatorDTO.toEntity(body)
81 updateEvaluator.id = id
82 updateEvaluator.workspaceId = workspaceId
83 appServer.AppDataSource.getRepository(Evaluator).merge(evaluator, updateEvaluator)
84 const result = await appServer.AppDataSource.getRepository(Evaluator).save(evaluator)
85 return EvaluatorDTO.fromEntity(result)
86 } catch (error) {
87 throw new InternalFlowiseError(
88 StatusCodes.INTERNAL_SERVER_ERROR,
89 `Error: evaluatorService.updateEvaluator - ${getErrorMessage(error)}`
90 )
91 }
92}
93
94// Delete Evaluator via id
95const deleteEvaluator = async (id: string, workspaceId: string) => {

Callers

nothing calls this directly

Calls 4

getRunningExpressAppFunction · 0.90
getErrorMessageFunction · 0.90
toEntityMethod · 0.45
fromEntityMethod · 0.45

Tested by

no test coverage detected