cf-removal: patch registry, pipeline, settings, admin-page, interface
Wires out the Cloudflare Workers AI image provider across the plugin: - class-image-pipeline.php: drop 'cloudflare' dispatch branch; Runware becomes the unrecognised-provider fallback - class-image-model-registry.php: remove flux-1-schnell/cloudflare row; update provider-enum docblocks (runware|openrouter only) - class-settings-fields-extended.php: remove three CF fields (cloudflare_ai_token, cloudflare_account_id, cf_image_via_gateway); drop Cloudflare mention from model-picker + NSFW retry descriptions - class-admin-page.php: remove prautoblogger_cloudflare_ai_token from the encrypted-options list - interface-image-provider.php: retarget preamble @see at Runware + OpenRouter; update get_provider_name() example - class-image-nsfw-blocked.php: generalise preamble (Runware + OpenRouter can raise this) Also cleans stale CF Workers AI mentions in: class-ajax-handlers.php, interface-model-registry.php, class-image-nsfw-retry.php, class-open-router-image-pricing.php, prautoblogger.php. The Cloudflare AI Gateway path (in class-open-router-config.php, class-settings-fields.php 'prautoblogger_ai_gateway_base_url', class-open-router-request-builder.php cache headers) is intentionally untouched — it fronts OpenRouter and is unrelated to the CF Workers AI image provider.
This commit is contained in:
@@ -4,18 +4,18 @@ declare(strict_types=1);
|
||||
/**
|
||||
* Exception raised when an image provider rejects a prompt as NSFW.
|
||||
*
|
||||
* Cloudflare Workers AI returns HTTP 400 with an `errors[].code === 3030`
|
||||
* body when its content filter blocks a prompt. We catch that shape in
|
||||
* the provider and raise this typed exception so the image pipeline can
|
||||
* distinguish a content-filter rejection from a generic 4xx and retry
|
||||
* once with a sanitized fallback prompt.
|
||||
* Image providers (Runware, OpenRouter) return provider-specific error
|
||||
* shapes when their content filters block a prompt. We catch those shapes
|
||||
* in each provider and raise this typed exception so the image pipeline
|
||||
* can distinguish a content-filter rejection from a generic 4xx and
|
||||
* retry once with a sanitized fallback prompt.
|
||||
*
|
||||
* Triggered by: PRAutoBlogger_Cloudflare_Image_Provider on NSFW 4xx.
|
||||
* Triggered by: image providers on NSFW-filter rejection.
|
||||
* Dependencies: None.
|
||||
*
|
||||
* @see providers/class-cloudflare-image-provider.php — Raises this.
|
||||
* @see core/class-image-nsfw-retry.php — Catches + rebuilds prompt.
|
||||
* @see https://developers.cloudflare.com/workers-ai/models/flux-1-schnell/ — Upstream error codes.
|
||||
* @see providers/class-runware-image-provider.php — May raise this.
|
||||
* @see providers/class-open-router-image-provider.php — May raise this.
|
||||
* @see core/class-image-nsfw-retry.php — Catches + rebuilds prompt.
|
||||
*/
|
||||
class PRAutoBlogger_Image_NSFW_Blocked extends \RuntimeException {
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ declare(strict_types=1);
|
||||
/**
|
||||
* Pricing + model-id resolution helpers for the OpenRouter image provider.
|
||||
*
|
||||
* Mirrors the Cloudflare pricing helper pattern. Each model's cost per image
|
||||
* Mirrors the Runware pricing helper pattern. Each model's cost per image
|
||||
* is a flat rate sourced from OpenRouter's pricing page (April 2026).
|
||||
*
|
||||
* Triggered by: PRAutoBlogger_OpenRouter_Image_Provider (both generate_image()
|
||||
@@ -12,7 +12,7 @@ declare(strict_types=1);
|
||||
* Dependencies: None — pure calculation + option reads.
|
||||
*
|
||||
* @see class-openrouter-image-provider.php — Caller.
|
||||
* @see class-cloudflare-image-pricing.php — Sibling pattern for Cloudflare.
|
||||
* @see class-runware-image-pricing.php — Sibling pattern for Runware.
|
||||
*/
|
||||
class PRAutoBlogger_OpenRouter_Image_Pricing {
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Contract for any image generation provider (Cloudflare Workers AI, DALL-E, etc.).
|
||||
* Contract for any image generation provider (Runware FLUX, OpenRouter Gemini, etc.).
|
||||
*
|
||||
* Consumers depend on this interface, never on a concrete provider — swapping
|
||||
* providers means writing one new class, not refactoring the pipeline. This
|
||||
@@ -13,7 +13,8 @@ declare(strict_types=1);
|
||||
* content generation run, after editorial review, before publish.
|
||||
* Dependencies: None at interface level — implementations wrap a specific HTTP API.
|
||||
*
|
||||
* @see class-cloudflare-image-provider.php — Cloudflare Workers AI implementation.
|
||||
* @see class-runware-image-provider.php — Runware FLUX implementation (default).
|
||||
* @see class-open-router-image-provider.php — OpenRouter image implementation.
|
||||
* @see interface-llm-provider.php — Parallel pattern for LLM providers.
|
||||
* @see ARCHITECTURE.md — External API Integrations table.
|
||||
*/
|
||||
@@ -79,7 +80,7 @@ interface PRAutoBlogger_Image_Provider_Interface {
|
||||
/**
|
||||
* Machine-readable provider identifier used in logs and settings.
|
||||
*
|
||||
* @return string Lowercase identifier, e.g. 'cloudflare_workers_ai'.
|
||||
* @return string Lowercase identifier, e.g. 'runware' or 'openrouter'.
|
||||
*/
|
||||
public function get_provider_name(): string;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user