MCPcopy
hub / github.com/OpenBMB/ChatDev / copy_workflow_file

Function copy_workflow_file

server/routes/workflows.py:309–329  ·  view source on GitHub ↗
(filename: str, request: WorkflowCopyRequest)

Source from the content-addressed store, hash-verified

307
308@router.post("/api/workflows/{filename}/copy")
309async def copy_workflow_file(filename: str, request: WorkflowCopyRequest):
310 try:
311 copy_workflow(filename, request.new_filename, directory=YAML_DIR)
312 return {
313 "status": "success",
314 "source": validate_workflow_filename(filename, require_yaml_extension=True),
315 "target": validate_workflow_filename(request.new_filename, require_yaml_extension=True),
316 "message": f"Workflow copied to '{request.new_filename}' successfully",
317 }
318 except ValidationError:
319 raise
320 except SecurityError:
321 raise
322 except ResourceConflictError:
323 raise
324 except ResourceNotFoundError:
325 raise
326 except Exception as exc:
327 logger = get_server_logger()
328 logger.log_exception(exc, f"Unexpected error copying workflow: {filename}")
329 raise WorkflowExecutionError(f"Failed to copy workflow: {exc}")
330
331
332@router.get("/api/workflows/{filename}/get")

Callers

nothing calls this directly

Calls 5

copy_workflowFunction · 0.90
get_server_loggerFunction · 0.90
log_exceptionMethod · 0.80

Tested by

no test coverage detected