release: bump version to 0.50.0
This commit is contained in:
1 parent
e1984c7a35
commit
455b8360d0
80 files changed
+10936
-298
No files matched your search
@@ -25,6 +25,7 @@ What belongs here:
|
||||
|
||||
- [Quickstart](/home/ray/dev/linkong/planet/docs/technical/en/quickstart.md): The shortest path to getting Planet running from scratch
|
||||
- [Planet Manual](/home/ray/dev/linkong/planet/docs/technical/en/manual.md): Complete usage guide for the console, `planet.sh`, Earth, and Docs
|
||||
- [FAQ](/home/ray/dev/linkong/planet/docs/technical/en/faq.md): Central troubleshooting entry for Windows / WSL, ports, dependencies, motion capture, credentials, and Docs permissions
|
||||
- [Earth Location Candidate Collection User Guide](/home/ray/dev/linkong/planet/docs/technical/en/location-pipeline-user.md): Collect and preview coordinate candidates for compute centers and BGP collectors on Earth
|
||||
- [Collector Settings and Connectivity Validation](/home/ray/dev/linkong/planet/docs/technical/en/datasource-collector-settings-connectivity.md): Data source catalog, collector settings, connectivity validation, and BarentsWatch credentials
|
||||
- [Shared Location Resolution Pipeline Development Guide](/home/ray/dev/linkong/planet/docs/technical/en/location-pipeline-development.md): Backend location resolver / pipeline interfaces, registries, and extension points
|
||||
|
||||
@@ -23,11 +23,12 @@ The recommended default is:
|
||||
- business-level request shaping
|
||||
- stable `/api/v1/ai/...` endpoints
|
||||
- internal service-to-service authentication toward `aiprovider`
|
||||
- reading the default provider, model, and per-provider keys saved in Settings, then overriding `aiprovider` `.env` defaults through internal headers
|
||||
|
||||
`aiprovider` is responsible for:
|
||||
|
||||
- model protocol adaptation
|
||||
- provider selection by `.env`
|
||||
- provider selection by `.env` when no backend override headers are present
|
||||
- timeout and lightweight retry
|
||||
- request tracing via `X-Request-ID`
|
||||
|
||||
@@ -85,6 +86,18 @@ Optional tracing header:
|
||||
|
||||
The backend will propagate `X-Request-ID` to `aiprovider` and return the same header in the response.
|
||||
|
||||
### Settings API
|
||||
|
||||
The AI settings page uses:
|
||||
|
||||
- `GET /api/v1/settings/integrations`
|
||||
- `PUT /api/v1/settings/integrations`
|
||||
- `POST /api/v1/settings/integrations/ai-provider/connect`
|
||||
- `GET /api/v1/settings/integrations/ai-provider/secrets`
|
||||
- `GET /api/v1/settings/integrations/ai-provider/presets`
|
||||
|
||||
These endpoints require an authenticated user. The `secrets` endpoint is only used when the settings page reveals a key or token; hiding the field restores the masked preview.
|
||||
|
||||
### AI provider internal API
|
||||
|
||||
Internal-only endpoints:
|
||||
@@ -172,6 +185,75 @@ Both services also return:
|
||||
|
||||
## Configuration
|
||||
|
||||
### Runtime Configuration Flow
|
||||
|
||||
The backend Settings system owns the global LLM default. The runtime flow is:
|
||||
|
||||
1. Frontend or application code calls a `backend` `/api/v1/ai/...` endpoint.
|
||||
2. `backend` reads `category = external_integrations` from the PostgreSQL `system_settings` table.
|
||||
3. `payload.ai_provider.default_provider` selects the active provider.
|
||||
4. `payload.ai_provider.providers[provider]` supplies that provider's `api_key`, `provider_api`, `base_url`, `model`, `max_tokens`, and `anthropic_version`.
|
||||
5. `backend` converts those values to internal headers such as `X-AI-Provider`, `X-AI-Provider-API`, `X-AI-Base-URL`, `X-AI-API-Key`, and `X-AI-Model`.
|
||||
6. `aiprovider` uses those headers to override its `.env` defaults before calling the real model vendor.
|
||||
|
||||
After the AI settings page saves a new default provider/model/key, Playground, alert briefs, datasource mapping generation, and other backend AI calls all use that same default.
|
||||
|
||||
#### Persistence Shape
|
||||
|
||||
AI settings are persisted in PostgreSQL, not a JSON file. The core payload shape is:
|
||||
|
||||
```json
|
||||
{
|
||||
"ai_provider": {
|
||||
"service_url": "http://localhost:8010",
|
||||
"service_token": "",
|
||||
"default_provider": "openai",
|
||||
"providers": {
|
||||
"openai": {
|
||||
"provider_api": "openai-completions",
|
||||
"base_url": "https://api.openai.com/v1",
|
||||
"model": "gpt-5.1",
|
||||
"api_key": "<saved secret>",
|
||||
"max_tokens": 4096,
|
||||
"anthropic_version": "2023-06-01"
|
||||
},
|
||||
"minimax": {
|
||||
"provider_api": "anthropic-messages",
|
||||
"base_url": "https://api.minimaxi.com/anthropic",
|
||||
"model": "MiniMax-M2.7",
|
||||
"api_key": "<saved secret>",
|
||||
"max_tokens": 1200,
|
||||
"anthropic_version": "2023-06-01"
|
||||
}
|
||||
},
|
||||
"timeout_seconds": 60,
|
||||
"retry_attempts": 2
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Legacy single-slot settings are mapped to `providers[provider]` on read and are written back in the new shape on save.
|
||||
|
||||
#### Key Fallback
|
||||
|
||||
Each provider has its own key slot. Resolution order is:
|
||||
|
||||
1. `providers[provider].api_key` in PostgreSQL
|
||||
2. the provider-specific variable in `aiprovider/.env`, such as `OPENAI_API_KEY`, `MINIMAX_API_KEY`, or `ANTHROPIC_API_KEY`
|
||||
3. the generic `AI_API_KEY` in `aiprovider/.env`
|
||||
|
||||
`.env` is only a fallback. After the settings page saves successfully, or after the connection test succeeds, PostgreSQL becomes the global default source.
|
||||
|
||||
#### Settings Page Behavior
|
||||
|
||||
- The Provider select controls the global default provider.
|
||||
- The model select saves the default model for the selected provider.
|
||||
- The LLM API Key field shows a masked preview while hidden; keys with a `-` prefix keep the prefix, for example `sk-********`, and keys without a prefix are fully masked.
|
||||
- Clicking the eye icon fetches and displays the full plaintext value; hiding restores the masked preview.
|
||||
- `Save AI Configuration` saves the current form as the global default.
|
||||
- `Test Connection` uses the current form for a real model-chain test, then saves it as the global default only when the test succeeds.
|
||||
- Leaving a key field empty keeps the old key; it does not delete it.
|
||||
|
||||
### Backend
|
||||
|
||||
Recommended backend `.env`:
|
||||
@@ -208,6 +290,18 @@ AI_HTTP_RETRY_ATTEMPTS=2
|
||||
AI_ANALYSIS_SYSTEM_PROMPT=你是态势感知分析助手。请基于输入的上下文、观测与约束,输出结构化、克制、可执行的分析。
|
||||
```
|
||||
|
||||
Optional provider-specific keys:
|
||||
|
||||
```env
|
||||
MINIMAX_API_KEY=sk-cp-xxxxx
|
||||
OPENAI_API_KEY=sk-xxxxx
|
||||
ANTHROPIC_API_KEY=sk-ant-xxxxx
|
||||
DEEPSEEK_API_KEY=sk-xxxxx
|
||||
DASHSCOPE_API_KEY=sk-xxxxx
|
||||
MOONSHOT_API_KEY=sk-xxxxx
|
||||
OPENROUTER_API_KEY=sk-or-xxxxx
|
||||
```
|
||||
|
||||
### OpenAI-compatible example
|
||||
|
||||
```env
|
||||
|
||||
@@ -81,7 +81,26 @@ Responsibilities:
|
||||
- Status message
|
||||
- Tooltip / error / cleanup logic
|
||||
|
||||
### 5. Globe and Terrain
|
||||
### 5. Motion Capture Control Adapter
|
||||
|
||||
- [motion-control.js](/home/ray/dev/linkong/planet/frontend/public/earth/js/motion-control.js)
|
||||
|
||||
Responsibilities:
|
||||
|
||||
- Act as the Motion Provider manager for both `browser_camera` and `motion_agent`.
|
||||
- Use browser `getUserMedia` plus local MediaPipe recognition by default; advanced setups can connect to the local Motion Capture Agent WebSocket.
|
||||
- Handle browser camera permission/secure-context errors, plus Agent disconnects, reconnects, `status`, and `heartbeat` messages.
|
||||
- Filter low-confidence and overly repeated gesture events.
|
||||
- Map `rotate_left`, `rotate_right`, `rotate_up`, `rotate_down`, `zoom_in`, `zoom_out`, `focus_prev`, `focus_next`, `layer_prev`, `layer_next`, and `confirm` to the action entry points exposed by `main.js`.
|
||||
- Parse `skeleton` debug events and dispatch `earth:motion-debug-frame`.
|
||||
|
||||
Gesture recognition may run locally in the browser or inside the local Agent, but neither path sends realtime camera frames to the SaaS cloud. `main.js` exposes rotation, zoom, target focus, layer switching, and confirm entry points, plus a `window.__planetEarth.motion` debug entry. The adapter starts only when `?motion=1` is present, browser local storage contains `planet-earth-motion-control-enabled=true`, or Earth settings enable Motion Debug Mode.
|
||||
|
||||
[motion-debug-panel.js](/home/ray/dev/linkong/planet/frontend/public/earth/js/motion-debug-panel.js) owns the debug panel. It listens for `earth:motion-debug-frame` and draws normalized skeleton joints and bones on a canvas. The Browser Camera provider also emits `earth:motion-debug-video-source` with the local `<video>` element so the panel can show a local preview behind the skeleton; `shared.motionDebugSkeletonOnly` switches the panel back to skeleton-only rendering. `Stop Matching Gestures` dispatches `earth:motion-recognition-pause`, which suppresses gesture execution while video and skeleton drawing continue. Unmatched skeletons are red; matched gestures turn green and display the gesture name. Settings are persisted under `shared.motionDebugEnabled`, `shared.motionProvider`, and `shared.motionDebugSkeletonOnly` in `planet.earth.settings.v2`, and both the switch and provider selector reserve `data-gatekeeper-permission="earth.motion_debug"`.
|
||||
|
||||
[presentation-controller.js](/home/ray/dev/linkong/planet/frontend/public/earth/js/presentation-controller.js) is the new Presentation layer. In the first stage only Motion uses it: `motion-cruise-adapter.js` uses a persistent presentation that reuses the cruise fixed-card placement and connector, but mouse movement does not auto-hide the card. The connector recalculates source and target anchors every frame so dragged cards, globe rotation, and moving targets stay connected. BGP/News still use the existing `CruiseSequencer` auto-advance path to preserve the old cruise experience.
|
||||
|
||||
### 6. Globe and Terrain
|
||||
|
||||
- [earth.js](/home/ray/dev/linkong/planet/frontend/public/earth/js/earth.js)
|
||||
- [terrain.js](/home/ray/dev/linkong/planet/frontend/public/earth/js/terrain.js)
|
||||
@@ -92,7 +111,7 @@ Responsibilities:
|
||||
- Real terrain mesh
|
||||
- Terrain tile fetch, decode, displacement, and shading
|
||||
|
||||
### 6. Layer Modules
|
||||
### 7. Layer Modules
|
||||
|
||||
- [satellites.js](/home/ray/dev/linkong/planet/frontend/public/earth/js/satellites.js)
|
||||
- [cables.js](/home/ray/dev/linkong/planet/frontend/public/earth/js/cables.js)
|
||||
@@ -109,8 +128,12 @@ Each module is responsible for its own:
|
||||
- State tracking (loaded, visible, hover, locked)
|
||||
- Self-cleanup (dispose on scene destroy)
|
||||
|
||||
`tv.js` owns the live / aggregation-news tabs inside `media-panel`. Toolbar open and tab-switch actions write back through `earth:tv-visibility-change` and `earth:tv-tab-change`: panel visibility remains viewport-scoped at `views.<scope>.panelVisibility.media-panel`, while the active tab is stored at `shared.mediaPanelActiveTab`. Refreshing the page therefore restores the user's last live/news state. Temporary hides from `closeTransientMobileOverlays()` carry `persist:false` and do not overwrite the preference.
|
||||
|
||||
The compute-center layer row has a notification badge for GeoJSON `unresolved` records. The badge means "no trustworthy coordinates, cannot render on the globe"; it is different from the `?` marker drawn on already positioned but unconfirmed compute centers. Clicking the badge opens a fixed info card beside the layer panel. Row-level `采集` fetches candidates only. Header-level `一键采用` processes the queue top-to-bottom, saves the highest-confidence valid candidate, removes successful rows, renumbers the list, and dispatches `earth:compute-center-unresolved-count-change` so the badge updates immediately. When the batch ends, `earth:compute-center-location-saved` refreshes the real layer.
|
||||
|
||||
Location candidate state in the details card is cached in [info-card.js](/home/ray/dev/linkong/planet/frontend/public/earth/js/info-card.js) by `entityType:entityId`. If the user closes the details card or unresolved queue and reopens the same compute center / BGP collector, previously collected candidates and status text are restored. Header-level `一键采用` prefers cached candidates, avoiding repeated online geocoding or LLM factcheck calls. After a location is saved, that entity's candidate list is cleared to a "refreshing layer" status so stale candidates do not keep misleading the user.
|
||||
|
||||
### AIS Vessel Layer
|
||||
|
||||
The vessel layer fetches `/api/v1/visualization/geo/vessels` and renders the aggregated AIS GeoJSON through `createInteractableLayer()`. By default it does not send a `limit` parameter, and `VESSEL_CONFIG.maxRenderedMarkers = 0` means the frontend does not clip the result to 5000 vessels. A positive `options.limit` or positive `maxRenderedMarkers` can still be used as an explicit temporary cap.
|
||||
@@ -119,21 +142,21 @@ Vessel color and vessel type text must use the same normalized classification. `
|
||||
|
||||
AISStream `PositionReport` messages commonly carry live position and `MetaData.ShipName`, while vessel type usually comes from lower-frequency `ShipStaticData.Type`. The backend normalizes `MetaData.ShipName` into the vessel name and maps numeric type codes into Cargo / Tanker / Passenger / Fishing / Military where available. Missing type detail should wait for a static AIS message or the planned vessel profile enrichment; the frontend should not invent a more specific type.
|
||||
|
||||
### 7. HUD Panels and Search
|
||||
### 8. HUD Panels and Search
|
||||
|
||||
- [hud-panels.js](/home/ray/dev/linkong/planet/frontend/public/earth/js/hud-panels.js)
|
||||
- [info-card.js](/home/ray/dev/linkong/planet/frontend/public/earth/js/info-card.js)
|
||||
- [search.js](/home/ray/dev/linkong/planet/frontend/public/earth/js/search.js)
|
||||
- [legend.js](/home/ray/dev/linkong/planet/frontend/public/earth/js/legend.js)
|
||||
|
||||
### 8. Cruise Mode
|
||||
### 9. Cruise Mode
|
||||
|
||||
- [cruise-sequencer.js](/home/ray/dev/linkong/planet/frontend/public/earth/js/cruise-sequencer.js)
|
||||
- [callout-connector.js](/home/ray/dev/linkong/planet/frontend/public/earth/js/callout-connector.js)
|
||||
|
||||
The cruise sequencer handles generic logic: current target, queue order, camera focus, and dwell / hide / switch. Business modules supply target queues and content — they should not contain camera control logic.
|
||||
|
||||
### 9. Constants
|
||||
### 10. Constants
|
||||
|
||||
- [constants.js](/home/ray/dev/linkong/planet/frontend/public/earth/js/constants.js)
|
||||
|
||||
|
||||
@@ -0,0 +1,306 @@
|
||||
# FAQ
|
||||
|
||||
This page collects common troubleshooting paths for local startup, Windows / WSL, dependencies, motion capture, credentials, and Docs permissions. Deeper background stays in the topic-specific docs; this page focuses on what to check first and which command to run.
|
||||
|
||||
## Startup and Ports
|
||||
|
||||
### What should I do when the backend port is already in use?
|
||||
|
||||
The error usually looks like:
|
||||
|
||||
```text
|
||||
Backend address is already in use: 0.0.0.0:8000 / 127.0.0.1:8000 / [::1]:8000
|
||||
Address already in use
|
||||
```
|
||||
|
||||
First try:
|
||||
|
||||
```bash
|
||||
./planet.sh restart -b
|
||||
```
|
||||
|
||||
If the port remains occupied, start on a different backend port:
|
||||
|
||||
```bash
|
||||
./planet.sh start -b 8001
|
||||
```
|
||||
|
||||
In WSL, the listener may be on the Windows side rather than a Linux process. A common diagnostic line looks like:
|
||||
|
||||
```text
|
||||
Windows listener: 0.0.0.0:8000 pid=4700 process=svchost.exe services=iphlpsvc
|
||||
```
|
||||
|
||||
`iphlpsvc` is the Windows IP Helper service. It often hosts IPv6, tunneling, proxying, port forwarding, WSL, or developer-tool networking features. Do not start by killing that `svchost.exe`; first check whether an old portproxy rule owns the port.
|
||||
|
||||
From Administrator PowerShell, inspect portproxy rules:
|
||||
|
||||
```powershell
|
||||
netsh interface portproxy show all
|
||||
```
|
||||
|
||||
If you see `0.0.0.0:8000` or `listenport=8000`, delete that rule:
|
||||
|
||||
```powershell
|
||||
netsh interface portproxy delete v4tov4 listenaddress=0.0.0.0 listenport=8000
|
||||
```
|
||||
|
||||
If there is no portproxy rule, confirm which services are hosted by that PID:
|
||||
|
||||
```powershell
|
||||
netstat -ano | findstr :8000
|
||||
tasklist /svc /fi "PID eq 4700"
|
||||
```
|
||||
|
||||
For temporary troubleshooting, you can stop IP Helper from Administrator PowerShell:
|
||||
|
||||
```powershell
|
||||
Stop-Service iphlpsvc
|
||||
```
|
||||
|
||||
This may affect networking, proxying, or forwarding features. Do not disable it long-term unless you know why it is safe. If the Windows forwarding rule must stay, use a different Planet backend port.
|
||||
|
||||
If the script prints `failed-stop-service` or `failed-stop-process`, the current shell does not have permission to clear the Windows listener. Startup stops immediately instead of launching the backend into the same port conflict.
|
||||
|
||||
### Which startup flags change default ports?
|
||||
|
||||
| Service | Default port | Flag |
|
||||
| --- | --- | --- |
|
||||
| Frontend | `3000` | `-f <port>` |
|
||||
| Backend | `8000` | `-b <port>` |
|
||||
| AI Provider | `8010` | `-a <port>` |
|
||||
| Motion Agent | `8765` | `--motion-agent-port <port>` |
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
./planet.sh start -f 3001 -b 8001 -a 8101
|
||||
```
|
||||
|
||||
## Windows / WSL / LAN
|
||||
|
||||
### LAN access does not work on Windows / WSL. What should I check?
|
||||
|
||||
Check in this order before changing firewall rules:
|
||||
|
||||
```bash
|
||||
# In WSL or the shell running Planet
|
||||
curl http://localhost:3000
|
||||
curl http://localhost:8000/health
|
||||
```
|
||||
|
||||
Then verify from Windows PowerShell:
|
||||
|
||||
```powershell
|
||||
curl http://localhost:3000
|
||||
curl http://localhost:8000/health
|
||||
```
|
||||
|
||||
If both localhost checks pass but a phone or another computer cannot connect, start with LAN enabled:
|
||||
|
||||
```bash
|
||||
./planet.sh start --allow-lan
|
||||
```
|
||||
|
||||
Then configure portproxy and firewall from Administrator PowerShell:
|
||||
|
||||
```powershell
|
||||
netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=3000 connectaddress=127.0.0.1 connectport=3000
|
||||
netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=8000 connectaddress=127.0.0.1 connectport=8000
|
||||
New-NetFirewallRule -DisplayName "WSL Planet 3000" -Direction Inbound -Action Allow -Protocol TCP -LocalPort 3000
|
||||
New-NetFirewallRule -DisplayName "WSL Planet 8000" -Direction Inbound -Action Allow -Protocol TCP -LocalPort 8000
|
||||
```
|
||||
|
||||
LAN devices should open the Windows LAN IP, for example `http://<Windows LAN IP>:3000/earth`, not the internal WSL IP.
|
||||
|
||||
### How do `--allow-lan` and the Motion Agent LAN URL fit together?
|
||||
|
||||
`--allow-lan` binds the frontend, backend, and optional Motion Agent to `0.0.0.0`. If a remote browser needs to connect to the display machine's Motion Agent, pass the Agent URL explicitly:
|
||||
|
||||
```text
|
||||
http://<LAN_IP>:3000/earth?motion=1&motionProvider=agent&motionAgent=ws://<LAN_IP>:8765/ws/gestures
|
||||
```
|
||||
|
||||
Browser Camera mode does not need a `motionAgent` URL.
|
||||
|
||||
## Dependencies and Environment Variables
|
||||
|
||||
### Why should I use `uv` instead of `pip`?
|
||||
|
||||
Planet manages Python dependencies through `uv` and `pyproject.toml`. Avoid `pip install` in the project environment, because it can diverge from the lock file and startup scripts.
|
||||
|
||||
For Motion Agent live dependencies, use:
|
||||
|
||||
```bash
|
||||
uv add mediapipe opencv-python
|
||||
```
|
||||
|
||||
`planet.sh start --motion-agent` checks and installs those live dependencies automatically. To disable auto-install:
|
||||
|
||||
```bash
|
||||
PLANET_MOTION_AGENT_AUTO_INSTALL=0 ./planet.sh start --motion-agent
|
||||
```
|
||||
|
||||
### Why should I use `bun` instead of `npm run`?
|
||||
|
||||
The frontend runtime is Bun. This avoids WSL / Windows mixed-path issues that can happen when npm invokes `cmd.exe`.
|
||||
|
||||
Common commands:
|
||||
|
||||
```bash
|
||||
bun install
|
||||
bun run dev
|
||||
bun run build
|
||||
```
|
||||
|
||||
If a non-interactive shell cannot find `bun`, `planet.sh` searches the current PATH, `~/.bun/bin`, zsh config, and PowerShell command resolution.
|
||||
|
||||
### When does `planet.sh` read environment variables from `.zshrc`?
|
||||
|
||||
By default, `planet.sh` statically parses simple lines in `~/.zshrc`:
|
||||
|
||||
```bash
|
||||
export KEY=value
|
||||
KEY=value
|
||||
```
|
||||
|
||||
This avoids slow shell themes, plugins, and interactive initialization. For complex shell expansion, opt in to source mode:
|
||||
|
||||
```bash
|
||||
PLANET_LOAD_ZSHRC_ENV=source ./planet.sh start -a
|
||||
```
|
||||
|
||||
To ignore `~/.zshrc` while troubleshooting:
|
||||
|
||||
```bash
|
||||
PLANET_LOAD_ZSHRC_ENV=0 ./planet.sh start -a
|
||||
```
|
||||
|
||||
Never put real secret values in docs or commits; documentation should only mention variable names and purposes.
|
||||
|
||||
## Motion Capture / Cameras
|
||||
|
||||
### Does Browser Camera mode need the `motionAgent` parameter?
|
||||
|
||||
No. Browser Camera mode uses webpage `getUserMedia` and runs recognition locally in the browser.
|
||||
|
||||
Recommended URL:
|
||||
|
||||
```text
|
||||
/earth?motion=1&motionProvider=browser
|
||||
```
|
||||
|
||||
You can also open Earth settings, enable Motion Debug Mode, and select Browser Camera as the input source. The page must run on HTTPS or localhost, and the user must grant browser camera permission.
|
||||
|
||||
### When do I need Motion Agent?
|
||||
|
||||
Use Motion Agent for:
|
||||
|
||||
- dual USB cameras
|
||||
- RTSP / HTTP camera streams
|
||||
- edge devices or client integration
|
||||
- a standalone local recognition service
|
||||
|
||||
Common commands:
|
||||
|
||||
```bash
|
||||
./planet.sh start --motion-agent
|
||||
./planet.sh start --motion-agent --motion-agent-camera-indexes 0,1
|
||||
./planet.sh start --motion-agent --motion-agent-camera-urls rtsp://example/live
|
||||
./planet.sh start --motion-agent --motion-agent-dry-run
|
||||
```
|
||||
|
||||
`--motion-agent-dry-run` is only for protocol and frontend connection testing; it does not open cameras.
|
||||
|
||||
### Why does WSL not find my camera?
|
||||
|
||||
Windows cameras usually do not appear inside WSL as `/dev/video*`. Check first:
|
||||
|
||||
```bash
|
||||
ls /dev/video*
|
||||
```
|
||||
|
||||
If no device appears, use Browser Camera for ordinary web demos. For Agent live mode, use an RTSP / HTTP camera URL:
|
||||
|
||||
```bash
|
||||
./planet.sh start --motion-agent --motion-agent-camera-urls http://192.168.1.20:8080/video
|
||||
```
|
||||
|
||||
USB passthrough into WSL is an advanced path. The script does not silently downgrade missing-camera live mode to dry-run.
|
||||
|
||||
## Docker / AI Provider
|
||||
|
||||
### Why does changing the AI key, base URL, or model not rebuild the image?
|
||||
|
||||
Keys, base URLs, and model names are runtime configuration. They do not require a Docker image rebuild. Restart AI Provider:
|
||||
|
||||
```bash
|
||||
./planet.sh restart -a
|
||||
```
|
||||
|
||||
The first Docker build may be slow because of image layers or `uv sync` dependency downloads. Later builds reuse `.dockerignore`, BuildKit, and uv cache.
|
||||
|
||||
### What should I do when Docker health checks fail?
|
||||
|
||||
Start with:
|
||||
|
||||
```bash
|
||||
./planet.sh health
|
||||
```
|
||||
|
||||
Then inspect logs:
|
||||
|
||||
```bash
|
||||
./planet.sh log
|
||||
```
|
||||
|
||||
If only AI Provider is unhealthy, restart just that service:
|
||||
|
||||
```bash
|
||||
./planet.sh restart -a
|
||||
```
|
||||
|
||||
## Datasource and Collector Credentials
|
||||
|
||||
### Connectivity validation passes, but collection cannot read credentials. Why?
|
||||
|
||||
Connectivity validation can read saved console settings, environment variables, and some credentials from `~/.zshrc`. For actual collection, prefer saving credentials in Settings -> Collector Settings, especially for AISStream's long-lived WebSocket collector.
|
||||
|
||||
If `AISSTREAM_API_KEY` only lives in `~/.zshrc`, confirm the backend process actually inherited it. Otherwise validation may pass while the collector runtime has no key.
|
||||
|
||||
### Where should BarentsWatch / AISStream credentials live?
|
||||
|
||||
For temporary debugging, environment variables or `~/.zshrc` are fine:
|
||||
|
||||
```bash
|
||||
export AISSTREAM_API_KEY="..."
|
||||
export BARENTSWATCH_CLIENT_ID="..."
|
||||
export BARENTSWATCH_CLIENT_SECRET="..."
|
||||
```
|
||||
|
||||
For stable operation, save credentials in Collector Settings so connectivity validation, collection jobs, and Earth realtime aggregation use the same configuration.
|
||||
|
||||
## Docs / Permissions
|
||||
|
||||
### Why can I not see some Docs pages?
|
||||
|
||||
Docs visibility is controlled by Gatekeeper groups:
|
||||
|
||||
- Quickstart, Manual, FAQ, and other basic docs are public.
|
||||
- Development docs usually require `docs_developer`.
|
||||
- Operations and service-control docs usually require `docs_admin`.
|
||||
- `admin` and `super_admin` have Docs access by default; ordinary users need groups assigned from the Users page.
|
||||
|
||||
## Earth Common Tasks
|
||||
|
||||
### Why did collecting a location candidate not write anything?
|
||||
|
||||
Collecting and saving are two separate actions. Candidates can be previewed on Earth first. A candidate is written only after clicking Save or using the unresolved list's one-click adopt flow.
|
||||
|
||||
Compute-center saves write to `compute_center_locations` and refresh the layer. Records with no candidate stay in the unresolved list; Planet does not fabricate a location from a country center or hard-coded hint.
|
||||
|
||||
### Why does Motion Debug not show camera video?
|
||||
|
||||
With the Browser Camera source, the debug panel shows the local browser camera preview and draws the skeleton over it. If `Skeleton Only` is enabled, the video preview is hidden and the panel keeps only the dark canvas plus red/green skeleton.
|
||||
|
||||
With the Motion Agent source, the Agent WebSocket sends normalized joints, bones, and matched gestures only. It does not stream raw camera frames to Earth, which keeps privacy risk, bandwidth, and latency lower. In that mode the panel is a skeleton debug view rather than a video stream.
|
||||
@@ -61,6 +61,9 @@ class LocationResolver(Protocol):
|
||||
| `RegistryResolver` | `resolvers/registry.py` | Legacy generic resolver; current compute-center and BGP runtime paths do not use it to generate candidates |
|
||||
| `NominatimResolver` | `resolvers/nominatim.py` | Runs a domain query plan against Nominatim with LRU cache and rate limiting |
|
||||
| `InheritFromAnotherEntityResolver` | `resolvers/inherit.py` | Wraps an externally resolved entity location as a candidate |
|
||||
| `LocationLLMFallback` | `location/llm_fallback.py` | Generates a confirmation-required candidate through the current default AI Provider when user-triggered collection has no regular candidates |
|
||||
|
||||
Nominatim is the geocoding service in the OpenStreetMap ecosystem. Given a place name, city, country, organization, or facility query, it returns possible coordinates, a display name, and structured address fields. It is useful for turning city/facility text into candidate coordinates, but it is not an authoritative fact registry and can match same-name places or broad administrative areas. Planet therefore treats Nominatim output as confirmation-required candidates and uses it with caching and rate limiting.
|
||||
|
||||
`RegistryResolver` remains available for future controlled import scenarios, but it should not be reconnected as a hard-coded hint source for compute centers or BGP. Matching common fields such as `operator` or `city` was the main reason multiple entities could collapse onto the same point.
|
||||
|
||||
@@ -81,7 +84,7 @@ StoredComputeCenterLocationResolver()
|
||||
|
||||
The main map startup path is source coordinates first, then the database-backed current-location table. The table is `compute_center_locations`, keyed by `(source, source_id)`, and stores manually accepted locations or true coordinates migrated from source records. `init_db()` only migrates source records that already contain real coordinates; it does not import old hard-coded hints and does not run ROR, Nominatim, or LLM geocoding during startup.
|
||||
|
||||
Candidate collection is intentionally separate from rendering. `collect_location_candidates()` builds ROR and Nominatim/OpenStreetMap queries from source fields, but it does not emit the current `compute_center_locations` row as a candidate. After a user accepts a candidate, the save endpoint upserts it into the dimension table; the next map refresh renders it through `StoredComputeCenterLocationResolver`.
|
||||
Candidate collection is intentionally separate from rendering. `collect_location_candidates()` builds ROR and Nominatim/OpenStreetMap queries from source fields, but it does not emit the current `compute_center_locations` row as a candidate. If those regular candidates are empty, the API layer calls `LocationLLMFallback` through the current default AI Provider and only returns `source="llm_location_factcheck"` candidates with `needs_confirmation=true`. LLM candidates use a combined threshold made from the model self-score plus backend evidence scoring; when the LLM provides a credible city/country but no coordinates, the backend may fill city-level coordinates through Nominatim without increasing the evidence score. After a user accepts a candidate, the save endpoint upserts it into the dimension table; the next map refresh renders it through `StoredComputeCenterLocationResolver`.
|
||||
|
||||
`resolve_compute_center_location()`, `resolve_compute_center_location_full()`, and `collect_location_candidates()` remain the domain API. `visualization.py` consumes that API and no longer owns coordinate hints, country-centroid fallbacks, or Nominatim details.
|
||||
|
||||
@@ -102,7 +105,7 @@ StoredCollectorLocationResolver()
|
||||
NominatimResolver(_bgp_collector_query_plan)
|
||||
```
|
||||
|
||||
The 23 RIPE RIS collector coordinates moved from the old table into the `bgp_collector_locations` dimension table with `source=legacy_seed` and `needs_confirmation=true`. The legacy dictionary is still maintained from the DB-backed cache for compatibility; manual candidate collection uses stored site/city/country as context but does not emit stored rows as candidates.
|
||||
The 23 RIPE RIS collector coordinates moved from the old table into the `bgp_collector_locations` dimension table with `source=legacy_seed` and `needs_confirmation=true`. The legacy dictionary is still maintained from the DB-backed cache for compatibility; manual candidate collection uses stored site/city/country as context but does not emit stored rows as candidates. If Nominatim cannot produce a city-level candidate, the collection endpoint uses the current default AI Provider as an LLM factcheck fallback and returns a confirmation-required candidate instead of saving automatically.
|
||||
|
||||
### BGP Events
|
||||
|
||||
@@ -139,6 +142,26 @@ Both `collect-location` endpoints return the same envelope:
|
||||
}
|
||||
```
|
||||
|
||||
The LLM fallback only runs inside user-triggered `collect-location` requests, and only after regular candidates are empty. It does not run during `/geo/compute-centers` startup rendering, scheduled collection, or batch persistence, and it never writes directly to `compute_center_locations` or `bgp_collector_locations`. Internally it is no longer a single "strict JSON or fail" step. It first asks the LLM to factcheck the location; if the answer is not JSON, it makes a second normalization request that may only extract facts from the original text; if that still fails, it conservatively extracts a city/country pair from the prose. The backend then performs coordinate filling, combined scoring, and candidate creation through one shared path.
|
||||
|
||||
This lets an answer such as "DeepL Mercury is in Falun, Sweden" become a city-level candidate after backend Nominatim coordinate filling, and lets a prose first answer be normalized into JSON on the second pass. Regardless of the path, only `precise`, `site`, or `city` precision with non-zero coordinates and a sufficient combined score is converted to a candidate. Failed, low-score, country-only, or cityless responses stay as diagnostics.
|
||||
|
||||
The LLM-provided `confidence` is only the model's self-score. The backend recomputes a combined score and uses that value as the candidate `confidence`:
|
||||
|
||||
```text
|
||||
combined =
|
||||
0.25 * model_confidence
|
||||
+ source_quality
|
||||
+ entity_match
|
||||
+ geography_match
|
||||
+ precision_quality
|
||||
+ name_location_hint
|
||||
- conflict_penalty
|
||||
- weak_evidence_penalty
|
||||
```
|
||||
|
||||
Current component caps: authoritative/government/academic evidence can add up to `0.35`, reputable databases or news up to `0.25`, generic web evidence up to `0.15`; evidence that clearly names the queried entity can add `0.25`; city+country geography match adds `0.20`, country-only match adds `0.05`; precision adds `precise=0.15`, `site=0.12`, or `city=0.08`; `name_location_hint` adds signal when the entity name and candidate city overlap, such as `TAIPEI-1` and `Taipei`; explicit conflicts can subtract up to `0.45`; weak-evidence wording can subtract up to `0.30`, capped at `0.15` when entity and city/country match and no conflict is present. Candidates below `0.55` are rejected. This lets cases such as Alem.Cloud and TAIPEI-1 recover from a low model self-score when entity and city evidence align, while genuinely weak or conflicting evidence still fails.
|
||||
|
||||
`POST /api/v1/visualization/compute-centers/{source_id}/location` upserts the candidate selected by the frontend into `compute_center_locations`. Manual saves default to `needs_confirmation=false`, `verification_status="verified"`, and a `verified_at` timestamp. Future automated staging can pass `needs_confirmation=true` explicitly.
|
||||
|
||||
The frontend [info-card.js](/home/ray/dev/linkong/planet/frontend/public/earth/js/info-card.js) renders the shared candidate list and preview events. The compute-center layer button shows an `unresolved` badge; clicking it opens the unresolved queue. Row-level `采集` only fetches candidates. Header-level `一键采用` walks the queue top-to-bottom, picks the highest-confidence candidate with valid coordinates, saves it, removes the row, renumbers the list, and dispatches `earth:compute-center-unresolved-count-change` so the badge updates immediately. When the batch finishes, `earth:compute-center-location-saved` refreshes the real layer.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Earth Location Candidate Collection User Guide
|
||||
|
||||
Location candidate collection helps fill or verify coordinates for compute centers and BGP collectors on Earth. Users do not type coordinates by hand; the backend ranks source coordinates, open organization-registry results, and online geocoding results into a previewable candidate list.
|
||||
Location candidate collection helps fill or verify coordinates for compute centers and BGP collectors on Earth. Users do not type coordinates by hand; the backend ranks source coordinates, open organization-registry results, online geocoding results, and, when needed, LLM factcheck fallback results into a previewable candidate list.
|
||||
|
||||
## Supported Entities
|
||||
|
||||
@@ -18,13 +18,15 @@ Clicking a compute center or BGP collector on Earth opens a detail card with loc
|
||||
| Field | Meaning |
|
||||
| --- | --- |
|
||||
| Location precision | Precise coordinates, site-level, city-level, or unconfirmed |
|
||||
| Location source | Source coordinates, ROR organization registry, Nominatim online search, or stored BGP collector locations |
|
||||
| Location source | Source coordinates, ROR organization registry, Nominatim online search, LLM factcheck fallback, or stored BGP collector locations |
|
||||
| Location confidence | Relative confidence reported by the backend resolver |
|
||||
| Verification status | Confirmed, estimated, or online result pending confirmation |
|
||||
| Resolution reason | Why the location was selected |
|
||||
| Matched location name | Canonical name from an open source, online result, or stored collector location |
|
||||
| Verified at | Verification date for confirmed locations; online candidates are usually empty |
|
||||
|
||||
Nominatim here means the online geocoding service from the OpenStreetMap ecosystem. It converts place names, cities, countries, organizations, or campus/facility queries into possible coordinate candidates, but it can match same-name places or broad administrative areas. The UI therefore treats these results as pending confirmation.
|
||||
|
||||
Compute-center GeoJSON no longer renders country centroids, unknown locations, or `[0, 0]` placeholders. Records that cannot reach city-level precision are returned in the endpoint's `unresolved` list and can be improved through candidate collection.
|
||||
|
||||
A compute center with a `?` marker on Earth is not unresolved. It already has coordinates, but the coordinates still need confirmation, either because `needs_confirmation=true` or because the source is online geocoding. Truly unresolved records have no trustworthy coordinates and are therefore absent from the globe.
|
||||
@@ -82,7 +84,7 @@ Both `collect-location` endpoints use the same response shape:
|
||||
}
|
||||
```
|
||||
|
||||
When no candidate reaches city-level precision, `success` is `false` and the response includes `failure_reason` plus the attempted queries. This helps distinguish missing source fields, open-source gaps, and online geocoding misses.
|
||||
When regular candidates are empty, the endpoint asks the current default AI Provider for one LLM factcheck fallback. LLM candidates always require human confirmation and are never saved automatically; only strict JSON results with city-or-better precision, non-zero coordinates, and sufficient confidence appear in the candidate list. When no candidate reaches city-level precision, `success` is `false` and the response includes `failure_reason`, `llm_failure_reason`, and attempted queries. This helps distinguish missing source fields, open-source gaps, online geocoding misses, and unusable LLM responses.
|
||||
|
||||
## Registry Maintenance
|
||||
|
||||
@@ -122,6 +124,10 @@ Earth only renders coordinates that reach city-level precision or better. If sou
|
||||
|
||||
Nominatim/OpenStreetMap results may match same-name cities, organizations, or campuses. They are useful for previewing candidates, but should be manually confirmed before being persisted as verified locations.
|
||||
|
||||
### Can the LLM fallback change the map directly?
|
||||
|
||||
No. The LLM runs only after a user clicks candidate collection and regular sources have no candidates. It returns confirmation-required candidates only. Earth startup GeoJSON, scheduled collection, and batch rendering do not call the LLM automatically; a location affects future rendering only after a user saves the candidate into the dimension table.
|
||||
|
||||
### Why do BGP events no longer all land in Amsterdam?
|
||||
|
||||
The old behavior could match common fields like `operator="RIPE NCC"` and incorrectly promote `rrc00`. BGP event inheritance now uses a strict owning-collector lookup in the DB-backed cache instead of registry fuzzy matching.
|
||||
@@ -7,7 +7,7 @@ This manual is for daily use, demos, development integration, and local operatio
|
||||
- Console: admin backend (login required)
|
||||
- Docs: backend Gatekeeper-controlled documentation; basic usage docs are public, while developer and operations docs require permission groups
|
||||
|
||||
For the shortest path to getting started, see [Quickstart](/home/ray/dev/linkong/planet/docs/technical/en/quickstart.md).
|
||||
For the shortest path to getting started, see [Quickstart](/home/ray/dev/linkong/planet/docs/technical/en/quickstart.md). For common troubleshooting, see the [FAQ](/home/ray/dev/linkong/planet/docs/technical/en/faq.md).
|
||||
|
||||
## Entry Overview
|
||||
|
||||
@@ -17,6 +17,7 @@ After a default startup, the common URLs are:
|
||||
| --- | --- | --- | --- |
|
||||
| Earth | `http://localhost:3000/earth` | No | 3D globe, layers, BGP, satellites, cables, news situational awareness |
|
||||
| Docs | `http://localhost:3000/docs` | Partly | Usage docs are public; developer, backend, and operations docs require Gatekeeper groups |
|
||||
| FAQ | `http://localhost:3000/docs/faq` | No | Windows / WSL, ports, dependencies, motion capture, credentials, and permission troubleshooting |
|
||||
| Console | `http://localhost:3000/admin` | Yes | Data, config, alerts, logs, and situational observation |
|
||||
| AI Playground | `http://localhost:3000/playground` | Yes | AI Provider status and debugging |
|
||||
| Backend API Docs | `http://localhost:8000/docs` | Depends on endpoint | FastAPI / OpenAPI documentation |
|
||||
@@ -280,7 +281,7 @@ Search results can be used to quickly locate objects and open their details.
|
||||
|
||||
### Location Candidate Collection
|
||||
|
||||
Compute-center and BGP collector detail cards can collect candidate coordinates automatically. After clicking an object, use `自动采集坐标候选` or `重新自动采集坐标`; the backend ranks source coordinates, open organization lookups, and Nominatim online search results. Stored BGP collector locations are used as query context only and are not emitted as candidates.
|
||||
Compute-center and BGP collector detail cards can collect candidate coordinates automatically. After clicking an object, use `自动采集坐标候选` or `重新自动采集坐标`; the backend ranks source coordinates, open organization lookups, and Nominatim online search results. If those regular sources return no candidates, the current default AI Provider is used once as an LLM factcheck fallback. Stored BGP collector locations are used as query context only and are not emitted as candidates.
|
||||
|
||||
Candidates can be previewed directly on Earth. Compute-center candidates can be saved into the `compute_center_locations` dimension table from the detail card, then the layer refreshes immediately. The notification badge on the compute-center layer row shows unresolved records that cannot be rendered; clicking it opens the queue, where users can collect individual candidates or use `一键采用` to save the highest-confidence candidate top-to-bottom. Records without candidates stay in the queue and are not replaced by country centroids or hard-coded hints. See [Earth Location Candidate Collection User Guide](/home/ray/dev/linkong/planet/docs/technical/en/location-pipeline-user.md) for the full workflow.
|
||||
|
||||
@@ -288,11 +289,10 @@ Candidates can be previewed directly on Earth. Compute-center candidates can be
|
||||
|
||||
The settings panel contains:
|
||||
|
||||
- Rotation mode / cruise mode
|
||||
- Cruise modules: BGP, News
|
||||
- Satellite display style: self-glow, real ground footprint
|
||||
- Day/night mode
|
||||
- Panel visibility toggles
|
||||
- Rotation mode / cruise mode / motion mode
|
||||
- Cruise modules: BGP, News, Compute Centers, Vessels, Cables, Satellites
|
||||
- View settings: satellite display style, day/night mode, panel visibility
|
||||
- Motion Debug Mode, Motion Input Source, skeleton-only debug view
|
||||
- Globe default size
|
||||
- Terrain opacity
|
||||
- Reset settings
|
||||
@@ -318,6 +318,30 @@ When zooming, the top capsule briefly shows the current zoom level, for example
|
||||
|
||||
Drag sensitivity adjusts automatically based on the current zoom. Around the default view it keeps the normal rotation feel; when zoomed in, dragging becomes progressively finer for inspecting a region, vessel, satellite, or BGP event; when zoomed out, dragging is slightly faster for global browsing.
|
||||
|
||||
### Motion Capture Controls
|
||||
|
||||
Earth has a motion-capture control entry point for large-screen and future 3D displays. There are two realtime input sources: the default `Browser Camera` source uses webpage `getUserMedia` and recognizes gestures locally in the browser; the advanced `Motion Agent` source uses `camera/RTSP/HTTP -> local Agent -> local WebSocket -> Earth page`. Neither path sends camera frames or realtime gesture decisions to the cloud, and neither path reuses the news/RSS aggregation APIs.
|
||||
|
||||
It is disabled by default. Enable `Motion Debug Mode` in settings, open Earth with `?motion=1`, or set `planet-earth-motion-control-enabled=true` in browser local storage to start the selected source. The default source is `Browser Camera`; it requires HTTPS or localhost and a granted browser camera permission, but does not require installing an app. For dual cameras, USB indexes, phone/network camera streams, client integration, or edge devices, switch the setting to `Motion Agent`. The default Agent URL is `ws://127.0.0.1:8765/ws/gestures`; the `motionAgent` URL parameter can override it.
|
||||
|
||||
URL parameters can also force the source: `?motion=1&motionProvider=browser` uses the browser camera, `?motion=1&motionProvider=agent` uses Motion Agent, and providing `motionAgent=ws://...` automatically selects Motion Agent.
|
||||
|
||||
Current gesture semantics:
|
||||
|
||||
| Gesture event | Result |
|
||||
| --- | --- |
|
||||
| `rotate_left` | Rotates the globe left |
|
||||
| `rotate_right` | Rotates the globe right |
|
||||
| `rotate_up` | Rotates the globe upward |
|
||||
| `rotate_down` | Rotates the globe downward |
|
||||
| `zoom_in` | Zooms in |
|
||||
| `zoom_out` | Zooms out |
|
||||
| `focus_prev` / `focus_next` | Switches targets within the current motion layer |
|
||||
| `layer_prev` / `layer_next` | Switches the motion candidate layer and cruises to the nearest target in that layer |
|
||||
| `confirm` | Confirms the currently selected target; browser recognition currently keeps the two-hands-up confirm gesture disabled |
|
||||
|
||||
The settings panel also includes `Motion Debug Mode`, which opens the debug panel. With the Browser Camera source, the panel shows a local live preview and draws joints and bones over it. With the Motion Agent source, the Agent sends normalized skeleton events only and does not send raw video frames. The `Skeleton Only` switch hides the video preview and keeps the dark canvas plus skeleton; `Stop Matching Gestures` pauses gesture execution while preview and skeleton drawing can continue for debugging. Unmatched skeletons are red; once a gesture matches, the skeleton turns green and the matched gesture name is shown. Both this entry and the `Motion Input Source` control already carry Gatekeeper permission markers for future authorization control.
|
||||
|
||||
### Cruise Mode
|
||||
|
||||
Cruise mode makes Earth automatically cycle through focus targets.
|
||||
@@ -326,6 +350,10 @@ Current cruise modules:
|
||||
|
||||
- BGP
|
||||
- News
|
||||
- Compute Centers
|
||||
- Vessels
|
||||
- Cables
|
||||
- Satellites
|
||||
|
||||
Suitable for demos, monitoring displays, or unattended presentations.
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@ Frontend startup now has an additional pre-start cleanup retry layer:
|
||||
- `PORT_PRESTART_RETRIES`: defaults to 3 attempts.
|
||||
- `PORT_PRESTART_RETRY_INTERVAL`: defaults to 2 seconds.
|
||||
|
||||
`kill_port_if_requested()` only kills processes when the current environment can identify listening PIDs. If no PID is visible but the port still cannot bind, it logs diagnostics and lets the service startup flow make the final decision. `start_frontend_with_retry()` only enters the pre-cleanup retry path when a listener PID is visible, so the script no longer spends its retry budget repeatedly killing nothing while a host-side or external network namespace is still releasing the port. Seeing "no listener found but port still unavailable" on the first restart usually means the external environment is still releasing the port, not that a local process cleanup loop is useful.
|
||||
`kill_port_if_requested()` first cleans listener PIDs visible in the current environment. It only checks for Windows-side listeners when the script detects WSL, no local listener PID is visible, and the port still cannot bind. In that WSL-only path it tries to stop the owning Windows service or force-stop the owning process through PowerShell. If permissions are missing, or a system service such as `iphlpsvc` refuses to stop, the script prints the Windows listener details and stops startup immediately instead of launching the service into the same port error. Non-WSL environments do not run the Windows cleanup path. At that point, use Administrator PowerShell to clear the portproxy/service ownership, or choose another port.
|
||||
|
||||
## Issue 4: `restart` Behavior
|
||||
|
||||
@@ -188,6 +188,92 @@ Before the stamp path fix:
|
||||
|
||||
After moving the stamp file, plain `restart` uses the same `stop + start` behavior and the same fingerprint check as `restart -b`.
|
||||
|
||||
## Optional Motion Agent Startup
|
||||
|
||||
`planet.sh` can now manage the local Motion Capture Agent. It is disabled by default so ordinary development machines do not fail startup when cameras, OpenCV, or MediaPipe are unavailable.
|
||||
|
||||
Start it with:
|
||||
|
||||
```bash
|
||||
./planet.sh start --motion-agent
|
||||
```
|
||||
|
||||
Common options:
|
||||
|
||||
- `--motion-agent` / `-m`: start or restart the Motion Agent for this command.
|
||||
- `--motion-agent-port <port>`: override the default WebSocket port `8765`.
|
||||
- `--motion-agent-camera-indexes <indexes>`: override auto-detected camera indexes, for example `0` or `0,1`. The same can be provided through `MOTION_AGENT_CAMERA_INDEXES=0,1`.
|
||||
- `--motion-agent-camera-urls <urls>`: use RTSP/HTTP camera streams, useful for WSL, phone cameras, or network cameras. The same can be provided through `MOTION_AGENT_CAMERA_URLS=...`.
|
||||
- `--motion-agent-dry-run`: start only the protocol service without opening cameras or loading CV dependencies; useful for Web client debugging.
|
||||
|
||||
Non-dry-run live mode checks `mediapipe` and `opencv-python` before startup. If the current `.venv` is missing them, the script automatically runs:
|
||||
|
||||
```bash
|
||||
uv add mediapipe opencv-python
|
||||
```
|
||||
|
||||
To disable startup-time auto-install:
|
||||
|
||||
```bash
|
||||
PLANET_MOTION_AGENT_AUTO_INSTALL=0 ./planet.sh start --motion-agent
|
||||
```
|
||||
|
||||
Live mode auto-detects `/dev/video*` and passes the first two indexes to the Motion Agent. In WSL, Windows cameras usually do not appear as `/dev/video*` automatically. Check available devices first:
|
||||
|
||||
```bash
|
||||
ls /dev/video*
|
||||
```
|
||||
|
||||
To override auto-detection, pass indexes explicitly:
|
||||
|
||||
```bash
|
||||
./planet.sh start --motion-agent --motion-agent-camera-indexes 1,2
|
||||
```
|
||||
|
||||
In WSL, the more general path is to connect a phone or network camera through an RTSP/HTTP stream:
|
||||
|
||||
```bash
|
||||
./planet.sh start --motion-agent --motion-agent-camera-urls http://192.168.1.20:8080/video
|
||||
```
|
||||
|
||||
If WSL has no `/dev/video*` and no `--motion-agent-camera-urls` is provided, live startup stops and prints guidance instead of silently falling back to dry-run. Choose one of:
|
||||
|
||||
```bash
|
||||
./planet.sh start --motion-agent --motion-agent-camera-urls http://<phone-ip>:8080/video
|
||||
./planet.sh start --motion-agent --motion-agent-dry-run
|
||||
```
|
||||
|
||||
Automatic dry-run fallback only happens when `PLANET_MOTION_AGENT_WSL_ALLOW_DRY_RUN_FALLBACK=1` is explicitly set.
|
||||
|
||||
Environment-variable startup is also supported:
|
||||
|
||||
```bash
|
||||
PLANET_START_MOTION_AGENT=1 ./planet.sh start
|
||||
MOTION_AGENT_DRY_RUN=1 PLANET_START_MOTION_AGENT=1 ./planet.sh start
|
||||
```
|
||||
|
||||
Logs:
|
||||
|
||||
```bash
|
||||
./planet.sh log -m
|
||||
```
|
||||
|
||||
To expose it together with the frontend on the LAN:
|
||||
|
||||
```bash
|
||||
./planet.sh start --allow-lan --motion-agent
|
||||
```
|
||||
|
||||
In this mode the Motion Agent binds `0.0.0.0`, and startup output prints both the local WebSocket URL and the recommended LAN WebSocket URL. When opening Earth from another LAN browser, point `motionAgent` at the display machine:
|
||||
|
||||
```text
|
||||
http://<LAN_IP>:3000/earth?motion=1&motionAgent=ws://<LAN_IP>:8765/ws/gestures
|
||||
```
|
||||
|
||||
`./planet.sh stop` also stops a script-managed Motion Agent. `./planet.sh health` reports its online/offline status. The Earth page still requires `?motion=1` or browser local storage to enable the Web client connection explicitly.
|
||||
|
||||
For ordinary web, WSL, or no-install demo scenarios, you can skip Motion Agent entirely: choose the `Browser Camera` input source in Earth settings and enable Motion Debug Mode. This route uses browser `getUserMedia`, so the page must run on HTTPS or localhost and the user must grant camera permission.
|
||||
|
||||
## Other Cleanup
|
||||
|
||||
Two redundant `sleep 3` waits were removed because health checks already cover the same readiness:
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
This guide is for developers or demo operators starting Planet for the first time. The goal is to get services running via the shortest path and know which URLs to open.
|
||||
|
||||
If you run into port conflicts, Windows / WSL LAN access, `uv` / `bun`, camera, or Docs permission issues, start with the [FAQ](/home/ray/dev/linkong/planet/docs/technical/en/faq.md).
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Recommended: run in a WSL / Linux shell.
|
||||
@@ -64,6 +66,8 @@ If the default ports are taken, specify custom ports:
|
||||
./planet.sh start -f 3001 -b 8001 -a 8101
|
||||
```
|
||||
|
||||
If backend port `8000` is occupied by a Windows listener or an old portproxy rule, follow the [FAQ](/home/ray/dev/linkong/planet/docs/technical/en/faq.md) troubleshooting order.
|
||||
|
||||
## 2. Create a Login User
|
||||
|
||||
The console requires login. For first-time use:
|
||||
@@ -91,9 +95,9 @@ Once in, verify:
|
||||
- The globe renders correctly
|
||||
- The right-side layer panel can toggle layers on/off
|
||||
- Search can find cables, satellites, compute centers, BGP events
|
||||
- Compute-center and BGP collector detail cards can collect and preview coordinate candidates; the compute-center unresolved badge can open the queue and save candidates
|
||||
- Compute-center and BGP collector detail cards can collect and preview coordinate candidates; when regular sources have no candidate, the current default AI Provider runs one LLM factcheck fallback; the compute-center unresolved badge can open the queue and save candidates
|
||||
- Mouse drag, wheel zoom, and zoom percent feedback work correctly
|
||||
- Settings panel can switch cruise mode, day/night mode, satellite display style
|
||||
- Settings panel can switch rotate / cruise / motion mode, day/night mode, and satellite display style; Motion Debug Mode can show the local Browser Camera preview plus skeleton overlay
|
||||
|
||||
## 4. Open the Console
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
- [快速开始](/home/ray/dev/linkong/planet/docs/technical/zh/quickstart.md):从零启动 Planet 的最短路径
|
||||
- [Planet 使用手册](/home/ray/dev/linkong/planet/docs/technical/zh/manual.md):控制台、`planet.sh`、Earth 和 Docs 的完整使用手册
|
||||
- [常见问题](/home/ray/dev/linkong/planet/docs/technical/zh/faq.md):Windows / WSL、端口、依赖、动捕、凭证和 Docs 权限的集中排障入口
|
||||
- [Earth 位置候选采集使用手册](/home/ray/dev/linkong/planet/docs/technical/zh/location-pipeline-user.md):在 Earth 上为算力中心和 BGP 观测站采集、预览坐标候选
|
||||
- [数据源、采集器设置与连接验证](/home/ray/dev/linkong/planet/docs/technical/zh/datasource-collector-settings-connectivity.md):数据源目录、采集器设置、连接验证、BarentsWatch 凭证链路
|
||||
- [通用位置估算管线开发说明](/home/ray/dev/linkong/planet/docs/technical/zh/location-pipeline-development.md):后端 location resolver / pipeline 的接口、注册表和扩展方式
|
||||
|
||||
@@ -23,11 +23,12 @@
|
||||
- 业务层请求整理
|
||||
- 稳定的 `/api/v1/ai/...` 接口
|
||||
- 面向 `aiprovider` 的内部服务认证
|
||||
- 读取配置中心保存的默认 provider、模型和每个 provider 的 key,并通过内部请求头覆盖 `aiprovider` 的 `.env` 默认值
|
||||
|
||||
`aiprovider` 负责:
|
||||
|
||||
- 模型协议适配
|
||||
- 基于 `.env` 选择 provider
|
||||
- 在没有后端覆盖头时基于 `.env` 选择 provider
|
||||
- 超时和轻量重试
|
||||
- 通过 `X-Request-ID` 串联请求追踪
|
||||
|
||||
@@ -85,6 +86,18 @@
|
||||
|
||||
后端会把 `X-Request-ID` 透传给 `aiprovider`,并在响应中返回同一个 header。
|
||||
|
||||
### 设置中心 API
|
||||
|
||||
AI 配置页使用的接口:
|
||||
|
||||
- `GET /api/v1/settings/integrations`
|
||||
- `PUT /api/v1/settings/integrations`
|
||||
- `POST /api/v1/settings/integrations/ai-provider/connect`
|
||||
- `GET /api/v1/settings/integrations/ai-provider/secrets`
|
||||
- `GET /api/v1/settings/integrations/ai-provider/presets`
|
||||
|
||||
这些接口都需要用户登录。`secrets` 接口只用于配置页点击显示 key/token 时取回明文,隐藏时前端恢复为脱敏预览。
|
||||
|
||||
### AI Provider 内部 API
|
||||
|
||||
仅供内部调用的接口:
|
||||
@@ -172,6 +185,75 @@ curl -X POST http://localhost:8010/v1/analyze \
|
||||
|
||||
## 配置
|
||||
|
||||
### 运行时配置链路
|
||||
|
||||
LLM 的全局默认配置由后端配置中心统一决定。实际调用顺序是:
|
||||
|
||||
1. 前端或业务代码调用 `backend` 的 `/api/v1/ai/...`。
|
||||
2. `backend` 从 PostgreSQL 的 `system_settings` 表读取 `category = external_integrations`。
|
||||
3. `payload.ai_provider.default_provider` 决定当前默认 provider。
|
||||
4. `payload.ai_provider.providers[provider]` 提供该 provider 的 `api_key`、`provider_api`、`base_url`、`model`、`max_tokens`、`anthropic_version`。
|
||||
5. `backend` 把这些值转换成 `X-AI-Provider`、`X-AI-Provider-API`、`X-AI-Base-URL`、`X-AI-API-Key`、`X-AI-Model` 等内部请求头。
|
||||
6. `aiprovider` 收到头后用这些值覆盖自己的 `.env`,再调用真实模型厂商。
|
||||
|
||||
因此,只要 AI 设置页保存了新的默认 provider/model/key,Playground、告警摘要、数据源映射生成等所有后端 AI 调用都会使用同一个新默认配置。
|
||||
|
||||
#### 持久化结构
|
||||
|
||||
AI 配置仍保存在 PostgreSQL,不写入 JSON 文件。核心结构如下:
|
||||
|
||||
```json
|
||||
{
|
||||
"ai_provider": {
|
||||
"service_url": "http://localhost:8010",
|
||||
"service_token": "",
|
||||
"default_provider": "openai",
|
||||
"providers": {
|
||||
"openai": {
|
||||
"provider_api": "openai-completions",
|
||||
"base_url": "https://api.openai.com/v1",
|
||||
"model": "gpt-5.1",
|
||||
"api_key": "<saved secret>",
|
||||
"max_tokens": 4096,
|
||||
"anthropic_version": "2023-06-01"
|
||||
},
|
||||
"minimax": {
|
||||
"provider_api": "anthropic-messages",
|
||||
"base_url": "https://api.minimaxi.com/anthropic",
|
||||
"model": "MiniMax-M2.7",
|
||||
"api_key": "<saved secret>",
|
||||
"max_tokens": 1200,
|
||||
"anthropic_version": "2023-06-01"
|
||||
}
|
||||
},
|
||||
"timeout_seconds": 60,
|
||||
"retry_attempts": 2
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
历史单槽配置会在读取时兼容映射到当前 provider 的 `providers[provider]`,保存后写回新结构。
|
||||
|
||||
#### Key fallback
|
||||
|
||||
每个 provider 都有自己的 key 槽。解析顺序是:
|
||||
|
||||
1. PostgreSQL 中 `providers[provider].api_key`
|
||||
2. `aiprovider/.env` 中 preset 对应的专属变量,例如 `OPENAI_API_KEY`、`MINIMAX_API_KEY`、`ANTHROPIC_API_KEY`
|
||||
3. `aiprovider/.env` 中的通用 `AI_API_KEY`
|
||||
|
||||
`.env` 只是兜底。配置页保存或测试连接成功后,PostgreSQL 中的配置会成为全局默认。
|
||||
|
||||
#### 配置页行为
|
||||
|
||||
- Provider 下拉框决定当前默认 provider。
|
||||
- 模型下拉框保存当前 provider 的默认模型。
|
||||
- LLM API Key 输入框隐藏时显示脱敏预览;有 `-` 前缀的 key 会保留前缀,例如 `sk-********`,没有前缀的 key 全量脱敏。
|
||||
- 点击眼睛会从后端取回完整明文;再次隐藏会恢复脱敏预览。
|
||||
- “保存 AI 配置”直接保存当前表单为全局默认配置。
|
||||
- “测试连接”先用当前表单发起真实模型链路测试,成功后也会保存为全局默认配置;失败不会覆盖旧配置。
|
||||
- 清空输入框并保存表示保留旧 key,不表示删除 key。
|
||||
|
||||
### 后端
|
||||
|
||||
推荐的后端 `.env`:
|
||||
@@ -208,6 +290,18 @@ AI_HTTP_RETRY_ATTEMPTS=2
|
||||
AI_ANALYSIS_SYSTEM_PROMPT=你是态势感知分析助手。请基于输入的上下文、观测与约束,输出结构化、克制、可执行的分析。
|
||||
```
|
||||
|
||||
可选 provider 专属 key:
|
||||
|
||||
```env
|
||||
MINIMAX_API_KEY=sk-cp-xxxxx
|
||||
OPENAI_API_KEY=sk-xxxxx
|
||||
ANTHROPIC_API_KEY=sk-ant-xxxxx
|
||||
DEEPSEEK_API_KEY=sk-xxxxx
|
||||
DASHSCOPE_API_KEY=sk-xxxxx
|
||||
MOONSHOT_API_KEY=sk-xxxxx
|
||||
OPENROUTER_API_KEY=sk-or-xxxxx
|
||||
```
|
||||
|
||||
### OpenAI 兼容示例
|
||||
|
||||
```env
|
||||
|
||||
@@ -88,7 +88,26 @@ React 路由入口:
|
||||
|
||||
手势提示不会抢占 loading 状态。对应样式是 [hud.css](/home/ray/dev/linkong/planet/frontend/public/earth/css/hud.css) 中的 `.earth-status-message.gesture`。
|
||||
|
||||
### 5. 地球与地形
|
||||
### 5. 动作捕捉控制适配层
|
||||
|
||||
- [motion-control.js](/home/ray/dev/linkong/planet/frontend/public/earth/js/motion-control.js)
|
||||
|
||||
职责:
|
||||
|
||||
- 作为 Motion Provider manager,统一接入 `browser_camera` 与 `motion_agent`。
|
||||
- 默认使用浏览器 `getUserMedia` + 本地 MediaPipe 识别;高级模式可连接本地 Motion Capture Agent WebSocket。
|
||||
- 处理浏览器摄像头权限/安全上下文错误,以及 Agent 断线重连和 `status` / `heartbeat`。
|
||||
- 过滤低置信度和过快重复的手势事件。
|
||||
- 将 `rotate_left`、`rotate_right`、`rotate_up`、`rotate_down`、`zoom_in`、`zoom_out`、`focus_prev`、`focus_next`、`layer_prev`、`layer_next`、`confirm` 映射到 `main.js` 暴露的动作入口。
|
||||
- 解析 `skeleton` 调试事件并派发 `earth:motion-debug-frame`。
|
||||
|
||||
动作捕捉识别可以在浏览器本地执行,也可以在本地 Agent 中执行,但两者都不会把实时视频帧发给 SaaS 云端。`main.js` 暴露旋转、缩放、目标切换、图层切换和确认入口,并通过 `window.__planetEarth.motion` 提供调试入口。默认只有 URL 参数 `?motion=1`、本地存储 `planet-earth-motion-control-enabled=true`,或 Earth 设置中的“动捕调试模式”打开时才启动当前 provider。
|
||||
|
||||
动捕调试面板由 [motion-debug-panel.js](/home/ray/dev/linkong/planet/frontend/public/earth/js/motion-debug-panel.js) 负责。它监听 `earth:motion-debug-frame`,用 canvas 绘制归一化骨架点和连线;Browser Camera provider 会额外通过 `earth:motion-debug-video-source` 提供本机 `<video>` 作为调试预览底图,`shared.motionDebugSkeletonOnly` 可切换为只显示骨骼。`停止匹配动作` 通过 `earth:motion-recognition-pause` 暂停 gesture 执行,但继续显示视频和骨架。未匹配动作为红色,匹配后变绿并显示动作名。设置项持久化在 `planet.earth.settings.v2` 的 `shared.motionDebugEnabled`、`shared.motionProvider` 与 `shared.motionDebugSkeletonOnly`,switch 和输入源控件都预留 `data-gatekeeper-permission="earth.motion_debug"`。
|
||||
|
||||
[presentation-controller.js](/home/ray/dev/linkong/planet/frontend/public/earth/js/presentation-controller.js) 是新的 Presentation 层。第一阶段只接入 Motion:`motion-cruise-adapter.js` 通过 persistent presentation 复用巡航固定卡片位置和 connector,但不会让鼠标移动触发自动隐藏;connector 每帧重算 source/target anchor,让卡片拖动、地球旋转和目标移动时端点继续跟随。BGP/News 仍保持原有 `CruiseSequencer` 自动轮播路径,避免改变既有巡航体验。
|
||||
|
||||
### 6. 地球与地形
|
||||
|
||||
- [earth.js](/home/ray/dev/linkong/planet/frontend/public/earth/js/earth.js)
|
||||
- [terrain.js](/home/ray/dev/linkong/planet/frontend/public/earth/js/terrain.js)
|
||||
@@ -99,7 +118,7 @@ React 路由入口:
|
||||
- 真实地形 mesh
|
||||
- terrain tile 拉取、解码、位移、着色
|
||||
|
||||
### 6. 图层模块
|
||||
### 7. 图层模块
|
||||
|
||||
- [satellites.js](/home/ray/dev/linkong/planet/frontend/public/earth/js/satellites.js)
|
||||
- [cables.js](/home/ray/dev/linkong/planet/frontend/public/earth/js/cables.js)
|
||||
@@ -119,6 +138,8 @@ React 路由入口:
|
||||
- 面板内容
|
||||
- hover/lock/selection 语义
|
||||
|
||||
`tv.js` 管理 `media-panel` 里的直播 / 态势新闻 tab。toolbar 打开或切换 TV/新闻时,会通过 `earth:tv-visibility-change` 和 `earth:tv-tab-change` 回写 Earth 设置:面板可见性仍按 desktop/mobile viewport 存在 `views.<scope>.panelVisibility.media-panel`,当前 tab 存在 `shared.mediaPanelActiveTab`,因此刷新页面后能恢复用户上次打开的直播或新闻状态。`closeTransientMobileOverlays()` 这类临时收起会带 `persist:false`,不会覆盖用户偏好。
|
||||
|
||||
其中 Earth 启动加载链现在也拆成了两层:
|
||||
|
||||
- `controls.js`
|
||||
@@ -307,6 +328,8 @@ AISStream 的 `PositionReport` 常带实时位置和 `MetaData.ShipName`,但
|
||||
|
||||
算力中心图层行左上角的通知气泡显示 GeoJSON `unresolved` 数量。这个数字表示“完全没有可信坐标、不能渲染到地球上”的记录,不等同于地图上带 `?` 的已定位待确认点。点击气泡会在图层面板右侧打开固定信息卡,信息卡内容区内部滚动,不随鼠标 hover 消失。列表中的单条 `采集` 只展示候选;顶部 `一键采用` 会按当前列表顺序逐条采集、保存最高置信候选,成功一条就移除一条、重新编号,并通过 `earth:compute-center-unresolved-count-change` 同步气泡数量。批量结束后再触发 `earth:compute-center-location-saved` 刷新真实图层。
|
||||
|
||||
详情卡里的坐标候选状态由 [info-card.js](/home/ray/dev/linkong/planet/frontend/public/earth/js/info-card.js) 按 `entityType:entityId` 缓存在模块内存中。用户关闭详情卡或待定位列表后再次打开同一个算力中心 / BGP 观测站,已经采集到的候选和状态文案会恢复;`一键采用` 会优先使用缓存候选,避免重复调用在线地理编码或 LLM factcheck。保存成功后该实体的候选列表会清空为“正在刷新图层”状态,避免旧候选在刷新后继续误导用户。
|
||||
|
||||
asset 图标大小由 `Interactable` 的 `icon.fitSize` 控制。SVG / 图片文件应尽量保持原始 viewBox 和路径,不要为了在地球上显示成 60x60 而手写 `transform`;`drawAssetIcon()` 会把资源等比 contain 到指定尺寸并居中绘制到 atlas canvas。
|
||||
|
||||
`Interactable` 默认使用固定屏幕像素尺寸,适合船只、BGP 事件、BGP 观测站、算力中心这类需要稳定识别的图标。如果某类图标需要跟随相机距离缩放,可以把 `sizeMode` 设为非 `"fixed"`,并用 `sizeScale.min / max / referenceFov` 控制缩放范围;单个 marker 的业务尺寸差异可以通过 `getPointSizeMultiplier()` 表达,例如 BGP 事件按严重级别调整点大小,BGP 观测站按活跃度调整点大小。
|
||||
|
||||
@@ -0,0 +1,308 @@
|
||||
# 常见问题
|
||||
|
||||
这页集中收录本地启动、Windows / WSL、依赖、动捕、凭证和 Docs 权限相关的常见排障路径。更完整的背景说明仍在对应专题文档中,这里只保留最常用的判断顺序和命令。
|
||||
|
||||
## 启动与端口
|
||||
|
||||
### 启动时报后端地址已被占用怎么办?
|
||||
|
||||
现象通常类似:
|
||||
|
||||
```text
|
||||
后端地址已被占用: 0.0.0.0:8000 / 127.0.0.1:8000 / [::1]:8000
|
||||
Address already in use
|
||||
```
|
||||
|
||||
先尝试:
|
||||
|
||||
```bash
|
||||
./planet.sh restart -b
|
||||
```
|
||||
|
||||
如果仍然占用,临时换端口:
|
||||
|
||||
```bash
|
||||
./planet.sh start -b 8001
|
||||
```
|
||||
|
||||
在 WSL 中,端口可能不是 Linux 进程占用,而是 Windows 侧 listener。常见输出如下:
|
||||
|
||||
```text
|
||||
Windows listener: 0.0.0.0:8000 pid=4700 process=svchost.exe services=iphlpsvc
|
||||
```
|
||||
|
||||
`iphlpsvc` 是 Windows IP Helper 服务。它经常承载 IPv6、隧道、代理、端口转发、WSL 或开发工具注册的网络能力。不要优先 `taskkill` 这个 `svchost.exe`;更推荐先找是不是旧的 portproxy 规则。
|
||||
|
||||
管理员 PowerShell 中先查 portproxy:
|
||||
|
||||
```powershell
|
||||
netsh interface portproxy show all
|
||||
```
|
||||
|
||||
如果看到 `0.0.0.0:8000` 或 `listenport=8000`,删除对应规则:
|
||||
|
||||
```powershell
|
||||
netsh interface portproxy delete v4tov4 listenaddress=0.0.0.0 listenport=8000
|
||||
```
|
||||
|
||||
如果没有 portproxy 规则,再确认 PID 内承载的服务:
|
||||
|
||||
```powershell
|
||||
netstat -ano | findstr :8000
|
||||
tasklist /svc /fi "PID eq 4700"
|
||||
```
|
||||
|
||||
临时排障可以在管理员 PowerShell 中停止 IP Helper:
|
||||
|
||||
```powershell
|
||||
Stop-Service iphlpsvc
|
||||
```
|
||||
|
||||
这可能影响部分网络、代理或转发能力。长期不推荐禁用该服务;如果必须保留 Windows 转发,改用不同后端端口更稳。
|
||||
|
||||
如果脚本输出 `failed-stop-service` 或 `failed-stop-process`,说明当前权限无法清理 Windows listener。脚本会停止启动,避免后端再次遇到同一端口冲突。
|
||||
|
||||
### 默认端口冲突时应该改哪些参数?
|
||||
|
||||
常用端口如下:
|
||||
|
||||
| 服务 | 默认端口 | 参数 |
|
||||
| --- | --- | --- |
|
||||
| 前端 | `3000` | `-f <port>` |
|
||||
| 后端 | `8000` | `-b <port>` |
|
||||
| AI Provider | `8010` | `-a <port>` |
|
||||
| Motion Agent | `8765` | `--motion-agent-port <port>` |
|
||||
|
||||
示例:
|
||||
|
||||
```bash
|
||||
./planet.sh start -f 3001 -b 8001 -a 8101
|
||||
```
|
||||
|
||||
## Windows / WSL / 局域网
|
||||
|
||||
### Windows / WSL 下局域网访问不通怎么办?
|
||||
|
||||
建议按下面顺序排查:
|
||||
|
||||
```bash
|
||||
# 在 WSL 或运行 Planet 的 shell 中
|
||||
curl http://localhost:3000
|
||||
curl http://localhost:8000/health
|
||||
```
|
||||
|
||||
再到 Windows PowerShell 验证:
|
||||
|
||||
```powershell
|
||||
curl http://localhost:3000
|
||||
curl http://localhost:8000/health
|
||||
```
|
||||
|
||||
如果 WSL 和 Windows localhost 都通,但手机或其他电脑访问不通,再考虑局域网开放:
|
||||
|
||||
```bash
|
||||
./planet.sh start --allow-lan
|
||||
```
|
||||
|
||||
管理员 PowerShell 中配置 portproxy 和防火墙:
|
||||
|
||||
```powershell
|
||||
netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=3000 connectaddress=127.0.0.1 connectport=3000
|
||||
netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=8000 connectaddress=127.0.0.1 connectport=8000
|
||||
New-NetFirewallRule -DisplayName "WSL Planet 3000" -Direction Inbound -Action Allow -Protocol TCP -LocalPort 3000
|
||||
New-NetFirewallRule -DisplayName "WSL Planet 8000" -Direction Inbound -Action Allow -Protocol TCP -LocalPort 8000
|
||||
```
|
||||
|
||||
局域网设备访问的是 Windows 的局域网 IP,例如 `http://<Windows局域网IP>:3000/earth`,不是 WSL 内部 IP。
|
||||
|
||||
### `--allow-lan` 和 Motion Agent 局域网地址怎么配?
|
||||
|
||||
`--allow-lan` 会让前端、后端和可选 Motion Agent 监听 `0.0.0.0`。如果远端浏览器要连本机 Motion Agent,Earth URL 需要显式带 Agent 地址:
|
||||
|
||||
```text
|
||||
http://<LAN_IP>:3000/earth?motion=1&motionProvider=agent&motionAgent=ws://<LAN_IP>:8765/ws/gestures
|
||||
```
|
||||
|
||||
如果选择浏览器摄像头输入源,不需要 `motionAgent` 参数。
|
||||
|
||||
## 依赖与环境变量
|
||||
|
||||
### 为什么不要用 `pip`,要用 `uv`?
|
||||
|
||||
Planet 的 Python 依赖统一由 `uv` 和 `pyproject.toml` 管理。不要用 `pip install` 往当前环境里塞包,否则容易出现锁文件、虚拟环境和启动脚本不一致。
|
||||
|
||||
Motion Agent live 模式缺依赖时,推荐:
|
||||
|
||||
```bash
|
||||
uv add mediapipe opencv-python
|
||||
```
|
||||
|
||||
`planet.sh start --motion-agent` 会自动检查并安装这些 live 依赖。若要禁止自动安装:
|
||||
|
||||
```bash
|
||||
PLANET_MOTION_AGENT_AUTO_INSTALL=0 ./planet.sh start --motion-agent
|
||||
```
|
||||
|
||||
### 为什么不要用 `npm run`,要用 `bun`?
|
||||
|
||||
前端运行时统一使用 Bun,避免 WSL / Windows 混合环境里触发 `cmd.exe` 路径兼容问题。
|
||||
|
||||
常用命令:
|
||||
|
||||
```bash
|
||||
bun install
|
||||
bun run dev
|
||||
bun run build
|
||||
```
|
||||
|
||||
如果非交互 shell 找不到 `bun`,`planet.sh` 会依次查找当前 PATH、`~/.bun/bin`、zsh 配置和 PowerShell 中的可执行路径。
|
||||
|
||||
### `.zshrc` 里的环境变量什么时候会被读取?
|
||||
|
||||
`planet.sh` 默认只静态解析 `~/.zshrc` 中简单的:
|
||||
|
||||
```bash
|
||||
export KEY=value
|
||||
KEY=value
|
||||
```
|
||||
|
||||
这样可以避免 shell 主题、插件或交互初始化拖慢启动。复杂 shell 展开需要显式启用 source 模式:
|
||||
|
||||
```bash
|
||||
PLANET_LOAD_ZSHRC_ENV=source ./planet.sh start -a
|
||||
```
|
||||
|
||||
如果排障时想完全忽略 `~/.zshrc`:
|
||||
|
||||
```bash
|
||||
PLANET_LOAD_ZSHRC_ENV=0 ./planet.sh start -a
|
||||
```
|
||||
|
||||
不要把密钥值写进文档或提交到仓库;文档只应写变量名和用途。
|
||||
|
||||
## Motion Capture / 摄像头
|
||||
|
||||
### Browser Camera 模式需要 `motionAgent` 参数吗?
|
||||
|
||||
不需要。浏览器摄像头模式直接用网页 `getUserMedia` 调本机摄像头,并在浏览器本地识别动作。
|
||||
|
||||
推荐 URL:
|
||||
|
||||
```text
|
||||
/earth?motion=1&motionProvider=browser
|
||||
```
|
||||
|
||||
也可以在 Earth 设置中打开“动捕调试模式”,并把“动捕输入源”选为“浏览器摄像头”。页面必须运行在 HTTPS 或 localhost,且用户需要允许浏览器摄像头权限。
|
||||
|
||||
### Motion Agent 什么时候才需要?
|
||||
|
||||
这些场景才需要 Motion Agent:
|
||||
|
||||
- 双 USB 摄像头
|
||||
- RTSP / HTTP 摄像头流
|
||||
- 边缘设备或客户端集成
|
||||
- 需要独立本地识别服务
|
||||
|
||||
常用命令:
|
||||
|
||||
```bash
|
||||
./planet.sh start --motion-agent
|
||||
./planet.sh start --motion-agent --motion-agent-camera-indexes 0,1
|
||||
./planet.sh start --motion-agent --motion-agent-camera-urls rtsp://example/live
|
||||
./planet.sh start --motion-agent --motion-agent-dry-run
|
||||
```
|
||||
|
||||
`--motion-agent-dry-run` 只用于协议和前端连接测试,不会打开摄像头。
|
||||
|
||||
### WSL 下摄像头为什么扫不到?
|
||||
|
||||
Windows 摄像头通常不会自动出现在 WSL 的 `/dev/video*`。先确认:
|
||||
|
||||
```bash
|
||||
ls /dev/video*
|
||||
```
|
||||
|
||||
如果没有设备,普通网页演示优先走 Browser Camera。需要 Agent live 模式时,可以用 RTSP / HTTP 摄像头 URL:
|
||||
|
||||
```bash
|
||||
./planet.sh start --motion-agent --motion-agent-camera-urls http://192.168.1.20:8080/video
|
||||
```
|
||||
|
||||
USB 摄像头透传到 WSL 属于高级路径;脚本不会默认把无摄像头场景降级成 dry-run。
|
||||
|
||||
## Docker / AI Provider
|
||||
|
||||
### AI Provider 改了 key、Base URL 或模型后为什么没有重建镜像?
|
||||
|
||||
密钥、Base URL、模型这类运行期配置变化不会触发 Docker 镜像重建。重启 AI Provider 即可:
|
||||
|
||||
```bash
|
||||
./planet.sh restart -a
|
||||
```
|
||||
|
||||
首次构建慢通常是 Docker build context、镜像层或 `uv sync` 下载依赖耗时。后续构建会复用 `.dockerignore`、BuildKit 和 uv cache。
|
||||
|
||||
### Docker 健康检查没过怎么办?
|
||||
|
||||
先看统一健康检查:
|
||||
|
||||
```bash
|
||||
./planet.sh health
|
||||
```
|
||||
|
||||
再看日志:
|
||||
|
||||
```bash
|
||||
./planet.sh log
|
||||
```
|
||||
|
||||
如果只有 AI Provider 异常,优先重启单个服务:
|
||||
|
||||
```bash
|
||||
./planet.sh restart -a
|
||||
```
|
||||
|
||||
## 数据源与采集器凭证
|
||||
|
||||
### 采集器连接验证通过,但正式采集拿不到凭证怎么办?
|
||||
|
||||
连接验证会读取控制台保存配置、环境变量和部分 `~/.zshrc` 凭证。正式采集更推荐把凭证保存到“设置 -> 采集器设置”,尤其是 AISStream 这类长连接 collector。
|
||||
|
||||
如果只把 `AISSTREAM_API_KEY` 放在 `~/.zshrc`,需要确认后端进程实际继承了该变量。否则可能出现连接验证可用,但 collector 运行时没有 key 的情况。
|
||||
|
||||
### BarentsWatch / AISStream 凭证应该放哪里?
|
||||
|
||||
临时联调可以先放环境变量或 `~/.zshrc`,例如:
|
||||
|
||||
```bash
|
||||
export AISSTREAM_API_KEY="..."
|
||||
export BARENTSWATCH_CLIENT_ID="..."
|
||||
export BARENTSWATCH_CLIENT_SECRET="..."
|
||||
```
|
||||
|
||||
稳定运行时,优先在控制台采集器设置中保存凭证,保证连接验证、采集任务和 Earth 实时聚合使用同一份配置。
|
||||
|
||||
## Docs / 权限
|
||||
|
||||
### 为什么 Docs 里有些文档看不到?
|
||||
|
||||
Docs 按 Gatekeeper 权限组控制可见性:
|
||||
|
||||
- 快速开始、使用手册、FAQ 等基础文档公开可见。
|
||||
- 开发文档通常需要 `docs_developer`。
|
||||
- 运维和服务控制文档通常需要 `docs_admin`。
|
||||
- `admin` 和 `super_admin` 默认具备 Docs 权限;普通用户需要在控制台“用户管理”中分配权限组。
|
||||
|
||||
## Earth 常见操作
|
||||
|
||||
### Earth 位置候选采集后没有写入怎么办?
|
||||
|
||||
“采集候选”和“保存候选”是两步。候选可以先在 Earth 上预览,只有点击保存或使用待定位列表中的“一键采用”后,才会写入维表并刷新图层。
|
||||
|
||||
算力中心候选保存后会写入 `compute_center_locations`。没有可用候选的记录会保留在待定位列表中,系统不会用国家中心点或硬编码 hint 伪造位置。
|
||||
|
||||
### 动捕调试面板为什么看不到摄像头画面?
|
||||
|
||||
如果输入源是 Browser Camera,调试面板会显示浏览器本机摄像头实时预览,并在画面上绘制骨架。如果勾选了 `只显示骨骼`,视频预览会被隐藏,只显示深色背景和红/绿骨架。
|
||||
|
||||
如果输入源是 Motion Agent,Agent WebSocket 只发送归一化关节点、骨架连线和匹配动作,不发送原始摄像头帧,以降低隐私、带宽和延迟风险。因此远端 Agent 模式下看到的是骨架调试视图,而不是视频流。
|
||||
@@ -61,6 +61,9 @@ class LocationResolver(Protocol):
|
||||
| `RegistryResolver` | `resolvers/registry.py` | 遗留通用 resolver;当前算力中心和 BGP 运行时链路不使用它生成候选 |
|
||||
| `NominatimResolver` | `resolvers/nominatim.py` | 按领域 query plan 调 Nominatim,带 LRU 缓存和速率限制 |
|
||||
| `InheritFromAnotherEntityResolver` | `resolvers/inherit.py` | 把外部实体的已解析位置包装为候选 |
|
||||
| `LocationLLMFallback` | `location/llm_fallback.py` | 用户触发候选采集且常规候选为空时,通过当前默认 AI Provider 生成待确认候选 |
|
||||
|
||||
Nominatim 是 OpenStreetMap 生态里的地理编码服务:给它一个地点名称、城市、国家或机构查询文本,它会返回可能匹配的经纬度、展示名称和地址结构。它适合把“城市/机构/园区名称”转成候选坐标,但不是权威事实库,可能命中同名地点或过宽泛的行政区,所以本项目只把它作为待确认候选来源,并带缓存和速率限制使用。
|
||||
|
||||
`RegistryResolver` 仍保留给后续可能的受控导入场景,但它不应被重新接入算力中心或 BGP 作为“硬编码 hint”候选源。过去仅凭 `operator`、`city` 等通用字段匹配 registry 容易把多个实体落到同一个点,这是这次下线 registry 候选链路的主要原因。
|
||||
|
||||
@@ -81,7 +84,7 @@ StoredComputeCenterLocationResolver()
|
||||
|
||||
主地图启动链路只做“源坐标优先,其次数据库维表坐标”。数据库表为 `compute_center_locations`,唯一键是 `(source, source_id)`,用于保存人工确认或从源记录真实坐标迁入的位置。`init_db()` 只幂等迁入源记录里已有的真实经纬度,不迁入旧硬编码 hint,不在启动期批量调用 ROR、Nominatim 或 LLM。
|
||||
|
||||
手动候选采集链路和渲染链路分开。`collect_location_candidates()` 使用源字段构造 ROR 和 Nominatim/OpenStreetMap 查询,但不会把 `compute_center_locations` 当前坐标当候选返回。用户在前端确认某个候选后,通过保存接口写入维表;之后地图刷新时由 `StoredComputeCenterLocationResolver` 渲染。
|
||||
手动候选采集链路和渲染链路分开。`collect_location_candidates()` 使用源字段构造 ROR 和 Nominatim/OpenStreetMap 查询,但不会把 `compute_center_locations` 当前坐标当候选返回。如果这些常规候选为空,API 层会调用 `LocationLLMFallback`,通过当前默认 AI Provider 进行位置 factcheck,并只返回 `source="llm_location_factcheck"`、`needs_confirmation=true` 的候选。LLM 候选使用“模型自评分 + 后端证据评分”的组合阈值;如果 LLM 只给出可信 city/country 而没有坐标,后端会用 Nominatim 补城市级坐标,但不会因此提高证据分。用户在前端确认某个候选后,通过保存接口写入维表;之后地图刷新时由 `StoredComputeCenterLocationResolver` 渲染。
|
||||
|
||||
`resolve_compute_center_location()`、`resolve_compute_center_location_full()` 和 `collect_location_candidates()` 保留为领域 API。`visualization.py` 只消费领域 API,不再持有坐标提示常量、国家质心兜底或 Nominatim 细节。
|
||||
|
||||
@@ -102,7 +105,7 @@ StoredCollectorLocationResolver()
|
||||
NominatimResolver(_bgp_collector_query_plan)
|
||||
```
|
||||
|
||||
23 个 RIPE RIS collector 坐标从旧表迁入 `bgp_collector_locations` 维表,默认 `source=legacy_seed`、`needs_confirmation=true`。旧字典仍由 DB-backed cache 维护,保证下游接口兼容;手动候选采集不会把这份维表坐标当作候选,只用它补齐 site/city/country 查询上下文。
|
||||
23 个 RIPE RIS collector 坐标从旧表迁入 `bgp_collector_locations` 维表,默认 `source=legacy_seed`、`needs_confirmation=true`。旧字典仍由 DB-backed cache 维护,保证下游接口兼容;手动候选采集不会把这份维表坐标当作候选,只用它补齐 site/city/country 查询上下文。若 Nominatim 也无法产出城市级候选,采集接口会用当前默认 AI Provider 做 LLM factcheck 兜底,返回待确认候选而不是自动保存。
|
||||
|
||||
### BGP 事件
|
||||
|
||||
@@ -139,6 +142,26 @@ POST /api/v1/bgp/collectors/{collector_id}/collect-location
|
||||
}
|
||||
```
|
||||
|
||||
LLM 兜底只发生在用户触发的 `collect-location` 请求中,并且只在常规候选为空时运行。它不会在 `/geo/compute-centers` 启动渲染、定时采集或批量入库流程中自动调用,也不会直接写入 `compute_center_locations` 或 `bgp_collector_locations`。LLM 兜底内部不是“一次严格 JSON 成败”的单点链路,而是小型结构化管线:先请求 LLM 做位置 factcheck;若返回不是 JSON,再发起一次“只从原文抽取、不新增事实”的结构化修复;若修复仍失败,则只从原文中保守抽取 city/country。随后统一由后端补坐标、算综合分并决定是否生成候选。
|
||||
|
||||
这条链路允许 LLM 只给出“DeepL Mercury 位于 Falun, Sweden”这类城市级事实,由后端用 Nominatim 补城市坐标;也允许模型第一轮输出自然语言,第二轮再归一化成 JSON。无论哪条路径,只有 `precise`、`site`、`city` 精度、非零坐标和足够综合分的结果会被转换成候选;失败、低分、只有国家级信息或无法抽出城市的响应会保留为诊断信息。
|
||||
|
||||
LLM 返回的 `confidence` 只是模型自评,后端会重新计算综合分并把它作为候选 `confidence`:
|
||||
|
||||
```text
|
||||
combined =
|
||||
0.25 * model_confidence
|
||||
+ source_quality
|
||||
+ entity_match
|
||||
+ geography_match
|
||||
+ precision_quality
|
||||
+ name_location_hint
|
||||
- conflict_penalty
|
||||
- weak_evidence_penalty
|
||||
```
|
||||
|
||||
当前分项上限:权威/政府/高校来源最高 `0.35`,可信数据库/新闻最高 `0.25`,普通网页最高 `0.15`;证据明确命中实体名最高 `0.25`;城市+国家匹配 `0.20`,只有国家匹配 `0.05`;精度项 `precise=0.15`、`site=0.12`、`city=0.08`;实体名与候选城市互相命中时增加 `name_location_hint`,例如 `TAIPEI-1` 对 `Taipei`;明确冲突最多扣 `0.45`,普通弱证据措辞最多扣 `0.30`,在实体和城市国家都已命中且无冲突时弱证据扣分封顶 `0.15`。综合分低于 `0.55` 的候选会被拒绝。这样 Alem.Cloud、TAIPEI-1 这类“模型自评分偏低,但实体和城市证据一致”的结果可以被后端公式拉回到可确认候选;真正证据弱或有冲突的结果仍会被拒绝。
|
||||
|
||||
`POST /api/v1/visualization/compute-centers/{source_id}/location` 把前端选中的候选 upsert 到 `compute_center_locations`。人工保存默认 `needs_confirmation=false`、`verification_status="verified"` 并写入 `verified_at`;如果后续接入自动暂存,也可以显式传 `needs_confirmation=true`。
|
||||
|
||||
前端 [info-card.js](/home/ray/dev/linkong/planet/frontend/public/earth/js/info-card.js) 使用通用候选列表和预览事件渲染对象详情卡。算力中心图层按钮左上角会显示 `unresolved` 数量;点击角标打开待定位列表。列表中的 `采集` 只拉候选,`一键采用` 会逐条调用候选采集接口,选择最高置信且有有效经纬度的候选保存。保存成功一条就从列表移除并重新编号,同时通过 `earth:compute-center-unresolved-count-change` 同步角标;批量结束后再触发 `earth:compute-center-location-saved` 刷新真实图层。
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Earth 位置候选采集使用手册
|
||||
|
||||
位置候选采集用于给 Earth 上的算力中心和 BGP 观测站补齐或核验经纬度。它不会要求用户手工输入坐标,而是把源数据、开放组织注册 API 和在线地理编码结果整理成候选列表,供用户预览和后续认领。
|
||||
位置候选采集用于给 Earth 上的算力中心和 BGP 观测站补齐或核验经纬度。它不会要求用户手工输入坐标,而是把源数据、开放组织注册 API、在线地理编码结果,以及必要时的 LLM factcheck 兜底结果整理成候选列表,供用户预览和后续认领。
|
||||
|
||||
## 适用对象
|
||||
|
||||
@@ -18,13 +18,15 @@ BGP 事件的位置默认继承所属 collector。事件本身暂不提供单独
|
||||
| 字段 | 含义 |
|
||||
| --- | --- |
|
||||
| 位置精度 | `精确坐标`、`站点级位置`、`城市级位置` 或 `位置未确认` |
|
||||
| 位置来源 | 源数据坐标、ROR 组织注册 API、Nominatim 在线搜索,或已存储的 BGP collector 维表位置 |
|
||||
| 位置来源 | 源数据坐标、ROR 组织注册 API、Nominatim 在线搜索、LLM factcheck 兜底,或已存储的 BGP collector 维表位置 |
|
||||
| 位置置信度 | 后端 resolver 给出的相对置信度百分比 |
|
||||
| 核验状态 | 已确认、估算位置或在线检索结果待确认 |
|
||||
| 解析依据 | 为什么选择这个位置,例如匹配了哪个站点或城市 |
|
||||
| 匹配的位置名称 | 开放来源、在线结果或已存储 collector 位置中的规范名称 |
|
||||
| 位置核验时间 | 已确认位置的核验日期,在线候选通常为空 |
|
||||
|
||||
这里的 Nominatim 指 OpenStreetMap 生态中的在线地理编码服务。它会把地点名称、城市、国家、机构或园区查询文本转换为可能的经纬度候选,但结果可能命中同名地点或过宽泛的行政区,因此界面会把这类结果标为待确认。
|
||||
|
||||
算力中心 GeoJSON 不再渲染国家质心、未知位置或 `[0, 0]` 占位点。无法达到城市级精度的数据会进入接口的 `unresolved` 列表,并在图层开关左上角显示待定位数量。点击这个通知气泡会打开待定位列表。
|
||||
|
||||
地图上带 `?` 的算力中心不是 `unresolved`。它们已经有坐标,只是 `needs_confirmation=true` 或来自在线地理编码,仍需人工核验。真正 `unresolved` 的记录没有可信经纬度,因此不会出现在地球上。
|
||||
@@ -82,7 +84,7 @@ POST /api/v1/bgp/collectors/{collector_id}/collect-location
|
||||
}
|
||||
```
|
||||
|
||||
当没有候选达到城市级精度时,`success` 为 `false`,响应会包含 `failure_reason` 和已尝试的查询文本,便于判断是源数据字段不足、开放来源缺项,还是在线地理编码没有命中。
|
||||
常规候选为空时,接口会通过当前默认 AI Provider 做一次 LLM factcheck 兜底。LLM 候选始终需要人工确认,不会自动保存;只有达到城市级或更高精度、非零坐标且置信度足够的 JSON 结果才会出现在候选列表中。当仍没有候选达到城市级精度时,`success` 为 `false`,响应会包含 `failure_reason`、`llm_failure_reason` 和已尝试的查询文本,便于判断是源数据字段不足、开放来源缺项、在线地理编码没有命中,还是 LLM 返回不可用。
|
||||
|
||||
## 数据维护建议
|
||||
|
||||
@@ -122,6 +124,10 @@ Earth 只渲染达到城市级或更高精度的坐标。源数据没有坐标
|
||||
|
||||
Nominatim/OpenStreetMap 结果来自在线地理编码,可能匹配到同名城市、机构或园区。它可以用于快速定位和预览,但在写入已验证位置前应人工确认。
|
||||
|
||||
### LLM 兜底会不会直接改地图?
|
||||
|
||||
不会。LLM 只在用户点击采集候选且常规来源没有候选时运行,并只返回待确认候选。Earth 首屏 GeoJSON、定时采集和批量渲染不会自动调用 LLM;只有用户保存候选后,位置才会进入维表并参与后续渲染。
|
||||
|
||||
### 为什么 BGP 事件没有全部落到 Amsterdam
|
||||
|
||||
旧逻辑中,事件可能因为 `operator="RIPE NCC"` 这种通用字段误匹配到 `rrc00`。当前 BGP 事件继承只按所属 collector 在 DB-backed cache 中严格查找,不再用 registry 模糊匹配。
|
||||
@@ -7,7 +7,7 @@
|
||||
- 控制台:登录后的管理后台
|
||||
- Docs:后端 Gatekeeper 受控的文档站,基础使用文档公开,开发/运维文档按权限组开放
|
||||
|
||||
快速启动路径见 [快速开始](/home/ray/dev/linkong/planet/docs/technical/zh/quickstart.md)。
|
||||
快速启动路径见 [快速开始](/home/ray/dev/linkong/planet/docs/technical/zh/quickstart.md)。常见排障见 [常见问题](/home/ray/dev/linkong/planet/docs/technical/zh/faq.md)。
|
||||
|
||||
## 入口总览
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
| --- | --- | --- | --- |
|
||||
| Earth | `http://localhost:3000/earth` | 否 | 3D 地球、图层、BGP、卫星、海缆、新闻态势 |
|
||||
| Docs | `http://localhost:3000/docs` | 部分需要 | 使用手册公开;开发、后端、运维文档按 Gatekeeper 权限组开放 |
|
||||
| FAQ | `http://localhost:3000/docs/faq` | 否 | Windows / WSL、端口、依赖、动捕、凭证和权限排障 |
|
||||
| 控制台 | `http://localhost:3000/admin` | 是 | 数据、配置、告警、日志和专题观测 |
|
||||
| AI Playground | `http://localhost:3000/playground` | 是 | AI Provider 状态和调试 |
|
||||
| 后端 API 文档 | `http://localhost:8000/docs` | 视接口而定 | FastAPI / OpenAPI 文档 |
|
||||
@@ -311,7 +312,7 @@ Earth 搜索支持查找当前地球对象,例如:
|
||||
|
||||
### 位置候选采集
|
||||
|
||||
算力中心和 BGP 观测站详情卡支持自动采集坐标候选。点击对象后,使用详情卡中的 `自动采集坐标候选` 或 `重新自动采集坐标` 按钮,后端会从源坐标、开放组织注册 API 和在线地理编码中整理候选位置。BGP 观测站的已存储位置只用于补齐查询上下文,不会作为候选直接返回。
|
||||
算力中心和 BGP 观测站详情卡支持自动采集坐标候选。点击对象后,使用详情卡中的 `自动采集坐标候选` 或 `重新自动采集坐标` 按钮,后端会从源坐标、开放组织注册 API 和在线地理编码中整理候选位置;这些常规来源没有候选时,会使用当前默认 AI Provider 做一次 LLM factcheck 兜底。BGP 观测站的已存储位置只用于补齐查询上下文,不会作为候选直接返回。
|
||||
|
||||
候选可以直接在 Earth 上预览。算力中心候选点击 `保存` 后会写入 `compute_center_locations` 维表,并立即刷新图层。算力中心图层左上角的通知气泡显示无法渲染的待定位数量;点击后可查看列表,单条采集候选,或用 `一键采用` 从上到下保存最高置信候选。没有可用候选的记录会留在列表中,不会被国家中心点或硬编码 hint 伪造位置。详细流程见 [Earth 位置候选采集使用手册](/home/ray/dev/linkong/planet/docs/technical/zh/location-pipeline-user.md)。
|
||||
|
||||
@@ -319,11 +320,10 @@ Earth 搜索支持查找当前地球对象,例如:
|
||||
|
||||
设置面板包含:
|
||||
|
||||
- 旋转模式 / 巡航模式
|
||||
- 巡航模块:BGP、新闻
|
||||
- 卫星显示风格:自身发光、真实地表覆盖
|
||||
- 日夜模式
|
||||
- 面板显示开关
|
||||
- 旋转模式 / 巡航模式 / 动捕模式
|
||||
- 巡航模块:BGP、新闻、算力中心、船只、海缆、卫星
|
||||
- 视图设置:卫星显示风格、日夜模式、面板显示开关
|
||||
- 动捕调试模式、动捕输入源、只显示骨骼
|
||||
- 地球默认大小
|
||||
- 地形透明度
|
||||
- 重置设置
|
||||
@@ -349,6 +349,30 @@ Earth 支持鼠标、触控板和触屏操作。
|
||||
|
||||
拖动灵敏度会根据当前缩放自动调整。默认视角附近保持常规旋转速度;放大后拖动会逐步变细,适合检查某个区域、船只、卫星或 BGP 事件;缩小后拖动会略快,方便快速浏览全球态势。
|
||||
|
||||
### 动作捕捉控制
|
||||
|
||||
Earth 预留了动作捕捉控制入口,面向大屏和未来 3D 展示。实时链路有两种输入源:默认的 `浏览器摄像头` 会直接用网页 `getUserMedia` 在本机浏览器识别;高级的 `Motion Agent` 会走 `摄像头/RTSP/HTTP -> 本地 Agent -> 本地 WebSocket -> Earth 页面`。两种模式都不会把摄像头帧或实时手势发到云端,也不会复用新闻/RSS 聚合接口。
|
||||
|
||||
默认不自动启用。打开设置里的 `动捕调试模式`,或用 `?motion=1` 打开 Earth 动捕连接后,系统会启动当前选择的输入源。输入源默认是 `浏览器摄像头`,无需安装应用,但页面必须运行在 HTTPS 或 localhost,且用户需要允许浏览器摄像头权限。需要双摄、USB index、手机/网络摄像头流或客户端/边缘设备时,可在设置中切到 `Motion Agent`。默认 Agent 地址是 `ws://127.0.0.1:8765/ws/gestures`,也可用 URL 参数 `motionAgent` 覆盖。
|
||||
|
||||
URL 参数也可以直接指定输入源:`?motion=1&motionProvider=browser` 使用浏览器摄像头;`?motion=1&motionProvider=agent` 使用 Motion Agent;传入 `motionAgent=ws://...` 时会自动选择 Motion Agent。
|
||||
|
||||
当前手势语义:
|
||||
|
||||
| 手势事件 | 作用 |
|
||||
| --- | --- |
|
||||
| `rotate_left` | 地球向左旋转 |
|
||||
| `rotate_right` | 地球向右旋转 |
|
||||
| `rotate_up` | 地球向上旋转 |
|
||||
| `rotate_down` | 地球向下旋转 |
|
||||
| `zoom_in` | 放大视角 |
|
||||
| `zoom_out` | 缩小视角 |
|
||||
| `focus_prev` / `focus_next` | 在当前动捕图层内切换可交互目标 |
|
||||
| `layer_prev` / `layer_next` | 切换动捕候选图层,并巡航到新图层最近目标 |
|
||||
| `confirm` | 确认当前已选目标;当前浏览器识别暂未启用双手上举确认 |
|
||||
|
||||
设置面板中的 `动捕调试模式` 会打开调试面板。浏览器摄像头输入源会在面板内显示本机实时预览,并在其上绘制关节点和连线;`Motion Agent` 输入源只发送归一化骨架事件,不发送原始视频帧。面板里的 `只显示骨骼` 会隐藏视频预览、只保留深色背景和骨架;`停止匹配动作` 会暂停手势触发,但摄像头预览和骨架绘制仍可继续用于调试。未匹配动作时骨架为红色,匹配后变绿并显示当前动作名称。该入口和 `动捕输入源` 控件都已预留 Gatekeeper 权限标记,后续可接入鉴权控制。
|
||||
|
||||
### 巡航模式
|
||||
|
||||
巡航模式会让 Earth 自动轮播聚焦目标。
|
||||
@@ -357,6 +381,10 @@ Earth 支持鼠标、触控板和触屏操作。
|
||||
|
||||
- BGP
|
||||
- 新闻
|
||||
- 算力中心
|
||||
- 船只
|
||||
- 海缆
|
||||
- 卫星
|
||||
|
||||
适合演示、监控大屏或无人值守展示。
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ wait_for_port_release() {
|
||||
- `PORT_PRESTART_RETRIES`:默认 3 次。
|
||||
- `PORT_PRESTART_RETRY_INTERVAL`:默认 2 秒。
|
||||
|
||||
`kill_port_if_requested()` 只在当前环境能找到监听 PID 时主动杀进程;如果没有 PID 但端口暂时不可绑定,它会记录诊断并把最终确认交给服务启动流程。`start_frontend_with_retry()` 也只在发现监听 PID 时进入预清理重试,避免在宿主机或外部 network namespace 尚未释放端口时做无意义的“空杀重试”。这意味着第一次重启时看到“未发现监听进程但端口仍不可绑定”通常是外部环境仍在释放端口;脚本不会再把这种情况当成立刻失败的本地进程清理问题。
|
||||
`kill_port_if_requested()` 优先清理当前环境能找到的监听 PID;只有检测到当前运行在 WSL 且没有可杀 PID、但端口仍不可绑定时,才会检查 Windows 侧 listener,并尝试通过 PowerShell 停止对应服务或强制结束对应进程。若没有权限,或 `iphlpsvc` 这类系统服务拒绝停止,脚本会打印 Windows listener 详情并立即停止启动,不再继续拉起服务碰同一个端口错误。非 WSL 环境不会尝试 Windows 清理路径。此时需要用管理员 PowerShell 清理 portproxy/服务占用,或改用其他端口。
|
||||
|
||||
## 问题三:端口检测用 Python
|
||||
|
||||
@@ -202,6 +202,92 @@ PY
|
||||
|
||||
修复戳文件路径后,无参 `restart` 同样使用 `stop + start`,fingerprint 检查正常生效,行为与 `restart -b` 完全一致。无需额外代码变更。
|
||||
|
||||
## Motion Agent 可选启动
|
||||
|
||||
`planet.sh` 现在可以管理本地动作捕捉 Agent,但默认不会启动它,避免普通开发机因为没有摄像头、OpenCV 或 MediaPipe 而影响后端/前端启动。
|
||||
|
||||
启动方式:
|
||||
|
||||
```bash
|
||||
./planet.sh start --motion-agent
|
||||
```
|
||||
|
||||
常用参数:
|
||||
|
||||
- `--motion-agent` / `-m`:随本次启动或重启拉起 Motion Agent。
|
||||
- `--motion-agent-port <端口>`:覆盖默认 WebSocket 端口 `8765`。
|
||||
- `--motion-agent-camera-indexes <indexes>`:覆盖自动发现的摄像头 index,例如 `0` 或 `0,1`。也可以用环境变量 `MOTION_AGENT_CAMERA_INDEXES=0,1`。
|
||||
- `--motion-agent-camera-urls <urls>`:使用 RTSP/HTTP 摄像头流,适合 WSL、手机摄像头或网络摄像头。也可以用环境变量 `MOTION_AGENT_CAMERA_URLS=...`。
|
||||
- `--motion-agent-dry-run`:不打开摄像头、不加载 CV 依赖,只启动协议服务,适合调试 Web 端连接。
|
||||
|
||||
非 dry-run 的 live 模式会在启动前检查 `mediapipe` 和 `opencv-python`。如果当前 `.venv` 缺包,脚本会自动执行:
|
||||
|
||||
```bash
|
||||
uv add mediapipe opencv-python
|
||||
```
|
||||
|
||||
如需禁止启动时自动安装,可设置:
|
||||
|
||||
```bash
|
||||
PLANET_MOTION_AGENT_AUTO_INSTALL=0 ./planet.sh start --motion-agent
|
||||
```
|
||||
|
||||
live 模式会自动寻找 `/dev/video*`,优先取前两个 index 传给 Motion Agent。在 WSL 中,Windows 摄像头通常不会自动出现在 `/dev/video*`。可先用下面命令看设备:
|
||||
|
||||
```bash
|
||||
ls /dev/video*
|
||||
```
|
||||
|
||||
如需覆盖自动发现结果,可手动指定 index:
|
||||
|
||||
```bash
|
||||
./planet.sh start --motion-agent --motion-agent-camera-indexes 1,2
|
||||
```
|
||||
|
||||
WSL 下更通用的方式是把手机摄像头或网络摄像头以 RTSP/HTTP 流接入:
|
||||
|
||||
```bash
|
||||
./planet.sh start --motion-agent --motion-agent-camera-urls http://192.168.1.20:8080/video
|
||||
```
|
||||
|
||||
如果 WSL 中没有发现 `/dev/video*`,且没有提供 `--motion-agent-camera-urls`,脚本会停止 live 启动并提示处理方式,不会自动降级为 dry-run。可选处理:
|
||||
|
||||
```bash
|
||||
./planet.sh start --motion-agent --motion-agent-camera-urls http://<手机IP>:8080/video
|
||||
./planet.sh start --motion-agent --motion-agent-dry-run
|
||||
```
|
||||
|
||||
只有显式设置 `PLANET_MOTION_AGENT_WSL_ALLOW_DRY_RUN_FALLBACK=1` 时,WSL 无摄像头才会自动降级。
|
||||
|
||||
也可以用环境变量启用:
|
||||
|
||||
```bash
|
||||
PLANET_START_MOTION_AGENT=1 ./planet.sh start
|
||||
MOTION_AGENT_DRY_RUN=1 PLANET_START_MOTION_AGENT=1 ./planet.sh start
|
||||
```
|
||||
|
||||
日志入口:
|
||||
|
||||
```bash
|
||||
./planet.sh log -m
|
||||
```
|
||||
|
||||
和前端一起开放局域网时:
|
||||
|
||||
```bash
|
||||
./planet.sh start --allow-lan --motion-agent
|
||||
```
|
||||
|
||||
此时 Motion Agent 会绑定 `0.0.0.0`,启动输出会同时显示本机 WebSocket 地址和推荐局域网 WebSocket 地址。局域网浏览器访问 Earth 时,需要把 `motionAgent` 参数指向这台大屏主机,例如:
|
||||
|
||||
```text
|
||||
http://<LAN_IP>:3000/earth?motion=1&motionAgent=ws://<LAN_IP>:8765/ws/gestures
|
||||
```
|
||||
|
||||
停止时 `./planet.sh stop` 会一并停止已由脚本启动的 Motion Agent。健康检查会显示 `Motion Agent` 的 online/offline 状态。Earth 页面仍需用 `?motion=1` 或浏览器本地存储显式启用 Web 端连接。
|
||||
|
||||
如果只是普通网页/WSL/无安装演示场景,可以不启动 Motion Agent,直接在 Earth 设置里选择 `浏览器摄像头` 输入源并打开动捕调试模式;该路线使用浏览器 `getUserMedia`,需要 HTTPS 或 localhost 和摄像头权限。
|
||||
|
||||
## 其他:移除不必要的 sleep
|
||||
|
||||
启动链路中两处 `sleep 3` 在实际已有健康检查覆盖的情况下多余,已移除:
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
这份快速开始面向第一次启动 Planet 的开发者或演示操作者。目标是用最短路径把服务跑起来,并知道应该打开哪些入口。
|
||||
|
||||
如果遇到端口占用、Windows / WSL 局域网访问、`uv` / `bun`、摄像头或 Docs 权限问题,先看 [常见问题](/home/ray/dev/linkong/planet/docs/technical/zh/faq.md)。
|
||||
|
||||
## 前置条件
|
||||
|
||||
推荐在 WSL / Linux shell 中运行。
|
||||
@@ -64,6 +66,8 @@ export BARENTSWATCH_CLIENT_SECRET="..."
|
||||
./planet.sh start -f 3001 -b 8001 -a 8101
|
||||
```
|
||||
|
||||
后端 `8000` 被 Windows listener 或旧 portproxy 占用时,排查顺序见 [常见问题](/home/ray/dev/linkong/planet/docs/technical/zh/faq.md)。
|
||||
|
||||
## 2. 创建登录用户
|
||||
|
||||
控制台需要登录。首次使用可以执行:
|
||||
@@ -91,9 +95,9 @@ Earth 是公开页面,不需要登录。
|
||||
- 地球正常显示
|
||||
- 右侧图层控制可打开/关闭图层
|
||||
- 搜索可以查找海缆、卫星、算力中心、BGP 事件
|
||||
- 算力中心和 BGP 观测站详情卡可以自动采集并预览坐标候选;算力中心待定位气泡可以打开列表并保存候选
|
||||
- 算力中心和 BGP 观测站详情卡可以自动采集并预览坐标候选;常规来源无候选时会用当前默认 AI Provider 做 LLM factcheck 兜底;算力中心待定位气泡可以打开列表并保存候选
|
||||
- 鼠标拖动、滚轮缩放和缩放百分比提示正常工作
|
||||
- 设置面板可以切换巡航模式、日夜模式、卫星显示风格
|
||||
- 设置面板可以切换旋转 / 巡航 / 动捕模式、日夜模式、卫星显示风格;动捕调试模式下浏览器摄像头可显示本机预览和骨架
|
||||
|
||||
## 4. 打开控制台
|
||||
|
||||
|
||||
Reference in new issue
Block a user