Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
__pycache__
*.pyc
*.pyo
.env
.env.*
.git
.gitignore
.pytest_cache
.mypy_cache
.ruff_cache
*.egg-info
dist
build
node_modules
frontend/node_modules
frontend/dist
research
docs
*.md
!README.md
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ venv/
.idea/
*.swp

# Export artifacts
*.stl
*.step
*.x_t

# OS
.DS_Store
Thumbs.db
26 changes: 26 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Stage 1: Build React frontend
FROM node:20-slim AS frontend-build
WORKDIR /app/frontend
COPY frontend/package.json frontend/package-lock.json* ./
RUN npm ci
COPY frontend/ ./
RUN npm run build

# Stage 2: Python runtime
FROM python:3.11-slim AS runtime
WORKDIR /app

# Install Python package
COPY pyproject.toml README.md ./
COPY src/ ./src/
RUN pip install --no-cache-dir ".[web]"

# Copy built frontend
COPY --from=frontend-build /app/frontend/dist ./frontend/dist

EXPOSE 8000

HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/api/health')"

CMD ["python", "-m", "onshape_chat.main", "web", "8000"]
11 changes: 11 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
services:
onshape-chat:
build: .
ports:
- "8000:8000"
env_file:
- .env
environment:
- GLM_MODEL=${GLM_MODEL:-glm-4.7}
- ONSHAPE_BASE_URL=${ONSHAPE_BASE_URL:-https://cad.onshape.com/api/v6}
restart: unless-stopped
120 changes: 60 additions & 60 deletions docs/phase-3-polish.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ Onshape Assemblies allow multiple parts to be positioned relative to each other

#### Implementation Tasks

- [ ] **Assembly Creation**
- [x] **Assembly Creation**
- `create_assembly(document_id: str, name: str) -> dict`
- Create new assembly tab in document

- [ ] **Insert Part**
- [x] **Insert Part**
- `insert_part(assembly_id: str, part_id: str, position: dict = None) -> dict`
- Add a part to the assembly
- Position at origin or specified coordinates

- [ ] **Mate Relations**
- [x] **Mate Relations**
- `add_mate(
assembly_id: str,
part1_entity: str,
Expand Down Expand Up @@ -228,17 +228,17 @@ def suggest_mate(

#### Export Formats

- [ ] **STL Export** (3D printing)
- [x] **STL Export** (3D printing)
- `export_stl(part_id: str, filename: str) -> str`
- Binary STL format
- Units in mm

- [ ] **STEP Export** (CAD interchange)
- [x] **STEP Export** (CAD interchange)
- `export_step(part_id: str, filename: str) -> str`
- AP214 format
- Preserve geometry and metadata

- [ ] **PARASOLID Export** (Onshape native)
- [x] **PARASOLID Export** (Onshape native)
- `export_parasolid(part_id: str, filename: str) -> str`
- XT format

Expand Down Expand Up @@ -359,12 +359,12 @@ def download_export_file(

#### Display Methods

- [ ] **Terminal Graphics**
- [x] **Terminal Graphics**
- Sixel protocol (supported by many terminals)
- Kitty graphics protocol
- ITU-T T.416 (sixel)

- [ ] **Fallback**
- [x] **Fallback**
- ASCII art approximation
- Browser-based viewing

Expand Down Expand Up @@ -511,18 +511,18 @@ def show_preview(element_type: str = "part"):

#### Error Categories

- [ ] **API Errors**
- [x] **API Errors**
- Authentication failures
- Rate limits
- Network timeouts
- Invalid responses

- [ ] **User Errors**
- [x] **User Errors**
- Invalid parameters
- Impossible operations
- Conflicting requests

- [ ] **Onshape Errors**
- [x] **Onshape Errors**
- Feature failures
- Constraint violations
- Geometry errors
Expand Down Expand Up @@ -687,15 +687,15 @@ def execute_tool_call(tool_call: dict) -> dict:

#### Implementation

- [ ] **Feature History Tracking**
- [x] **Feature History Tracking**
- Maintain ordered list of all features
- Store feature IDs and types

- [ ] **Rollback Feature**
- [x] **Rollback Feature**
- `rollback_feature(feature_id: str) -> dict`
- Delete a feature and all dependent features

- [ ] **Undo Last Action**
- [x] **Undo Last Action**
- `undo() -> dict`
- Rollback most recent feature

Expand Down Expand Up @@ -814,17 +814,17 @@ def undo_last_action(self) -> str:

#### Enhanced Documentation

- [ ] **API Documentation**
- [x] **API Documentation**
- Complete API reference for all endpoints used
- Request/response examples
- Common pitfalls

- [ ] **FeatureScript Patterns**
- [x] **FeatureScript Patterns**
- Common sketch patterns
- Feature creation examples
- Parameter reference

- [ ] **Best Practices**
- [x] **Best Practices**
- Modeling tips
- Common workflows
- Troubleshooting guide
Expand Down Expand Up @@ -1043,24 +1043,24 @@ Assistant: Assembly bounding box: 150mm x 120mm x 115mm

### Integration Tests

- [ ] Assembly creation and mating
- [ ] Export to STL and STEP
- [ ] Thumbnail generation and display
- [ ] Undo/rollback workflows
- [ ] Error recovery scenarios
- [x] Assembly creation and mating
- [x] Export to STL and STEP
- [x] Thumbnail generation and display
- [x] Undo/rollback workflows
- [x] Error recovery scenarios

### Manual Testing

- [ ] **Assembly workflow**: Create assembly, insert parts, add mates
- [ ] **Export workflow**: Export various formats, verify files
- [ ] **Error handling**: Trigger various errors, verify helpful messages
- [ ] **Undo workflow**: Create features, undo, verify state
- [x] **Assembly workflow**: Create assembly, insert parts, add mates
- [x] **Export workflow**: Export various formats, verify files
- [x] **Error handling**: Trigger various errors, verify helpful messages
- [x] **Undo workflow**: Create features, undo, verify state

### User Experience Testing

- [ ] Terminal graphics in different terminals
- [ ] Error message clarity
- [ ] Conversation flow and context
- [x] Terminal graphics in different terminals
- [x] Error message clarity
- [x] Conversation flow and context
- [ ] Performance with large models

---
Expand Down Expand Up @@ -1092,26 +1092,26 @@ By the end of Phase 3, we'll have ~30 tools:

### Features

- [ ] Complete assembly operations
- [ ] Export to STL/STEP
- [ ] Terminal graphics display
- [ ] Comprehensive error handling
- [ ] Undo/rollback support
- [ ] Enhanced RAG context
- [x] Complete assembly operations
- [x] Export to STL/STEP
- [x] Terminal graphics display
- [x] Comprehensive error handling
- [x] Undo/rollback support
- [x] Enhanced RAG context

### Documentation

- [ ] User guide with examples
- [ ] API reference (inline)
- [ ] Troubleshooting guide
- [ ] Best practices document
- [x] User guide with examples
- [x] API reference (inline)
- [x] Troubleshooting guide
- [x] Best practices document

### Quality

- [ ] Test coverage >80%
- [ ] Error handling for all API calls
- [x] Test coverage >80%
- [x] Error handling for all API calls
- [ ] Performance optimization
- [ ] Code review and refactoring
- [x] Code review and refactoring

---

Expand Down Expand Up @@ -1144,30 +1144,30 @@ Ready for Phase 4 enhancements:
## Checklist Summary

### Assembly Capabilities
- [ ] Create assemblies
- [ ] Insert parts
- [ ] Add mates (coincident, parallel, angle, distance)
- [x] Create assemblies
- [x] Insert parts
- [x] Add mates (coincident, parallel, angle, distance)
- [ ] Smart mate suggestions

### Export & Visualization
- [ ] STL export (3D printing)
- [ ] STEP export (CAD interchange)
- [ ] Thumbnail/screenshot generation
- [ ] Terminal graphics display
- [x] STL export (3D printing)
- [x] STEP export (CAD interchange)
- [x] Thumbnail/screenshot generation
- [x] Terminal graphics display

### Reliability
- [ ] Comprehensive error handling
- [ ] Helpful error messages
- [ ] Retry logic for API calls
- [ ] Undo/rollback support
- [x] Comprehensive error handling
- [x] Helpful error messages
- [x] Retry logic for API calls
- [x] Undo/rollback support

### Intelligence
- [ ] Enhanced RAG context
- [ ] Multi-turn context management
- [ ] Conversation summarization
- [x] Enhanced RAG context
- [x] Multi-turn context management
- [x] Conversation summarization

### Testing
- [ ] Assembly workflow tests
- [ ] Export validation tests
- [ ] Error recovery tests
- [ ] UX testing across terminals
- [x] Assembly workflow tests
- [x] Export validation tests
- [x] Error recovery tests
- [x] UX testing across terminals
Loading