bhaveshgoel07 commited on
Commit
7347c68
·
1 Parent(s): a307cb5

Fix: Use Blaxel sandbox as primary rendering method (not hardcoded local)

Browse files
Files changed (1) hide show
  1. mcp_servers/renderer.py +26 -3
mcp_servers/renderer.py CHANGED
@@ -380,9 +380,32 @@ async def render_manim_animation(arguments: Dict[str, Any]) -> CallToolResult:
380
  format_type = arguments.get("format", "mp4")
381
  frame_rate = arguments.get("frame_rate", 30)
382
 
383
- # Skip sandbox rendering and use local rendering directly with .venv
384
- logger.info("Using local Manim rendering with .venv environment...")
385
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
386
  local_result = await _render_manim_locally(
387
  scene_name, file_path, output_dir, quality, format_type, frame_rate
388
  )
 
380
  format_type = arguments.get("format", "mp4")
381
  frame_rate = arguments.get("frame_rate", 30)
382
 
383
+ # Try Blaxel sandbox rendering first
384
+ logger.info("Attempting to render using Blaxel sandbox...")
385
+
386
+ # Check if Blaxel is configured (optional, but good practice)
387
+ # For now, we'll try it and catch exceptions
388
+
389
+ try:
390
+ sandbox_result = await _render_manim_with_sandbox(
391
+ scene_name, file_path, output_dir, quality, format_type, frame_rate
392
+ )
393
+
394
+ if not sandbox_result.get("isError", False):
395
+ return CallToolResult(
396
+ content=[TextContent(type="text", text=sandbox_result["text"])],
397
+ isError=False,
398
+ )
399
+
400
+ logger.warning(f"Blaxel sandbox rendering failed: {sandbox_result.get('text')}")
401
+ logger.info("Falling back to local rendering...")
402
+
403
+ except Exception as e:
404
+ logger.warning(f"Blaxel sandbox rendering error: {str(e)}")
405
+ logger.info("Falling back to local rendering...")
406
+
407
+ # Fallback to local rendering
408
+ logger.info("Using local Manim rendering...")
409
  local_result = await _render_manim_locally(
410
  scene_name, file_path, output_dir, quality, format_type, frame_rate
411
  )