Protokoll #24787

ID24787
Zeitstempel2025-12-28 01:13:59.835007
Clientroot
IP145.224.72.140
Modellclaude-sonnet-4-20250514
Statuscompleted
Tokens486 (Input: 36, Output: 450)
Dauer95 ms
Request-Zeit2025-12-28 01:13:59.835007
Response-Zeit2025-12-28 01:13:59.930063

Request

{
    "event": "PreToolUse",
    "tool_name": "Read",
    "tool_input": {
        "file_path": "\/var\/www\/scripts\/pipeline\/generate_entity_descriptions.py",
        "limit": 55
    }
}

Response

{
    "tool_response": {
        "type": "text",
        "file": {
            "filePath": "\/var\/www\/scripts\/pipeline\/generate_entity_descriptions.py",
            "content": "#!\/usr\/bin\/env python3\n\"\"\"\nEntity Description Enrichment Script\n=====================================\nGeneriert ausführliche Beschreibungen für Entitäten via Ollama.\n\nVoraussetzungen:\n- Ollama läuft lokal (http:\/\/localhost:11434)\n- Prompt in ki_content.prompts (use_case='entity_description')\n\nUsage:\n    python generate_entity_descriptions.py [--model MODEL] [--limit N] [--dry-run]\n\"\"\"\n\nimport argparse\nimport os\nimport sys\nimport time\nfrom typing import Optional\n\nimport requests\n\n# Add parent directory for imports\nsys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))\n\nfrom db import Database\n\n# Configuration\nOLLAMA_URL = \"http:\/\/localhost:11434\/api\/generate\"\nDEFAULT_MODEL = \"mistral:latest\"\nMIN_DESCRIPTION_LENGTH = 50  # Entities with description < this get enriched\n\n\ndef get_prompt_template(db: Database) -> Optional[str]:\n    \"\"\"Load prompt template from database.\"\"\"\n    cursor = db.execute(\"\"\"\n        SELECT content FROM prompts\n        WHERE use_case = 'entity_description' AND is_active = 1\n        ORDER BY id DESC LIMIT 1\n    \"\"\")\n    row = cursor.fetchone()\n    cursor.close()\n    return row[\"content\"] if row else None\n\n\ndef get_entities_to_enrich(db: Database, limit: int = 100) -> list:\n    \"\"\"Get entities with short or missing descriptions.\"\"\"\n    cursor = db.execute(\"\"\"\n        SELECT id, name, type, description\n        FROM entities\n        WHERE description IS NULL\n           OR CHAR_LENGTH(description) < %s\n        ORDER BY id\n        LIMIT %s\n    \"\"\", (MIN_DESCRIPTION_LENGTH, limit))",
            "numLines": 55,
            "startLine": 1,
            "totalLines": 208
        }
    }
}
← Vorheriger Zur Liste Nächster →