diff --git a/docs/my-resources.md b/docs/my-resources.md index 5e9fe766..b42ab794 100644 --- a/docs/my-resources.md +++ b/docs/my-resources.md @@ -272,6 +272,37 @@ tiles cost a few kB each rather than thirty full-size downloads. Every fetch goes through `hydrateImage`, never a bare `src`: assets are served `no-store` and a bare `src` would not carry the session on a mobile client. +### Image model fallbacks + +Every workflow tries its configured model first, then each fallback in order, +stopping at the first that produces an image. Primary plus two, capped — each +hop is a paid request. Set in **Admin → Image models**. + +A fallback is only tried where another model has a real chance: + +| Failure | Next model? | Why | +|---|---|---| +| Timeout, 429, 5xx, network fault | yes | The provider said "not now", not "not ever" | +| 404 — the gateway does not have that model | yes | A configuration mistake the next model rescues | +| A content refusal | yes | Policy is a vendor decision, not a fact about the request | +| 401 / 403 | **no** | One gateway, one set of credentials; the next model fails identically | +| 413 — too large | **no** | It is too large everywhere | +| Any other 4xx | **no** | Malformed is malformed everywhere | +| Cancelled, or shutting down | **no** | Never start more paid work | + +A refusal is recognised from the message, because no provider sends a +machine-readable reason and the status varies — 400 from some, 422 from others. + +Each hop re-leases the job, so a chain cannot outlive its claim and let a second +worker repeat the same paid work; if the lease has gone the attempt stops there +rather than paying again. The row records the model actually being paid for, so +a picture made by the third model is not attributed to the first, and every hop +is logged with the reason it moved on. + +This used to be the Clinical Assistant alone, with one fallback. My Resources +had none at all — which is where a missing picture is most visible, because it +leaves a hole in a slide. + ### Deleting `DELETE /api/generated-images/:id` removes the bytes before the row, and refuses diff --git a/public/components/my-resources.html b/public/components/my-resources.html index b07dbba6..a2e2a9f8 100644 --- a/public/components/my-resources.html +++ b/public/components/my-resources.html @@ -177,7 +177,7 @@