fix: resolve port conflict (mana-image-gen 3025→3026) and replace APP_URLS with internal routes

- mana-image-gen: change default port from 3025 to 3026 to avoid conflict with mana-llm
- Dashboard widgets (12): replace APP_URLS.{app}.dev/prod with internal route paths (/todo, /calendar, etc.)
  and remove target="_blank" since all apps are now internal routes in the unified app
- Home page: use goto() for internal apps, keep window.open() only for external apps (matrix, arcade)
- AppRow: remove unused APP_URLS import

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Till JS 2026-04-02 12:56:37 +02:00
parent 67567605fa
commit 35f4bd48de
18 changed files with 48 additions and 137 deletions

View file

@ -4,7 +4,7 @@
AI image generation microservice using FLUX.2 klein 4B model via flux2.c:
- **Port**: 3025
- **Port**: 3026
- **Framework**: Python + FastAPI
- **Model**: FLUX.2 klein 4B (Black Forest Labs)
- **Backend**: flux2.c (Pure C, MPS accelerated)
@ -26,14 +26,14 @@ AI image generation microservice using FLUX.2 klein 4B model via flux2.c:
# Development
source .venv/bin/activate
FLUX_BINARY=/opt/flux2/flux FLUX_MODEL_DIR=/opt/flux2/model \
uvicorn app.main:app --host 0.0.0.0 --port 3025 --reload
uvicorn app.main:app --host 0.0.0.0 --port 3026 --reload
# Production
../../scripts/mac-mini/setup-image-gen.sh
# Test
curl http://localhost:3025/health
curl -X POST http://localhost:3025/generate \
curl http://localhost:3026/health
curl -X POST http://localhost:3026/generate \
-H "Content-Type: application/json" \
-d '{"prompt": "A cat in space"}' | jq
```
@ -95,7 +95,7 @@ services/mana-image-gen/
| Variable | Default | Description |
|----------|---------|-------------|
| `PORT` | `3025` | Service port |
| `PORT` | `3026` | Service port |
| `FLUX_BINARY` | `/opt/flux2/flux` | Path to flux2.c binary |
| `FLUX_MODEL_DIR` | `/opt/flux2/model` | Path to model weights |
| `DEFAULT_STEPS` | `4` | Default sampling steps |
@ -128,7 +128,7 @@ The service is designed to be used by:
### Example Integration (TypeScript)
```typescript
const response = await fetch('http://localhost:3025/generate', {
const response = await fetch('http://localhost:3026/generate', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
@ -139,7 +139,7 @@ const response = await fetch('http://localhost:3025/generate', {
});
const result = await response.json();
const imageUrl = `http://localhost:3025${result.image_url}`;
const imageUrl = `http://localhost:3026${result.image_url}`;
```
## Dependencies

View file

@ -25,10 +25,10 @@ Local AI image generation using **FLUX.2 klein 4B** model via flux2.c.
# 2. Start the service
source .venv/bin/activate
FLUX_BINARY=/opt/flux2/flux FLUX_MODEL_DIR=/opt/flux2/model \
uvicorn app.main:app --host 0.0.0.0 --port 3025
uvicorn app.main:app --host 0.0.0.0 --port 3026
# 3. Generate an image
curl -X POST http://localhost:3025/generate \
curl -X POST http://localhost:3026/generate \
-H "Content-Type: application/json" \
-d '{"prompt": "A cat wearing sunglasses"}' | jq
```
@ -87,7 +87,7 @@ GET /models
| Variable | Default | Description |
|----------|---------|-------------|
| `PORT` | `3025` | Service port |
| `PORT` | `3026` | Service port |
| `FLUX_BINARY` | `/opt/flux2/flux` | flux2.c binary path |
| `FLUX_MODEL_DIR` | `/opt/flux2/model` | Model weights path |
| `DEFAULT_STEPS` | `4` | Sampling steps |

View file

@ -40,7 +40,7 @@ logging.basicConfig(
logger = logging.getLogger(__name__)
# Configuration from environment
PORT = int(os.getenv("PORT", "3025"))
PORT = int(os.getenv("PORT", "3026"))
MAX_PROMPT_LENGTH = int(os.getenv("MAX_PROMPT_LENGTH", "2000"))
MIN_DIMENSION = int(os.getenv("MIN_DIMENSION", "256"))
MAX_DIMENSION = int(os.getenv("MAX_DIMENSION", "2048"))

View file

@ -212,16 +212,16 @@ echo "To start the service:"
echo ""
echo " cd $SCRIPT_DIR"
echo " source .venv/bin/activate"
echo " FLUX_BINARY=$FLUX_DIR/flux FLUX_MODEL_DIR=$MODEL_DIR uvicorn app.main:app --host 0.0.0.0 --port 3025"
echo " FLUX_BINARY=$FLUX_DIR/flux FLUX_MODEL_DIR=$MODEL_DIR uvicorn app.main:app --host 0.0.0.0 --port 3026"
echo ""
echo "Or for development with auto-reload:"
echo ""
echo " FLUX_BINARY=$FLUX_DIR/flux FLUX_MODEL_DIR=$MODEL_DIR uvicorn app.main:app --host 0.0.0.0 --port 3025 --reload"
echo " FLUX_BINARY=$FLUX_DIR/flux FLUX_MODEL_DIR=$MODEL_DIR uvicorn app.main:app --host 0.0.0.0 --port 3026 --reload"
echo ""
echo "Test the service:"
echo ""
echo " curl http://localhost:3025/health"
echo " curl -X POST http://localhost:3025/generate \\"
echo " curl http://localhost:3026/health"
echo " curl -X POST http://localhost:3026/generate \\"
echo " -H 'Content-Type: application/json' \\"
echo " -d '{\"prompt\": \"A cat wearing sunglasses\"}'"
echo ""