update
This commit is contained in:
@@ -360,11 +360,11 @@ FORMAT-SPEZIFIKATION:
|
||||
REFERENZ-BEISPIEL:
|
||||
{reference}
|
||||
|
||||
Schlage bis zu 20 Bausteine vor. Antworte AUSSCHLIESSLICH mit einem JSON-Array. Jedes Element hat:
|
||||
Schlage 8 Bausteine vor. Antworte AUSSCHLIESSLICH mit einem JSON-Array. Jedes Element hat:
|
||||
- "title"
|
||||
- "description"
|
||||
- "purpose"
|
||||
- "examples": Array mit 4 Objekten {{"label": "...", "code": "..."}}
|
||||
- "examples": Array mit 1 Objekt {{"label": "...", "code": "..."}}
|
||||
|
||||
Orientiere dich an der Spezifikation und Referenz. NUR das JSON-Array, kein weiterer Text.
|
||||
"""
|
||||
@@ -383,7 +383,7 @@ REFERENZ-BEISPIEL:
|
||||
{reference}
|
||||
|
||||
Antworte AUSSCHLIESSLICH mit einem JSON-Objekt mit den Feldern "description", "purpose", "examples".
|
||||
"examples" ist ein Array mit 4 Objekten {{"label": "...", "code": "..."}}.
|
||||
"examples" ist ein Array mit 1 Objekt {{"label": "...", "code": "..."}}.
|
||||
Orientiere dich an der Spezifikation und Referenz. Kein weiterer Text, nur das JSON.
|
||||
"""
|
||||
|
||||
@@ -409,7 +409,7 @@ async def generate_suggestions(topic: str, html_paths: list[Path]) -> None:
|
||||
|
||||
now = datetime.now(timezone.utc).isoformat()
|
||||
suggestions = []
|
||||
for item in items[:20]:
|
||||
for item in items[:8]:
|
||||
suggestions.append({
|
||||
"id": str(uuid.uuid4()),
|
||||
"topic": topic,
|
||||
@@ -450,3 +450,49 @@ async def generate_baustein_detail(baustein_id: str, topic: str, title: str) ->
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
def _build_baustein_rework_prompt(topic: str, title: str, current: dict, instructions: str) -> str:
|
||||
current_json = json.dumps({
|
||||
"title": title,
|
||||
"description": current.get("description", ""),
|
||||
"purpose": current.get("purpose", ""),
|
||||
"examples": current.get("examples", []),
|
||||
}, ensure_ascii=False, indent=2)
|
||||
|
||||
return f"""Überarbeite den Baustein "{title}" zum Thema "{topic}" gemäß den Anweisungen.
|
||||
|
||||
AKTUELLER STAND:
|
||||
{current_json}
|
||||
|
||||
ANWEISUNGEN VOM NUTZER:
|
||||
{instructions}
|
||||
|
||||
Antworte AUSSCHLIESSLICH mit einem JSON-Objekt mit den Feldern "description", "purpose", "examples".
|
||||
"examples" ist ein Array mit Objekten {{"label": "...", "code": "..."}}.
|
||||
Kein weiterer Text, nur das JSON.
|
||||
"""
|
||||
|
||||
|
||||
async def rework_baustein(baustein_id: str, topic: str, title: str, current: dict, instructions: str) -> None:
|
||||
try:
|
||||
prompt = _build_baustein_rework_prompt(topic, title, current, instructions)
|
||||
returncode, stdout, stderr = await _run_claude("baustein-" + baustein_id, prompt, 60, tools=None)
|
||||
|
||||
if returncode != 0:
|
||||
return
|
||||
|
||||
data = _parse_json(stdout)
|
||||
if not isinstance(data, dict):
|
||||
return
|
||||
|
||||
now = datetime.now(timezone.utc).isoformat()
|
||||
await update_baustein(
|
||||
baustein_id,
|
||||
description=data.get("description", ""),
|
||||
purpose=data.get("purpose", ""),
|
||||
example=json.dumps(data.get("examples", []), ensure_ascii=False),
|
||||
updated_at=now,
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user