SUI-612: aiprovider_eledia generate_image (image processor, file storage, privacy) #102

Merged
johannes.moskaliuk merged 1 commit from dev/sven/SUI-612 into main 2026-08-04 19:50:42 +00:00

SUI-612 — aiprovider_eledia: generate_image

Stage 2 unter SUI-611 (Option B). Implementiert die core_ai-Aktion generate_image über das LiteLLM-Gateway.

Änderungen

  • Endpoint-Wahl aus abstract_processor gelöst: get_endpoint_url() überschreibbar, Configured-Check generisch; neuer quotageschützter Hook finalize_success(). Text-Prozessoren bleiben verhaltensgleich (Default-No-op).
  • provider::get_image_generation_endpoint() (teilt die https-Allow-List / Suffix-Idempotenz des Chat-Endpoints via build_endpoint()).
  • process_generate_image: Request prompt/n=1/size (aus Seitenverhältnis)/response_format=b64_json; parst base64 oder URL; Ablage inkl. Core-Wasserzeichen im User-Draft-Bereich (component=user, filearea=draft) als stored_file für die aufrufende Placement. Genau ein Bild pro Aufruf (core_ai-Bildantwort trägt eine Datei).
  • Quota pro Bild über guarded local_elediaai_core\local\quota_manager::action_cost('generate_image', ['size'=>…, 'numimages'=>1]) (Schnittstelle aus SUI-613, PR #99), token-äquivalent über die bestehende generische reserve/commit gebucht; konservativer Fallback bis SUI-613 gemerged ist.
  • Privacy-Metadata deckt Bildeingaben mit ab; generierte Bilder liegen im core-verwalteten Draft-Bereich (kein plugin-lokaler Speicher).
  • Fehlerpfade 401/402/429/generisch 4.5-/5.x-kompatibel (wiederverwendetes Mapping).
  • version.php 0.1.9 → 0.2.0; DevFlow-Doku (00 adr06, 01 feat06, 02, 03, 04 task07, 05 test09) und CHANGELOG aktualisiert.

Tests / Checks

  • Lokal grün gegen Moodle 5.2 (Docker demo-webserver-1): PHPUnit-Suite aiprovider_eledia_testsuite 38/38, phpcs --standard=moodle 17/17, php -l und git diff --check sauber.
  • Neuer process_generate_image_test.php: Endpoint-Wahl, calculate_size, Request-Bau, b64-/URL-Mapping, Fehlerabbildung, Draft-Datei-Ablage. Zusätzlich provider_test/processor_test an das SUI-71-Mapping angepasst.
  • E2E gegen ein echtes Bildmodell hängt an der Gateway-Freischaltung (Infra/Johannes) und läuft über den Parent SUI-611.

Head-SHA: eba8a2af70

Refs SUI-612

## SUI-612 — aiprovider_eledia: generate_image Stage 2 unter SUI-611 (Option B). Implementiert die core_ai-Aktion `generate_image` über das LiteLLM-Gateway. ### Änderungen - Endpoint-Wahl aus `abstract_processor` gelöst: `get_endpoint_url()` überschreibbar, Configured-Check generisch; neuer quotageschützter Hook `finalize_success()`. Text-Prozessoren bleiben verhaltensgleich (Default-No-op). - `provider::get_image_generation_endpoint()` (teilt die https-Allow-List / Suffix-Idempotenz des Chat-Endpoints via `build_endpoint()`). - `process_generate_image`: Request `prompt`/`n=1`/`size` (aus Seitenverhältnis)/`response_format=b64_json`; parst base64 **oder** URL; Ablage inkl. Core-Wasserzeichen im User-Draft-Bereich (`component=user`, `filearea=draft`) als `stored_file` für die aufrufende Placement. Genau ein Bild pro Aufruf (core_ai-Bildantwort trägt eine Datei). - Quota pro Bild über guarded `local_elediaai_core\local\quota_manager::action_cost('generate_image', ['size'=>…, 'numimages'=>1])` (Schnittstelle aus SUI-613, PR #99), token-äquivalent über die bestehende generische reserve/commit gebucht; konservativer Fallback bis SUI-613 gemerged ist. - Privacy-Metadata deckt Bildeingaben mit ab; generierte Bilder liegen im core-verwalteten Draft-Bereich (kein plugin-lokaler Speicher). - Fehlerpfade 401/402/429/generisch 4.5-/5.x-kompatibel (wiederverwendetes Mapping). - `version.php` 0.1.9 → 0.2.0; DevFlow-Doku (00 adr06, 01 feat06, 02, 03, 04 task07, 05 test09) und CHANGELOG aktualisiert. ### Tests / Checks - Lokal grün gegen Moodle 5.2 (Docker `demo-webserver-1`): PHPUnit-Suite `aiprovider_eledia_testsuite` 38/38, phpcs `--standard=moodle` 17/17, `php -l` und `git diff --check` sauber. - Neuer `process_generate_image_test.php`: Endpoint-Wahl, `calculate_size`, Request-Bau, b64-/URL-Mapping, Fehlerabbildung, Draft-Datei-Ablage. Zusätzlich `provider_test`/`processor_test` an das SUI-71-Mapping angepasst. - E2E gegen ein echtes Bildmodell hängt an der Gateway-Freischaltung (Infra/Johannes) und läuft über den Parent SUI-611. Head-SHA: eba8a2af70b011cc8d94d65f06d2a16514af5038 Refs SUI-612
feat(aiprovider_eledia): add generate_image processor with draft-file storage
Some checks failed
Repo-Gates / gates (push) Has been cancelled
Repo-Gates / Notify CI-Fixer (push) Has been cancelled
Repo-Gates / gates (pull_request) Has been cancelled
Repo-Gates / Notify CI-Fixer (pull_request) Has been cancelled
PHPCS quality / PHPCS ratchet (push) Has been cancelled
PHPCS quality / PHPCS full scan (push) Has been cancelled
PHPCS quality / Notify CI-Fixer (push) Has been cancelled
Moodle Plugin CI / changes (pull_request) Has been cancelled
Moodle Plugin CI / Notify CI-Fixer (pull_request) Has been cancelled
PHPCS quality / PHPCS ratchet (pull_request) Has been cancelled
PHPCS quality / PHPCS full scan (pull_request) Has been cancelled
PHPCS quality / Notify CI-Fixer (pull_request) Has been cancelled
b0ad200339
Support the core_ai generate_image action over the LiteLLM
/images/generations endpoint. The endpoint choice is lifted out of
abstract_processor via an overridable get_endpoint_url(), and a new
quota-protected finalize_success() hook runs inside the reserve/commit
bracket; text processors stay behaviourally identical.

process_generate_image builds the image request (n=1, size from aspect
ratio, response_format=b64_json), parses base64 or URL responses, adds the
core AI watermark and stores the image in the requesting user's draft file
area. Per-image quota cost resolves via a guarded
quota_manager::estimate_image_tokens() (local_elediaai_core, SUI-613) with a
conservative fallback. Error paths (401/402/429/generic) remain 4.5/5.x
compatible; privacy metadata now covers image prompts. Adds unit tests for
request building, b64/URL mapping, error mapping and draft-file storage, and
realigns the sparse-success text stub with the SUI-71 model-per-action path.

Refs SUI-612

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
johannes.moskaliuk force-pushed dev/sven/SUI-612 from b0ad200339
Some checks failed
Repo-Gates / gates (push) Has been cancelled
Repo-Gates / Notify CI-Fixer (push) Has been cancelled
Repo-Gates / gates (pull_request) Has been cancelled
Repo-Gates / Notify CI-Fixer (pull_request) Has been cancelled
PHPCS quality / PHPCS ratchet (push) Has been cancelled
PHPCS quality / PHPCS full scan (push) Has been cancelled
PHPCS quality / Notify CI-Fixer (push) Has been cancelled
Moodle Plugin CI / changes (pull_request) Has been cancelled
Moodle Plugin CI / Notify CI-Fixer (pull_request) Has been cancelled
PHPCS quality / PHPCS ratchet (pull_request) Has been cancelled
PHPCS quality / PHPCS full scan (pull_request) Has been cancelled
PHPCS quality / Notify CI-Fixer (pull_request) Has been cancelled
to eba8a2af70
Some checks failed
Repo-Gates / gates (push) Failing after 24s
ci-fixer/error Repo-Gates: lint-vendored-shell: vendored Plugin Shell copy (elediaai_tutor) in sync; 21 stylesheets token-clean.
Repo-Gates / gates (pull_request) Failing after 24s
PHPCS quality / PHPCS ratchet (push) Successful in 37s
PHPCS quality / PHPCS full scan (push) Has been skipped
Moodle Plugin CI / changes (pull_request) Successful in 25s
PHPCS quality / PHPCS full scan (pull_request) Has been skipped
PHPCS quality / PHPCS ratchet (pull_request) Successful in 32s
Repo-Gates / Notify CI-Fixer (push) Has been skipped
Repo-Gates / Notify CI-Fixer (pull_request) Has been skipped
PHPCS quality / Notify CI-Fixer (push) Has been skipped
PHPCS quality / Notify CI-Fixer (pull_request) Has been skipped
Moodle Plugin CI / core (MOODLE_502_STABLE) (customerportal, local/elediaai_core qtype/aitext, core, MOODLE_502_STABLE, ai/provider/eledia local/activityfilter local/aitransparency auth/eledia_eduplaces admin/tool/taskrunner customfield/field/languageselect filter/eledia… (pull_request) Successful in 5m26s
Moodle Plugin CI / Notify CI-Fixer (pull_request) Has been cancelled
2026-08-04 19:44:03 +00:00
Compare
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
johannes.moskaliuk/eledia.ai!102
No description provided.