feat: Sketch to CAD - #46
Open
uswii wants to merge 12 commits into
Open
Conversation
- Replace CAD to Catalog card in CADStudio with Sketch to CAD (PenTool icon, /sketch-to-cad route) - Add /sketch-to-cad route in App.tsx behind ProtectedRoute + CADGate - sketch-to-cad-workflows.ts: workflow constants and buildSketchToCadStartBody for sketch_generate_v1 - use-sketch-to-cad-generation.ts: credit preflight, base64 data URI upload, poll + parse GLB result - SketchToCAD.tsx: multi-sketch upload page (max 10), per-sketch hint, credit estimate, mobile-responsive sticky footer - SketchLeftPanel.tsx + SketchUploadScreen.tsx: workspace components for sketch mode - posthog-events.ts: trackSketchToCadCompleted event - feature-flags.ts: isSketchToCadEnabled gate (allowlist, owner uswa@raresense.so) - credits-api.ts: sketch_generate_v1 fallback cost (85 credits) - sketch-to-cad-workflows.test.ts: 6 tests covering payload shape and return nodes
- Move sketchSessionStore to src/lib/sketch-session-store.ts - Add mode=sketch handler in TextToCAD: skips InitialPromptScreen and auto-starts sketch generation workflow - Add generate_from_sketch/validate_against_sketch labels to GenerationProgress - Redesign SketchToCAD upload screen: two-column layout, Diamond icon with pulse, guide panel, matching photo studio aesthetic
…), add example images to guide
…ith sketch thumbnail in left panel
…ggable examples, stone_ gem regex
… drop zone on clear, prompt placeholder
…s visible, add retry
- Add explanation to eslint-disable in SketchToCAD.tsx (Rule 9) - Replace ternary statement with if/else in onClick handler (lint error) - Remove unused eslint-disable directive in use-sketch-to-cad-generation.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/sketch-to-cadroute, no longercomingSoon)SketchToCAD.tsx): grid layout, max 10 sketches per batch, per-sketch expandable hint input, live credit estimate, mobile-responsive sticky footersketch_generate_v1workflow: base64 data URI sent directly asreference_image-- no Azure pre-upload (backend handles CAS normalization)use-sketch-to-cad-generation.ts: credit preflight (backend/api/credits/estimatefirst, 85cr fallback), base64 read, poll + parse GLB artifact,refreshCredits()on success (Rule 6)SketchLeftPanel.tsx+SketchUploadScreen.tsx: workspace panel components for sketch modeisSketchToCadEnabled()viaVITE_SKETCH_TO_CAD_ALLOWLIST_EMAILStrackSketchToCadCompletedeventTest plan
npx vitest run src/lib/sketch-to-cad-workflows.test.ts-- all 6 pass/studio-cad-- card shows "Sketch to CAD" with PenTool icon, not "CAD to Catalog"/sketch-to-cad-- upload page loads, drag/click to add sketches (up to 10)/api/run/sketch_generate_v1withreference_imageas data URIgenerate_from_sketch,build_initial,build_retry,validate_against_sketch,build_corrected