noahlee1234 commited on
Commit
73bbb49
·
1 Parent(s): 159c23a

tune: raise worker exec/llm timeouts and cap geometry complexity

Browse files
Files changed (1) hide show
  1. apps/cad-worker/main.py +3 -2
apps/cad-worker/main.py CHANGED
@@ -213,7 +213,7 @@ def _validate_generated_code(code: str) -> tuple[bool, str | None]:
213
 
214
 
215
  def _exec_with_timeout(code: str, script_path: Path, exec_globals: dict) -> None:
216
- timeout_seconds = max(1, int(os.environ.get("NATURALCAD_EXEC_TIMEOUT_SECONDS", "20")))
217
 
218
  # SIGALRM only works on the main thread. Modal may invoke this handler on
219
  # a worker thread, so fall back to direct exec in that case.
@@ -423,6 +423,7 @@ Rules:
423
  8. NEVER use standalone rotate() or translate(). Use with Locations((x, y, z)): or obj.rotate(Axis.Z, angle).
424
  9. extrude() takes amount= (e.g. extrude(amount=10)) or both=True. Do NOT use start= or distance=.
425
  10. extrude() must be called inside a BuildPart context, immediately after a BuildSketch block.
 
426
 
427
  Canonical skeleton (adapt dimensions and features to the request):
428
  from build123d import *
@@ -617,7 +618,7 @@ def generate_cad(prompt: str, mode: str = "part", output_type: str = "3d_solid")
617
  "temperature": 0.2,
618
  }
619
 
620
- with httpx.Client(timeout=120.0) as client:
621
  response = client.post(openrouter_api_url, headers=headers, json=payload)
622
 
623
  if response.status_code >= 400:
 
213
 
214
 
215
  def _exec_with_timeout(code: str, script_path: Path, exec_globals: dict) -> None:
216
+ timeout_seconds = max(1, int(os.environ.get("NATURALCAD_EXEC_TIMEOUT_SECONDS", "60")))
217
 
218
  # SIGALRM only works on the main thread. Modal may invoke this handler on
219
  # a worker thread, so fall back to direct exec in that case.
 
423
  8. NEVER use standalone rotate() or translate(). Use with Locations((x, y, z)): or obj.rotate(Axis.Z, angle).
424
  9. extrude() takes amount= (e.g. extrude(amount=10)) or both=True. Do NOT use start= or distance=.
425
  10. extrude() must be called inside a BuildPart context, immediately after a BuildSketch block.
426
+ 11. Keep geometry complexity bounded. Prefer a simplified form over many tiny repeated features.
427
 
428
  Canonical skeleton (adapt dimensions and features to the request):
429
  from build123d import *
 
618
  "temperature": 0.2,
619
  }
620
 
621
+ with httpx.Client(timeout=180.0) as client:
622
  response = client.post(openrouter_api_url, headers=headers, json=payload)
623
 
624
  if response.status_code >= 400: