This commit is contained in:
team3
2026-06-18 16:45:33 +02:00
parent 9c0f622e0c
commit d067cb8b54
27 changed files with 329 additions and 327 deletions

View File

@@ -18,8 +18,9 @@ from agents import run_agent
from bausteine import _pdfs_konvertieren, quelle_ordner
from config import (
DEFAULT_PROVIDER, FORMAT_ANTEIL, KONSENS_GRACE, KONSENS_MAX_RUNDEN,
TEMPLATES_DIR,
LESBARKEIT_AKTIV, TEMPLATES_DIR,
)
import lesbarkeit
from database import list_guides, update_guide
from fsutil import atomic_write_json
from jsonio import read_json_file as _json_datei
@@ -709,6 +710,17 @@ async def _generate_sections(
num = _titel_aufloesen(idx, item["section"])
if num in geltung and num in by_num and num not in probleme_by_num:
probleme_by_num[num] = item["problem"]
# Deterministisches Lesbarkeits-Gate: zu schwere Sections in dieselbe
# Überarbeitung einreihen (LLM-Beanstandung hat Vorrang). Gate aus → no-op.
if LESBARKEIT_AKTIV:
md_by_num = {num: by_num[num]["md"] for nums in scope for num in nums if num in by_num}
hinweise = await asyncio.to_thread(lesbarkeit.bewerte_sections, md_by_num)
if hinweise:
_log(topic, f"Lesbarkeit: {len(hinweise)} Section(s) zu schwer")
for num, hinweis in hinweise.items():
probleme_by_num.setdefault(num, hinweis)
if not probleme_by_num:
break
@@ -756,7 +768,8 @@ async def _generate_sections(
chapters: list[dict] = []
for ch in plan:
sections = [
{"num": num, "title": _titel(entries[num]), "md": by_num[num]["md"]}
{"num": num, "title": _titel(entries[num]), "md": by_num[num]["md"],
"kompakt": by_num[num].get("kompakt", "")}
for num in ch["nums"] if num in by_num
]
if sections: