{
"event": "PreToolUse",
"tool_name": "Read",
"tool_input": {
"file_path": "\/opt\/scripts\/pipeline\/generate.py",
"offset": 840,
"limit": 60
}
}
{
"tool_response": {
"type": "text",
"file": {
"filePath": "\/opt\/scripts\/pipeline\/generate.py",
"content": "\n try:\n # Get version and critiques\n cursor = db.execute(\n \"\"\"SELECT cv.*, co.id as order_id, co.briefing, co.current_critique_round,\n ap.content as profile_config\n FROM content_versions cv\n JOIN content_orders co ON cv.order_id = co.id\n LEFT JOIN content_config ap ON co.author_profile_id = ap.id AND ap.type = 'author_profile'\n WHERE cv.id = %s\"\"\",\n (version_id,),\n )\n version = cursor.fetchone()\n cursor.close()\n\n if not version:\n return {\"error\": \"Version not found\"}\n\n content_data = json.loads(version[\"content\"]) if isinstance(version[\"content\"], str) else version[\"content\"]\n content_text = content_data.get(\"text\", \"\")\n\n # Get latest critiques\n cursor = db.execute(\n \"\"\"SELECT c.name, cc.feedback\n FROM content_critiques cc\n JOIN critics c ON cc.critic_id = c.id\n WHERE cc.version_id = %s AND cc.round = %s\"\"\",\n (version_id, version[\"current_critique_round\"]),\n )\n critiques = cursor.fetchall()\n cursor.close()\n\n # Build revision prompt\n feedback_text = \"\"\n for critique in critiques:\n fb = json.loads(critique[\"feedback\"]) if isinstance(critique[\"feedback\"], str) else critique[\"feedback\"]\n feedback_text += f\"\\n### {critique['name']}:\\n\"\n feedback_text += f\"- Bewertung: {fb.get('rating', 'N\/A')}\/10\\n\"\n feedback_text += f\"- Probleme: {', '.join(fb.get('issues', []))}\\n\"\n feedback_text += f\"- Vorschläge: {', '.join(fb.get('suggestions', []))}\\n\"\n\n # Check if profile requires HTML output\n html_instruction = \"\"\n if version.get(\"profile_config\"):\n profile_config = (\n json.loads(version[\"profile_config\"])\n if isinstance(version[\"profile_config\"], str)\n else version[\"profile_config\"]\n )\n autorenprofil = profile_config.get(\"autorenprofil\", profile_config)\n output_format = autorenprofil.get(\"output_format\", {})\n if output_format.get(\"typ\") == \"html\":\n html_instruction = \"\"\"\n5. **WICHTIG: Behalte das HTML-Format bei!**\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 # Load revise prompt from database",
"numLines": 60,
"startLine": 840,
"totalLines": 972
}
}
}