{
"event": "PreToolUse",
"tool_name": "Read",
"tool_input": {
"file_path": "\/opt\/scripts\/pipeline\/knowledge.py",
"offset": 495,
"limit": 40
}
}
{
"tool_response": {
"type": "text",
"file": {
"filePath": "\/opt\/scripts\/pipeline\/knowledge.py",
"content": " description: str,\n strength: float,\n bidirectional: bool,\n level: KnowledgeLevel,\n knowledge_source_id: int,\n ) -> dict | None:\n \"\"\"Speichere Ontologie-Beziehung.\"\"\"\n try:\n # Prüfe ob Beziehung existiert\n cursor = db.execute(\n \"\"\"SELECT id FROM entity_ontology\n WHERE source_entity_id = %s AND target_entity_id = %s AND relation_type = %s\"\"\",\n (source_id, target_id, relation_type),\n )\n existing = cursor.fetchone()\n cursor.close()\n\n if existing:\n rel_id = existing[\"id\"]\n else:\n cursor = db.execute(\n \"\"\"INSERT INTO entity_ontology\n (source_entity_id, target_entity_id, relation_type, direction,\n strength, description, source_type, source_id, model_used, created_at)\n VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, NOW())\"\"\",\n (\n source_id,\n target_id,\n relation_type,\n \"bidirectional\" if bidirectional else \"unidirectional\",\n strength,\n description,\n level.value,\n knowledge_source_id,\n f\"{self.model.provider}:{self.model.model_name}\",\n ),\n )\n db.commit()\n rel_id = cursor.lastrowid\n cursor.close()",
"numLines": 40,
"startLine": 495,
"totalLines": 905
}
}
}