API

REST-API Endpoints und HTMX-Integration für das Content Studio.

ControllerContentController.php
Backendweb_generate.py
Base-URL/content

Web-UI Endpoints (RESTful)

MethodeRouteControllerBeschreibung
GET/contentindex()Auftrags-Liste
GET/content/newcontentNew()Erstellungs-Formular
POST/contentstore()Auftrag speichern
GET/content/{id}show()Auftrags-Details
GET/content/{id}/editedit()Bearbeitungs-Formular

HTMX-Endpoints

Diese Endpoints liefern HTML-Fragmente für dynamische Updates.

MethodeRouteControllerResponse
POST/content/{id}/generategenerate()Version-Partial
POST/content/{id}/critiquecritique()Critique-Partial
POST/content/{id}/reviserevise()Version-Partial
POST/content/{id}/approveapprove()Success-Alert + Reload
POST/content/{id}/declinedecline()Warning-Alert + Reload

REST-API Endpoint

MethodeRouteBeschreibung
PUT/api/v1/content/{id}Auftrag aktualisieren

Generate-Endpoint

Request

POST /content/{id}/generate
Content-Type: application/x-www-form-urlencoded

model=anthropic&collection=documents&context_limit=5

Parameter

ParameterTypDefaultBeschreibung
modelstringanthropicLLM-Backend (anthropic, ollama)
collectionstringdocumentsQdrant-Collection
context_limitint5Anzahl RAG-Chunks

Response (HTML)

<div class="version-content">
  <div class="version-header">
    <span class="version-number">Version 1</span>
    <span class="badge success">Generiert</span>
  </div>
  <div class="content-text">...</div>
  <div class="sources">...</div>
</div>

Critique-Endpoint

Request

POST /content/{id}/critique
Content-Type: application/x-www-form-urlencoded

model=anthropic

Response (HTML)

<div class="critique-results">
  <div class="critique-header">
    <span>Kritik-Runde 1</span>
    <span class="badge warning">Revision nötig</span>
  </div>
  <div class="critique-item failed">...</div>
</div>

Python-Backend

Die Controller-Methoden rufen web_generate.py via Shell auf:

python web_generate.py generate <order_id> [model] [collection] [limit]
python web_generate.py critique <version_id> [model]
python web_generate.py revise <version_id> [model]

API-Update (curl)

curl -X PUT https://dev.campus.systemische-tools.de/api/v1/content/1 \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Blogpost über Teamcoaching",
    "briefing": "Schreibe einen informativen Artikel..."
  }'

Fehlerbehandlung

Bei Fehlern wird ein HTML-Alert zurückgegeben:

<div class="alert error">Fehler: [Fehlermeldung]</div>