078b0bee32
Accept DWG and DXF files (up to 24 MB) through the canvas asset picker and drag-and-drop. Conversion runs locally in a browser worker via acad-ts, uploads a sanitized derived SVG, and leaves the source file untouched. DXF covers ASCII and binary drawings; DWG covers AutoCAD R14 through 2018. Rename the image-only upload input/handler to a generic canvas asset flow, add vector-image node detection, tag imported SVGs as vector-image nodes, localize CAD import status/error messages, and switch the Next build to the webpack compiler so the worker bundles correctly. Add a node --test suite covering CAD conversion and vector image helpers. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
117 lines
2.6 KiB
Markdown
117 lines
2.6 KiB
Markdown
# img-infinite-canvas
|
|
|
|
Moteva 风格的 AI 设计工作台复刻 MVP:主页 Prompt 创建项目,项目页提供无限画布、节点拖拽、缩放平移、右侧设计对话、历史回放、图片与 DWG/DXF 图纸导入、项目保存与再生成。
|
|
|
|
## Stack
|
|
|
|
- Backend: go-zero, DDD layering, sqlc, pgx, PostgreSQL optional persistence
|
|
- Cache: memory or Redis, default memory
|
|
- Agent: sky-valley/pi Go agent runtime adapter, local desktop agent disabled
|
|
- Image storage: memory, MinIO, AWS S3, Cloudflare R2, Aliyun OSS
|
|
- Frontend: Next.js App Router, pnpm, Vite artifact build, TypeScript, gzip, i18n
|
|
- Deploy: local binary, Docker Compose, k3s manifests
|
|
|
|
## Run Locally
|
|
|
|
Backend:
|
|
|
|
```bash
|
|
cd server
|
|
go mod tidy
|
|
go run . -f etc/config.yaml
|
|
```
|
|
|
|
Frontend:
|
|
|
|
```bash
|
|
cd frontend
|
|
pnpm install
|
|
pnpm dev
|
|
```
|
|
|
|
Open `http://localhost:5173`. Next.js rewrites `/api` to `http://localhost:8888` in development. `pnpm build` runs `next build` and `vite build`, producing gzip assets in `frontend/dist`.
|
|
|
|
## CAD Import
|
|
|
|
The canvas asset picker and drag-and-drop surface accept DWG and DXF files up to 24 MB. Conversion runs locally in a browser worker, uploads a sanitized derived SVG, and leaves the source file unchanged. DXF supports ASCII and binary drawings; DWG supports AutoCAD R14 through AutoCAD 2018 format families.
|
|
|
|
## Cache Config
|
|
|
|
Default in-memory cache:
|
|
|
|
```yaml
|
|
Cache:
|
|
Driver: memory
|
|
TTLSeconds: 300
|
|
```
|
|
|
|
Redis cache:
|
|
|
|
```yaml
|
|
Cache:
|
|
Driver: redis
|
|
Addr: localhost:6379
|
|
Password: ""
|
|
DB: 0
|
|
TTLSeconds: 300
|
|
```
|
|
|
|
## Storage Config
|
|
|
|
Default memory storage is useful for local UI work:
|
|
|
|
```yaml
|
|
Storage:
|
|
Driver: memory
|
|
```
|
|
|
|
## Image Object Storage
|
|
|
|
Default memory mode is useful for local prototyping. Production can use MinIO, AWS S3, Cloudflare R2, or Aliyun OSS:
|
|
|
|
```yaml
|
|
ObjectStorage:
|
|
Driver: minio # memory|minio|s3|aws|r2|aliyun
|
|
Bucket: canvas-assets
|
|
Endpoint: localhost:9000
|
|
Region: us-east-1
|
|
AccessKey: canvas
|
|
SecretKey: canvas-secret
|
|
PublicBase: http://localhost:9000/canvas-assets
|
|
UseSSL: false
|
|
ExpiresIn: 900
|
|
```
|
|
|
|
PostgreSQL storage:
|
|
|
|
```yaml
|
|
Storage:
|
|
Driver: postgres
|
|
DataSource: postgres://canvas:canvas@localhost:5432/canvas?sslmode=disable
|
|
```
|
|
|
|
## Docker Compose
|
|
|
|
```bash
|
|
cd deploy
|
|
docker compose up --build
|
|
```
|
|
|
|
Open `http://localhost:3000`.
|
|
|
|
## k3s
|
|
|
|
Build and load/push these images first:
|
|
|
|
```bash
|
|
docker build -t img-infinite-canvas-api:latest server
|
|
docker build -t img-infinite-canvas-web:latest frontend
|
|
kubectl apply -f deploy/k3s/img-infinite-canvas.yaml
|
|
```
|
|
|
|
The sample ingress host is `canvas.local`.
|
|
|
|
## API
|
|
|
|
See [server/API.md](server/API.md).
|