feat(stellungnahme): zentrales KI-Regelwerk aus stellungnahme_config
Die AI-Rewrite-Regeln (DEFAULT_AI_RULES) waren im Block hardcodiert und hätten pro Generator (40 Instanzen) dupliziert werden müssen, um im CMS editierbar zu sein. Stattdessen ein Singleton stellungnahme_config (Slug "default") mit Feld aiRules: der Resolver lädt es einmal und hängt block.aiRules an alle Generator-Blöcke. Komponente seedet daraus, mit DEFAULT_AI_RULES als Code-Fallback; Reset-Button setzt auf den CMS-Wert. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -947,6 +947,27 @@ export async function getTranslationBundleBySlug(
|
||||
});
|
||||
}
|
||||
|
||||
/** Zentrale Stellungnahme-Generator-Konfiguration (Singleton). */
|
||||
export type StellungnahmeConfigEntry = {
|
||||
aiRules?: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Lädt das zentrale Regelwerk für die Stellungnahme-Generatoren
|
||||
* (GET /api/content/stellungnahme_config/:slug). Einmal definiert, von allen
|
||||
* 40 Generator-Blöcken genutzt statt pro Block dupliziert.
|
||||
*/
|
||||
export async function getStellungnahmeConfig(
|
||||
slug: string,
|
||||
options?: { locale?: string },
|
||||
): Promise<StellungnahmeConfigEntry | null> {
|
||||
return getEntryBySlug<StellungnahmeConfigEntry>(
|
||||
"stellungnahme_config",
|
||||
slug,
|
||||
{ locale: options?.locale },
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalised key→string map for `event.locals.translations`. Cached on the
|
||||
* raw `strings` object identity so the per-request `Object.entries` loop runs
|
||||
|
||||
Reference in New Issue
Block a user