This commit is contained in:
team3
2026-07-10 17:36:28 +02:00
parent 917b3ac702
commit ab1a28f0e7
8 changed files with 98 additions and 6 deletions

View File

@@ -125,3 +125,25 @@ async def test_kapitel_retry_und_fallback(monkeypatch):
kaps = db.query("SELECT * FROM kapitel WHERE topic=?", (topic,))
assert kaps and all(k["art"] == "fallback" for k in kaps)
assert "kapitel_fallback" in {bf["art"] for bf in struktur.messen(ctx)}
async def test_level_kalibrierung(monkeypatch):
import fake_agents
topic = topic_anlegen("level")
run = run_anlegen(topic)
ziel = db.insert("lernziele", topic=topic, text="Kann X", status="aktiv")
b_id = db.insert("bausteine", topic=topic, ziel_id=ziel, titel="B", ord=0, status="neu")
a1 = db.insert("atome", topic=topic, titel="Kern", typ="begriff", definition="d",
level="M", status="neu", baustein_id=b_id, braucht=db.j([]))
a2 = db.insert("atome", topic=topic, titel="Detail", typ="aussage", definition="d",
level="M", status="neu", baustein_id=b_id, braucht=db.j([]))
def judge(prompt):
return [{"atom": a1, "level": "E"}, {"atom": a2, "level": "S"},
{"atom": 99999, "level": "E"}, {"atom": a2, "level": "X"}] # Müll ignorieren
monkeypatch.setitem(fake_agents._HANDLER, "Level-Kalibrierung", judge)
ctx = llm.Kontext(run, topic, "minimax")
ctx.ebene = "struktur"
await struktur._level_kalibrieren(ctx)
assert db.one("SELECT level FROM atome WHERE id=?", (a1,))["level"] == "E"
assert db.one("SELECT level FROM atome WHERE id=?", (a2,))["level"] == "S"