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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 0 additions & 59 deletions .github/workflows/api-tests.yml

This file was deleted.

51 changes: 0 additions & 51 deletions .github/workflows/web-tests.yml

This file was deleted.

2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ Use the checklist in [`.github/PULL_REQUEST_TEMPLATE.md`](./.github/PULL_REQUEST

## Intelligence providers

Design Runtime calls `packages/intelligence-client` (`DesignIntelligenceClient`). The default is **BasicLocal** (in-repo, no network). Optional remote providers use `RECOMBYN_INTELLIGENCE_MODE=cloud` + `RECOMBYN_INTELLIGENCE_URL` (legacy `INTELLIGENCE_*` still accepted) and must implement the open `IntelligenceProvider` protocol — see [ADR 0017](./docs/adr/0017-intelligence-provider-boundary.md). Compose override: `docker-compose.intelligence.yml` (`--profile intelligence`). **Do not** add docs that describe closed / proprietary provider internals in this repository.
Design Runtime calls `packages/intelligence-client` (`DesignIntelligenceClient`). The default is **BasicLocal** (in-repo, no network). Optional remote providers use `RECOMBYN_INTELLIGENCE_MODE=cloud` + `RECOMBYN_INTELLIGENCE_URL` and must implement the open `IntelligenceProvider` protocol — see [ADR 0017](./docs/adr/0017-intelligence-provider-boundary.md). Compose override: `docker-compose.intelligence.yml` (`--profile intelligence`). **Do not** add docs that describe closed / proprietary provider internals in this repository.

Shared wire contract lives in `packages/protocol` (`recombyn-protocol`). Bump its version when method names / request keys / usable rules change ([ADR 0024](./docs/adr/0024-protocol-version-cross-repo-ci.md)). Operators who maintain a private Intelligence service should depend on that package and run compatibility tests against it — do not hand-copy method lists into closed repos.

Expand Down
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,35 @@ docker compose up -d --build

More options (env, LLM keys, production hardening): **[docs/self-hosting.md](docs/self-hosting.md)** · Postgres: **[docs/postgres-switch.md](docs/postgres-switch.md)**

### Compose recipes

Use `docker-compose.yml` as the base stack, then layer overrides only when needed:

```bash
# 1) Base self-host stack (web + api + collab + mysql + redis + worker)
docker compose -f docker-compose.yml up -d --build

# 2) Base + ClamAV upload scanning
docker compose --profile av \
-f docker-compose.yml \
-f docker-compose.av.yml \
up -d --build

# 3) Base + external/sibling intelligence provider service
docker compose --profile intelligence \
-f docker-compose.yml \
-f docker-compose.intelligence.yml \
up -d --build

# 4) Base stack from pre-built GHCR images (skip local image builds)
docker compose -f docker-compose.yml -f docker-compose.ghcr.yml pull
docker compose -f docker-compose.yml -f docker-compose.ghcr.yml up -d
```

Tip: if you layer `*.av.yml` or `*.intelligence.yml`, keep the matching profile flag (`--profile av` / `--profile intelligence`) in the same command.

Env tip: keep Compose variables in repo-root `.env` (for example `RECOMBYN_TAG`, `RECOMBYN_INTELLIGENCE_*`) and API app variables in `apps/api/.env`; avoid passing env values inline in shell commands.

### Local development

```bash
Expand Down
8 changes: 2 additions & 6 deletions apps/api/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ENABLE_SAM=false
ENABLE_LAMA=false
LAMA_USE_SAM_MASK=true

# Object storage (S3-compatible). Empty = local disk.
# Object storage (S3-style). Empty = local disk.
S3_ENABLED=false
# S3_ENDPOINT_URL=
# S3_ACCESS_KEY=
Expand Down Expand Up @@ -45,16 +45,12 @@ S3_ENABLED=false
# DESIGN_PLUGIN_DISK_INSTALL=false
# AGENT_PROFILE_ID=design.canvas
# Design Intelligence client (ADR 0017). local = BasicLocal (default).
# Prefer RECOMBYN_INTELLIGENCE_*; legacy INTELLIGENCE_* still accepted.
# Prefer RECOMBYN_INTELLIGENCE_*.
# remote|cloud → HTTP provider implementing open IntelligenceProvider methods.
# RECOMBYN_INTELLIGENCE_MODE=local
# RECOMBYN_INTELLIGENCE_URL=
# RECOMBYN_INTELLIGENCE_API_KEY=
# RECOMBYN_INTELLIGENCE_TIMEOUT_SEC=30
# INTELLIGENCE_PROVIDER=local
# INTELLIGENCE_REMOTE_URL=
# INTELLIGENCE_REMOTE_API_KEY=
# INTELLIGENCE_REMOTE_TIMEOUT_SEC=30
# DESIGN_CRITIQUE_ENABLED=true
# DESIGN_REVIEW_AGENT_ENABLED=true
# DESIGN_GRAPH_NODE_TIMEOUT_SEC=180
Expand Down
5 changes: 2 additions & 3 deletions apps/api/app/api/routes/admin/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ class AdjustTokensIn(BaseModel):

class GenerateCardKeysIn(BaseModel):
count: int = Field(default=10, ge=1, le=100)
"""credit = unified 积分 top-up; plan = membership + monthly 积分; token = legacy alias of credit."""
"""credit = unified 积分 top-up; plan = membership + monthly 积分."""
kind: str = Field(default="credit", max_length=16)
# Face value in 积分 (legacy million-Token faces are converted server-side).
# Face value in 积分.
tokens: int = Field(default=0, ge=0, le=50_000_000)
planId: str | None = Field(default=None, max_length=16)
expiresDays: int = Field(default=365, ge=0, le=3650)
Expand Down Expand Up @@ -220,7 +220,6 @@ class RuntimeSettingIn(BaseModel):
"precheck.user_preset.balanced",
"precheck.user_preset.quality",
"assets.image_default_model",
"byok.preset_providers",
"byok.preset_platforms",
}
)
Expand Down
2 changes: 1 addition & 1 deletion apps/api/app/api/routes/admin/design.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def admin_design_stage_reviews(
minRating: int | None = Query(default=None, ge=1, le=5),
maxRating: int | None = Query(default=None, ge=1, le=5),
) -> dict[str, Any]:
"""Historical stage ratings (legacy training runs)."""
"""Historical stage ratings."""
return list_stage_reviews(
page=page,
page_size=pageSize,
Expand Down
5 changes: 1 addition & 4 deletions apps/api/app/api/routes/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ class EmailActivateIn(BaseModel):

@router.post("/email/activate", response_model=AuthSessionOut)
def email_activate(body: EmailActivateIn, request: Request) -> dict[str, Any]:
"""Consume one-time /activate/{{id}} link → session (legacy magic-link mails)."""
"""Consume one-time /activate/{{id}} link → session (email magic-link mails)."""
ip = _client_ip(request)
try:
email = consume_activate_token(body.id)
Expand Down Expand Up @@ -582,7 +582,6 @@ def wallet_me(current_user: CurrentUser) -> dict[str, Any]:
return {
"credits": credits,
"tokens": credits,
"imageCredits": credits,
**_wallet_plan_fields(snap),
"ledger": list_ledger(current_user.id),
}
Expand All @@ -605,7 +604,6 @@ def wallet_ledger(
return {
"credits": credits,
"tokens": credits,
"imageCredits": credits,
**_wallet_plan_fields(snap),
**list_ledger_page(current_user.id, page=page, page_size=pageSize, kind=kind),
}
Expand Down Expand Up @@ -650,7 +648,6 @@ def wallet_redeem(
"tokensAdded": added,
"credits": credits,
"tokens": credits,
"imageCredits": credits,
**_wallet_plan_fields(snap),
"ledger": list_ledger(current_user.id),
}
Expand Down
29 changes: 6 additions & 23 deletions apps/api/app/api/routes/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,9 @@
from app.services.llm.usage_log import bind_usage_context
from app.services.wallet.db import (
consume_free_daily_quota,
get_user_image_credits,
get_user_plan,
get_user_tokens,
is_wallet_billing_enabled,
spend_image_credits,
spend_tokens,
)

Expand Down Expand Up @@ -110,19 +108,6 @@ def _charge(user_id: str, amount: int, detail: str) -> None:
raise HTTPException(status_code=400, detail=str(err)) from err


def _charge_image_credits(user_id: str, amount: int, detail: str) -> None:
if amount <= 0 or not is_wallet_billing_enabled():
return
try:
spend_image_credits(user_id, amount, detail)
except ValueError as err:
if str(err) == "insufficient_image_credits":
raise HTTPException(status_code=402, detail="Insufficient credits") from err
raise HTTPException(status_code=400, detail=str(err)) from err




def _charge_image(
user_id: str,
requested_model: str | None,
Expand All @@ -146,9 +131,9 @@ def _charge_image(
if plan == "free":
mid = _FREE_IMAGE_MODEL
cost = image_model_credit_cost(mid, count=n, resolution=resolution)
bal = get_user_image_credits(user_id)
bal = get_user_tokens(user_id)
if bal >= cost:
_charge_image_credits(user_id, cost, "AI image generation")
_charge(user_id, cost, "AI image generation")
return mid, cost
if consume_free_daily_quota(user_id):
return mid, 0
Expand All @@ -162,7 +147,7 @@ def _charge_image(
if mid
else DEFAULT_IMAGE_CREDITS * n
)
_charge_image_credits(user_id, cost, "AI image generation")
_charge(user_id, cost, "AI image generation")
return mid, cost


Expand All @@ -182,7 +167,7 @@ def _charge_video(
else DEFAULT_IMAGE_CREDITS
)
cost = max(DEFAULT_IMAGE_CREDITS, int(cost or DEFAULT_IMAGE_CREDITS))
_charge_image_credits(user_id, cost, "AI video generation")
_charge(user_id, cost, "AI video generation")
return requested, cost


Expand All @@ -192,7 +177,7 @@ def _charge_audio(user_id: str, requested_model: str | None) -> tuple[str | None
if is_desktop_local() or uses_user_platform_byok(user_id, requested):
return requested, 0
cost = max(DEFAULT_IMAGE_CREDITS, int(DEFAULT_IMAGE_CREDITS or 1))
_charge_image_credits(user_id, cost, "AI audio generation")
_charge(user_id, cost, "AI audio generation")
return requested, cost


Expand All @@ -210,7 +195,7 @@ def get_models(
platforms_payload = list_byok_platforms()

# Local desktop: no platform catalog (even if machine .env has provider keys).
# End users add OpenAI-compatible BYOK in Agent settings; FE merges vault models.
# End users add OpenAI-style BYOK in Agent settings; FE merges vault models.
if is_desktop_local():
return {
"models": [],
Expand All @@ -221,7 +206,6 @@ def get_models(
"clientRegion": "local",
"openrouterAvailable": False,
"byokPlatforms": platforms_payload,
"byokPresets": platforms_payload,
}

from app.services.geoip import (
Expand Down Expand Up @@ -258,7 +242,6 @@ def get_models(
"clientRegion": country,
"openrouterAvailable": or_ok,
"byokPlatforms": platforms_payload,
"byokPresets": platforms_payload,
}

@router.post("/message")
Expand Down
Loading
Loading