Skip to content

Hide CAD code in chat by default behind CHAMFER_SHOW_CAD_CODE#14

Merged
SmartAI merged 1 commit into
mainfrom
feat/cad-code-visibility
Jul 12, 2026
Merged

Hide CAD code in chat by default behind CHAMFER_SHOW_CAD_CODE#14
SmartAI merged 1 commit into
mainfrom
feat/cad-code-visibility

Conversation

@SmartAI

@SmartAI SmartAI commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Chat now collapses CAD code bodies to a one-line "CAD code" row with Copy and Render 3D still working. Set CHAMFER_SHOW_CAD_CODE=1 (or the showCadCode settings override) to render the bodies as before.

What changed

  • Both render sites covered: the run_build123d block in the tool card and ```python fences in assistant prose, via a shared CadCodeBlock component. Measurements, verify gate, errors, and the view sheet are untouched.
  • Plumbing mirrors maxCadRuns: SettingsDto.showCadCode, envSettings() mapping (1 on, 0 silently off, junk warns), settings store key, GET /api/settings. No settings-dialog UI yet; the dialog can gain a toggle later with zero protocol change.
  • CONTEXT.md pins the vocabulary: "CAD code" is the agent-written build123d program, distinct from the dev-panel script.

Testing

  • Unit: env mapping + junk warning, settings route round-trip, both visibility states for the tool card and prose fences.
  • E2E: new cad-code-visibility.spec.ts asserts the hidden default (placeholder row, no code text) and the enabled state. The enabled state flips via the settings DB override rather than the env var - restarting the shared e2e server per-env isn't practical; db>env precedence makes it a faithful proxy. Full battery green locally.

Validation to eyeball: run a prompt with the flag unset (code collapsed, Copy/Render 3D work) and with CHAMFER_SHOW_CAD_CODE=1 in .env.local (code visible). Codex review (gpt-5.6-sol) came back clean twice.

Chat now collapses CAD code bodies (run_build123d tool blocks and python
fences in assistant prose) to a label-and-actions row - Copy and Render 3D
stay functional. Setting CHAMFER_SHOW_CAD_CODE=1 (or the showCadCode
settings override) renders the bodies as before.

The flag follows the maxCadRuns plumbing: SettingsDto field, envSettings
mapping with junk-value warning, settings store key, GET /api/settings.
CONTEXT.md pins the vocabulary (CAD code vs dev-panel script).
@SmartAI SmartAI merged commit 0d1088c into main Jul 12, 2026
1 check passed
@SmartAI SmartAI deleted the feat/cad-code-visibility branch July 12, 2026 01:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant