Protokoll #27816

ID27816
Zeitstempel2025-12-28 12:24:36.001819
Clientroot
IP145.224.72.140
Modellclaude-sonnet-4-20250514
Statuscompleted
Tokens697 (Input: 34, Output: 663)
Dauer111 ms
Request-Zeit2025-12-28 12:24:36.001819
Response-Zeit2025-12-28 12:24:36.113134

Request

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

Response

{
    "tool_response": {
        "type": "text",
        "file": {
            "filePath": "\/var\/www\/scripts\/pipeline\/step_entity_enrich.py",
            "content": "\"\"\"\nEntity Enrichment Step Module\nGenerates detailed descriptions for entities via Ollama.\n\nThis step runs AFTER semantic analysis and enriches entities\nwith comprehensive descriptions (3-5 sentences).\n\nPart of Progressive Pipeline Architecture.\n\"\"\"\n\nimport time\n\nimport requests\n\nfrom constants import DEFAULT_LIMIT, OLLAMA_TIMEOUT\nfrom db import db\n\n# Configuration\nOLLAMA_URL = \"http:\/\/localhost:11434\/api\/generate\"\nDEFAULT_MODEL = \"mistral:latest\"\nMIN_DESCRIPTION_LENGTH = 50\n\n\nclass EntityEnrichStep:\n    \"\"\"Step: Enrich entity descriptions via Ollama.\"\"\"\n\n    def __init__(self, progress=None):\n        \"\"\"\n        Initialize entity enrichment step.\n\n        Args:\n            progress: Optional PipelineProgress instance\n        \"\"\"\n        self.progress = progress\n        self.prompt_template = None\n\n    def _load_prompt(self):\n        \"\"\"Load prompt template from database.\"\"\"\n        if self.prompt_template:\n            return self.prompt_template\n\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\n        if row:\n            self.prompt_template = row[\"content\"]\n        else:\n            # Fallback prompt\n            self.prompt_template = \"\"\"Du bist ein Experte für systemisches Coaching und Organisationsentwicklung.\n\nAufgabe: Erstelle eine ausführliche Beschreibung für die folgende Entität.\n\nEntität: {entity_name}\nTyp: {entity_type}\nAktueller Kontext aus dem Dokument:\n{context}\n\nAnforderungen an die Beschreibung:\n1. Erster Satz: Grundsätzliche Definition des Begriffs\n2. Weitere 2-4 Sätze: Erläuterung der Bedeutung im Kontext von systemischem Coaching, Teamarbeit oder Organisationsentwicklung\n3. Falls relevant: Praktische Anwendung oder Beispiele\n\nSchreibe NUR die Beschreibung (3-5 Sätze), keine Überschriften oder Formatierung.\nSprache: Deutsch\"\"\"\n\n        return self.prompt_template\n\n    def _get_entities_to_enrich(self, limit=DEFAULT_LIMIT):\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",
            "numLines": 80,
            "startLine": 1,
            "totalLines": 236
        }
    }
}
← Vorheriger Zur Liste Nächster →