Elemente: Aufgabe/Lösung-Felder entfernt
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1396,8 +1396,6 @@ def _element_fields(data: dict) -> dict | None:
|
||||
"description": str(data.get("description", "")).strip(),
|
||||
"examples": listen["examples"],
|
||||
"hints": listen["hints"],
|
||||
"aufgabe": str(data.get("aufgabe", "")).strip(),
|
||||
"loesung": str(data.get("loesung", "")).strip(),
|
||||
}
|
||||
|
||||
|
||||
@@ -1420,7 +1418,7 @@ def _topic_context(topic: str, limit: int = 12000) -> str:
|
||||
|
||||
async def generate_element(topic: str, hint: str, provider: str = DEFAULT_PROVIDER) -> dict:
|
||||
"""Erstellt Element-Felder per KI. Fallback: nur Titel aus dem Stichwort."""
|
||||
fallback = {"title": hint.strip() or "Neues Element", "description": "", "examples": [], "hints": [], "aufgabe": "", "loesung": ""}
|
||||
fallback = {"title": hint.strip() or "Neues Element", "description": "", "examples": [], "hints": []}
|
||||
try:
|
||||
prompt = _prompt(
|
||||
"Element-Create",
|
||||
@@ -1456,7 +1454,7 @@ def _parse_suggestions(stdout: str) -> list[dict] | None:
|
||||
text = str(s.get("text", "")).strip()
|
||||
target = s.get("target")
|
||||
content = str(s.get("content", "")).strip()
|
||||
if text and content and target in ("description", "examples", "hints", "aufgabe", "loesung"):
|
||||
if text and content and target in ("description", "examples", "hints"):
|
||||
if target == "examples":
|
||||
content = _fence(content)
|
||||
suggestions.append({"text": text, "target": target, "content": content})
|
||||
@@ -1467,7 +1465,7 @@ async def check_element(element: dict, provider: str = DEFAULT_PROVIDER) -> list
|
||||
"""Zweischrittige Prüfung auf fehlende Infos: Recherche → Verifizieren. None bei Fehler."""
|
||||
try:
|
||||
element_json = json.dumps(
|
||||
{k: element[k] for k in ("title", "description", "examples", "hints", "aufgabe", "loesung")},
|
||||
{k: element[k] for k in ("title", "description", "examples", "hints")},
|
||||
ensure_ascii=False, indent=1,
|
||||
)
|
||||
context = _topic_context(element["topic"])
|
||||
@@ -1504,7 +1502,7 @@ async def check_element(element: dict, provider: str = DEFAULT_PROVIDER) -> list
|
||||
|
||||
def _element_json(element: dict) -> str:
|
||||
return json.dumps(
|
||||
{k: element[k] for k in ("title", "description", "examples", "hints", "aufgabe", "loesung")},
|
||||
{k: element[k] for k in ("title", "description", "examples", "hints")},
|
||||
ensure_ascii=False, indent=1,
|
||||
)
|
||||
|
||||
@@ -1520,7 +1518,7 @@ def _validate_change(c, element: dict) -> dict | None:
|
||||
content = str(c.get("content", "")).strip()
|
||||
if not text or action not in ("entfernen", "anpassen", "hinzufuegen"):
|
||||
return None
|
||||
if target not in ("title", "description", "examples", "hints", "aufgabe", "loesung"):
|
||||
if target not in ("title", "description", "examples", "hints"):
|
||||
return None
|
||||
if action in ("anpassen", "hinzufuegen") and not content:
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user