Skip to content

Commit b783152

Browse files
authored
Live Examples: UI/UX improvements, detection fixes, and model progress updates
- Add warning below optimum zoom and dotted detections fix - Enhance GeoAI worker init with provider checks - Improve cursor styling, hover effects, and z-index to fix map tooltip overlap - Fix zoom level thresholds, ship detection design, and MapProviderSelector width - Add model loading progress to task pages - Redact backend URL from errors - Update README, examples, and live builds - Unhide back button and add mask-generation to "coming soon"
1 parent 92afe1c commit b783152

File tree

48 files changed

+2145
-152
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+2145
-152
lines changed

docs/pages/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Create a new React app and install the required dependencies:
4545
```bash
4646
npx create-react-app my-geoai-app --template typescript
4747
cd my-geoai-app
48-
npm install maplibre-gl geoai maplibre-gl-draw
48+
npm install maplibre-gl maplibre-gl-draw geoais
4949
```
5050

5151
#### Option B: Clone an Quickstart example

docs/pages/workers.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Create a new React app and install the required dependencies:
1717
```bash
1818
npx create-react-app my-geoai-app --template typescript
1919
cd my-geoai-app
20-
npm install maplibre-gl geoai maplibre-gl-draw
20+
npm install maplibre-gl maplibre-gl-draw geoais
2121
```
2222

2323
#### Option B: Clone an Quickstart example

examples/live-examples-nextjs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,4 @@ The easiest way to deploy your Next.js app is to use the [Vercel Platform](https
6161

6262
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
6363

64-
<!-- trigger a build ping -->
64+
<!-- trigger a build pong -->
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Network Speed Estimation & Model Loading Progress
2+
3+
This feature provides real-time network speed estimation and model loading progress tracking for AI model initialization across all tasks.
4+
5+
## Features
6+
7+
- **Network Speed Estimation**: Automatically measures network speed by downloading a small test file
8+
- **Model Loading Progress Simulation**: Shows estimated progress based on network speed and model size
9+
- **Real-time Updates**: Progress updates every 100ms during loading simulation
10+
- **Fallback Handling**: Uses fallback speed if network estimation fails
11+
12+
## Implementation
13+
14+
### NetworkSpeedEstimator Class
15+
16+
Located in `src/utils/networkUtils.ts`, this utility class provides:
17+
18+
- `estimateNetworkSpeed()`: Downloads a 1MB test file to measure network speed
19+
- `calculateModelDownloadInfo()`: Calculates estimated download time for a given model size
20+
- `simulateDownloadProgress()`: Simulates download progress over time
21+
22+
### useModelDownloadProgress Hook
23+
24+
A React hook that manages model loading progress state:
25+
26+
```typescript
27+
const {
28+
downloadInfo,
29+
isEstimating,
30+
progress,
31+
startDownloadSimulation,
32+
stopDownloadSimulation,
33+
} = useModelDownloadProgress(100); // 100MB model size
34+
```
35+
36+
### ModelDownloadProgress Component
37+
38+
A UI component that displays:
39+
- Model loading progress bar
40+
- Network speed information
41+
- Estimated time to load
42+
- Model size indicator
43+
44+
## Usage
45+
46+
The feature is automatically integrated into all task pages:
47+
48+
1. When a user first loads a page or changes map providers
49+
2. The system estimates network speed by downloading a 1MB test file
50+
3. Based on the estimated speed and known model size, it calculates loading time
51+
4. A progress bar shows estimated model loading progress
52+
5. Progress simulation stops when the AI model is actually initialized
53+
54+
## Configuration
55+
56+
- **Test File Size**: 1MB (configurable in `TEST_FILE_SIZE_BYTES`)
57+
- **Test File URL**: https://httpbin.org/bytes/1048576
58+
- **Fallback Speed**: 10 Mbps (if estimation fails)
59+
- **Update Interval**: 100ms for progress updates
60+
- **Model Sizes**: Varies by task (9.22MB to 104MB)
61+
62+
## Error Handling
63+
64+
- If network speed estimation fails, falls back to 10 Mbps
65+
- Gracefully handles network errors and timeouts
66+
- Minimum speed of 0.1 Mbps to prevent division by zero
67+
- Automatic cleanup of intervals on component unmount
68+
69+
## Future Enhancements
70+
71+
- More accurate progress tracking with actual model loading events
72+
- Caching of network speed estimates
73+
- Support for different network conditions (WiFi vs mobile)
74+
- Real-time model loading status from the AI pipeline

examples/live-examples-nextjs/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"build": "next build",
88
"start": "next start",
99
"lint": "next lint",
10+
"test": "vitest",
1011
"build:geoai": "cd ../../ && pnpm run build && cd examples/live-examples-nextjs && pnpm install",
1112
"build_dev": "pnpm build:geoai && pnpm dev"
1213
},
@@ -36,8 +37,10 @@
3637
"@types/react-dom": "^19",
3738
"eslint": "^9",
3839
"eslint-config-next": "15.3.2",
40+
"jsdom": "^26.1.0",
3941
"tailwindcss": "^4",
4042
"typescript": "^5",
43+
"vitest": "^3.2.4",
4144
"workerize-loader": "^2.0.2"
4245
}
4346
}

0 commit comments

Comments
 (0)