Protokoll #3246

ID3246
Zeitstempel2025-12-22 02:10:31.662757
Clientroot
IP145.224.96.190
Modellclaude-sonnet-4-20250514
Statuscompleted
Tokens1,611 (Input: 34, Output: 1,577)
Dauer88 ms
Request-Zeit2025-12-22 02:10:31.662757
Response-Zeit2025-12-22 02:10:31.751205

Request

{
    "event": "PreToolUse",
    "tool_name": "Read",
    "tool_input": {
        "file_path": "\/opt\/scripts\/pipeline\/generate.py",
        "offset": 143,
        "limit": 170
    }
}

Response

{
    "tool_response": {
        "type": "text",
        "file": {
            "filePath": "\/opt\/scripts\/pipeline\/generate.py",
            "content": "def build_generation_prompt(briefing, context, profile, contract, structure=None):\n    \"\"\"Build the content generation prompt.\"\"\"\n\n    # Format context\n    context_text = \"\"\n    for i, ctx in enumerate(context, 1):\n        context_text += f\"\\n[Quelle {i}: {ctx['source']}]\\n{ctx['content']}\\n\"\n\n    # Build rich profile instructions\n    profile_text = \"\"\n    if profile:\n        config = profile.get(\"config\", {})\n        autorenprofil = config.get(\"autorenprofil\", config)  # Support both structures\n\n        # Extract voice\/stimme\n        stimme = autorenprofil.get(\"stimme\", {})\n        stimme_text = \"\"\n        if stimme:\n            stimme_text = f\"\"\"\n### Stimme\/Tonalität:\n- Ton: {stimme.get('ton', 'neutral')}\n- Perspektive: {stimme.get('perspektive', 'neutral')}\n- Komplexität: {stimme.get('komplexitaet', 'mittel')}\n- Autorität: {stimme.get('autoritaet', 'Experte')}\"\"\"\n\n        # Extract style\/stil\n        stil = autorenprofil.get(\"stil\", {})\n        stil_text = \"\"\n        if stil:\n            fachsprache_beispiele = stil.get(\"fachsprache_beispiele\", [])\n            fachsprache_str = \", \".join(fachsprache_beispiele[:5]) if fachsprache_beispiele else \"\"\n            stil_text = f\"\"\"\n### Stil:\n- Fachsprache: {'Ja' if stil.get('fachsprache', False) else 'Nein'}\n- Fachbegriffe: {fachsprache_str}\n- Satzlänge: {stil.get('satzlaenge', 'mittel')}\n- Absatzstruktur: {stil.get('absatzstruktur', 'klar gegliedert')}\"\"\"\n\n        # Extract language patterns\/sprachliche_muster\n        muster = autorenprofil.get(\"sprachliche_muster\", {})\n        muster_text = \"\"\n        if muster:\n            phrasen = muster.get(\"phrasen\", [])\n            phrasen_str = \", \".join([f'\"{p}\"' for p in phrasen[:4]]) if phrasen else \"\"\n            uebergaenge = muster.get(\"uebergaenge\", [])\n            uebergaenge_str = \", \".join([f'\"{u}\"' for u in uebergaenge[:3]]) if uebergaenge else \"\"\n            muster_text = f\"\"\"\n### Sprachliche Muster:\n- Typische Phrasen: {phrasen_str}\n- Übergangsformulierungen: {uebergaenge_str}\"\"\"\n\n        # Extract taboos\/tabus\n        tabus = autorenprofil.get(\"tabus\", [])\n        tabus_text = \"\"\n        if tabus:\n            tabus_str = \", \".join(tabus[:5])\n            tabus_text = f\"\"\"\n### Zu vermeiden (Tabus):\n{tabus_str}\"\"\"\n\n        # Extract core messages\/kernbotschaften\n        kernbotschaften = autorenprofil.get(\"kernbotschaften\", [])\n        kern_text = \"\"\n        if kernbotschaften:\n            kern_str = \"\\n\".join([f\"- {k}\" for k in kernbotschaften[:4]])\n            kern_text = f\"\"\"\n### Kernbotschaften (implizit vermitteln):\n{kern_str}\"\"\"\n\n        # Extract output format (HTML for web profiles)\n        output_format = autorenprofil.get(\"output_format\", {})\n        format_text = \"\"\n        if output_format and output_format.get(\"typ\") == \"html\":\n            erlaubte = output_format.get(\"erlaubte_elemente\", {})\n            verboten = output_format.get(\"verbotene_elemente\", [])\n            regeln = output_format.get(\"struktur_regeln\", [])\n\n            erlaubte_str = []\n            for kategorie, elemente in erlaubte.items():\n                erlaubte_str.extend(elemente[:3])\n\n            format_text = f\"\"\"\n### Output-Format: HTML\n**Erlaubte Elemente:**\n{', '.join(erlaubte_str[:10])}\n\n**Struktur-Regeln:**\n- {chr(10).join('- ' + r for r in regeln[:4]) if regeln else 'Semantisches HTML verwenden'}\n\n**Verboten:** {', '.join(verboten[:4]) if verboten else 'div, span, br, style'}\"\"\"\n\n        # Combine all profile sections\n        profile_text = f\"\"\"\n## Autorenprofil: {profile.get(\"name\", \"Standard\")}\n{stimme_text}\n{stil_text}\n{muster_text}\n{tabus_text}\n{kern_text}\n{format_text}\n\"\"\"\n\n    # Build contract requirements\n    contract_text = \"\"\n    if contract:\n        config = contract.get(\"config\", {})\n        req = config.get(\"requirements\", {})\n        contract_text = f\"\"\"\nContract: {contract.get(\"name\", \"Standard\")}\n- Wortanzahl: {req.get(\"min_words\", 500)} - {req.get(\"max_words\", 5000)} Wörter\n- Struktur-Validierung: {req.get(\"structure_validation\", True)}\n\"\"\"\n\n    # Build structure instructions\n    structure_text = \"\"\n    if structure:\n        config = structure.get(\"config\", {})\n        structure_text = f\"\"\"\nStruktur-Template: {structure.get(\"name\", \"\")}\n- Typ: {structure.get(\"type\", \"\")}\n- Abschnitte: {json.dumps(config.get(\"sections\", []), ensure_ascii=False)}\n\"\"\"\n\n    # Determine if HTML output is required\n    html_output = False\n    if profile:\n        config = profile.get(\"config\", {})\n        autorenprofil = config.get(\"autorenprofil\", config)\n        output_format = autorenprofil.get(\"output_format\", {})\n        html_output = output_format.get(\"typ\") == \"html\"\n\n    format_instruction = \"\"\n    if html_output:\n        format_instruction = \"\"\"7. **WICHTIG: Ausgabe als wohlformatiertes HTML**\n   - Verwende nur: h1, h2, h3, h4, p, ul, ol, li, strong, a, section, table, tr, td\n   - Jeder h2-Abschnitt muss in einer eigenen <section> stehen\n   - Kein Markdown, kein div\/span\/br\n   - Fließtext immer in <p>-Tags\"\"\"\n\n    prompt = f\"\"\"Du bist ein professioneller Content-Autor. Erstelle basierend auf dem Briefing und dem bereitgestellten Kontext einen hochwertigen Text.\n\n{profile_text}\n{contract_text}\n{structure_text}\n\n## Kontext aus der Wissensbasis:\n{context_text}\n\n## Briefing:\n{briefing}\n\n## Anweisungen:\n1. Nutze die Informationen aus dem Kontext als Grundlage\n2. Halte dich an das Autorenprofil und den Schreibstil\n3. Beachte die Vorgaben aus dem Contract\n4. Strukturiere den Text gemäß dem Template (falls angegeben)\n5. Schreibe auf Deutsch\n6. Kennzeichne verwendete Quellen\n{format_instruction}\n\nErstelle nun den Content:\"\"\"\n\n    return prompt\n\n\ndef call_llm(prompt, model=\"anthropic\", client_name=\"content-studio\"):\n    \"\"\"\n    Call LLM to generate content with protokoll logging.\n\n    Args:",
            "numLines": 170,
            "startLine": 143,
            "totalLines": 850
        }
    }
}
← Vorheriger Zur Liste Nächster →