update
This commit is contained in:
@@ -365,7 +365,7 @@ FORMAT-SPEZIFIKATION:
|
||||
REFERENZ-BEISPIEL:
|
||||
{reference}
|
||||
|
||||
Schlage 8 Bausteine vor. Antworte AUSSCHLIESSLICH mit einem JSON-Array. Jedes Element hat:
|
||||
Schlage 40 Bausteine vor. Antworte AUSSCHLIESSLICH mit einem JSON-Array. Jedes Element hat:
|
||||
- "title"
|
||||
- "description"
|
||||
- "purpose"
|
||||
@@ -375,9 +375,10 @@ Orientiere dich an der Spezifikation und Referenz. NUR das JSON-Array, kein weit
|
||||
"""
|
||||
|
||||
|
||||
def _build_baustein_detail_prompt(topic: str, title: str) -> str:
|
||||
def _build_baustein_detail_prompt(topic: str, title: str, instructions: str = "") -> str:
|
||||
spec = (TEMPLATES_DIR / "Format" / "Baustein.md").read_text(encoding="utf-8")
|
||||
reference = (TEMPLATES_DIR / "Referenz" / "Baustein.md").read_text(encoding="utf-8")
|
||||
extra = f"\n\nZUSÄTZLICHE INFOS VOM NUTZER:\n{instructions}\n" if instructions else ""
|
||||
|
||||
return f"""Generiere Details für den Baustein "{title}" im Kontext des Themas "{topic}".
|
||||
|
||||
@@ -386,7 +387,7 @@ FORMAT-SPEZIFIKATION:
|
||||
|
||||
REFERENZ-BEISPIEL:
|
||||
{reference}
|
||||
|
||||
{extra}
|
||||
Antworte AUSSCHLIESSLICH mit einem JSON-Objekt mit den Feldern "description", "purpose", "examples".
|
||||
"examples" ist ein Array mit 1 Objekt {{"label": "...", "code": "..."}}.
|
||||
Orientiere dich an der Spezifikation und Referenz. Kein weiterer Text, nur das JSON.
|
||||
@@ -403,7 +404,7 @@ async def generate_suggestions(topic: str, html_paths: list[Path]) -> None:
|
||||
|
||||
prompt = _build_suggestions_prompt(topic, html_paths, existing_titles)
|
||||
tools = "Read" if html_paths else None
|
||||
returncode, stdout, stderr = await _run_claude("suggestions-" + topic, prompt, 180, tools=tools, model=MODEL_BAUSTEIN_GEN)
|
||||
returncode, stdout, stderr = await _run_claude("suggestions-" + topic, prompt, 1800, tools=tools, model=MODEL_BAUSTEIN_GEN)
|
||||
|
||||
if returncode != 0:
|
||||
return
|
||||
@@ -414,7 +415,7 @@ async def generate_suggestions(topic: str, html_paths: list[Path]) -> None:
|
||||
|
||||
now = datetime.now(timezone.utc).isoformat()
|
||||
suggestions = []
|
||||
for item in items[:8]:
|
||||
for item in items[:40]:
|
||||
suggestions.append({
|
||||
"id": str(uuid.uuid4()),
|
||||
"topic": topic,
|
||||
@@ -433,9 +434,9 @@ async def generate_suggestions(topic: str, html_paths: list[Path]) -> None:
|
||||
_suggestions_generating.discard(topic)
|
||||
|
||||
|
||||
async def generate_baustein_detail(baustein_id: str, topic: str, title: str) -> None:
|
||||
async def generate_baustein_detail(baustein_id: str, topic: str, title: str, instructions: str = "") -> None:
|
||||
try:
|
||||
prompt = _build_baustein_detail_prompt(topic, title)
|
||||
prompt = _build_baustein_detail_prompt(topic, title, instructions)
|
||||
returncode, stdout, stderr = await _run_claude("baustein-" + baustein_id, prompt, 60, tools=None, model=MODEL_BAUSTEIN_GEN)
|
||||
|
||||
if returncode != 0:
|
||||
|
||||
@@ -35,6 +35,7 @@ class GuideResponse(BaseModel):
|
||||
class BausteinCreateRequest(BaseModel):
|
||||
topic: str = Field(min_length=1, max_length=100)
|
||||
title: str = Field(min_length=1, max_length=200)
|
||||
instructions: str = Field(default="", max_length=2000)
|
||||
|
||||
|
||||
class BausteinReworkRequest(BaseModel):
|
||||
|
||||
@@ -135,7 +135,7 @@ async def add_baustein(req: BausteinCreateRequest):
|
||||
"updated_at": now,
|
||||
}
|
||||
await db_create_baustein(baustein)
|
||||
asyncio.create_task(generate_baustein_detail(baustein["id"], baustein["topic"], baustein["title"]))
|
||||
asyncio.create_task(generate_baustein_detail(baustein["id"], baustein["topic"], baustein["title"], req.instructions.strip()))
|
||||
return baustein
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user