Protokoll #769

ID769
Zeitstempel2025-12-20 17:22:27.617961
Clientroot
IP145.224.96.190
Modellclaude-sonnet-4-20250514
Statuspending
Tokens1,715 (Input: 1,715, Output: 0)
Dauer-
Request-Zeit2025-12-20 17:22:27.617961
Response-Zeit-

Request

{
    "event": "PostToolUse",
    "raw_data": {
        "session_id": "18ef5bf3-e872-4052-897e-53d6dc45b0b9",
        "transcript_path": "\/root\/.claude\/projects\/-var-www\/18ef5bf3-e872-4052-897e-53d6dc45b0b9.jsonl",
        "cwd": "\/var\/www\/dev.campus.systemische-tools.de",
        "permission_mode": "acceptEdits",
        "hook_event_name": "PostToolUse",
        "tool_name": "Read",
        "tool_input": {
            "file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Infrastructure\/AI\/AIConfig.php"
        },
        "tool_response": {
            "type": "text",
            "file": {
                "filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Infrastructure\/AI\/AIConfig.php",
                "content": "<?php\n\ndeclare(strict_types=1);\n\nnamespace Infrastructure\\AI;\n\nuse RuntimeException;\n\n\/**\n * Zentralisierte AI-Service-Konfiguration.\n *\n * Verwaltet alle Konfigurationswerte für AI-Services (Ollama, Qdrant, Claude)\n * und stellt Factory-Methoden zur Service-Erstellung bereit.\n *\n * Diese Klasse:\n * - Lädt Credentials sicher aus der credentials.md Datei\n * - Definiert Default-Werte für alle Service-URLs und Modelle\n * - Erstellt konfigurierte Service-Instanzen\n * - Verhindert doppeltes Laden von API-Keys\n *\n * @package Infrastructure\\AI\n * @author  System Generated\n * @version 1.0.0\n *\/\nfinal readonly class AIConfig\n{\n    \/**\n     * Konstruiert eine neue AIConfig-Instanz.\n     *\n     * @param string $ollamaHost       Ollama API Host-URL\n     * @param string $qdrantHost       Qdrant API Host-URL\n     * @param string $anthropicApiKey  Anthropic API Key\n     * @param string $embeddingModel   Embedding-Modell für Ollama\n     * @param string $claudeModel      Claude-Modell für Anthropic\n     * @param string $defaultCollection Standard-Collection für Qdrant\n     *\/\n    public function __construct(\n        public string $ollamaHost,\n        public string $qdrantHost,\n        public string $anthropicApiKey,\n        public string $embeddingModel,\n        public string $claudeModel,\n        public string $defaultCollection\n    ) {\n    }\n\n    \/**\n     * Erstellt AIConfig aus Credentials-Datei mit Default-Werten.\n     *\n     * Lädt den Anthropic API Key aus der credentials.md Datei und\n     * verwendet Default-Werte für alle anderen Konfigurationsparameter.\n     *\n     * @param string $credentialsPath Pfad zur credentials.md Datei (default: \/var\/www\/docs\/credentials\/credentials.md)\n     *\n     * @return self Konfigurierte AIConfig-Instanz\n     *\n     * @throws RuntimeException Wenn Credentials-Datei nicht existiert\n     * @throws RuntimeException Wenn Credentials-Datei nicht gelesen werden kann\n     * @throws RuntimeException Wenn Anthropic API Key nicht gefunden wird\n     *\n     * @example\n     * $config = AIConfig::fromCredentialsFile();\n     * $chatService = $config->createChatService();\n     *\/\n    public static function fromCredentialsFile(\n        string $credentialsPath = '\/var\/www\/docs\/credentials\/credentials.md'\n    ): self {\n        $anthropicApiKey = self::loadAnthropicApiKey($credentialsPath);\n\n        return new self(\n            ollamaHost: 'http:\/\/localhost:11434',\n            qdrantHost: 'http:\/\/localhost:6333',\n            anthropicApiKey: $anthropicApiKey,\n            embeddingModel: 'mxbai-embed-large',\n            claudeModel: 'claude-opus-4-5-20251101',\n            defaultCollection: 'documents'\n        );\n    }\n\n    \/**\n     * Erstellt einen konfigurierten ChatService.\n     *\n     * Erzeugt alle benötigten Dependencies (OllamaService, QdrantService, ClaudeService)\n     * und liefert einen vollständig konfigurierten ChatService zurück.\n     *\n     * @return ChatService Konfigurierter ChatService\n     *\n     * @example\n     * $config = AIConfig::fromCredentialsFile();\n     * $chatService = $config->createChatService();\n     * $result = $chatService->chat('Was ist systemisches Coaching?');\n     *\/\n    public function createChatService(): ChatService\n    {\n        return new ChatService(\n            $this->createOllamaService(),\n            $this->createQdrantService(),\n            $this->createClaudeService()\n        );\n    }\n\n    \/**\n     * Erstellt einen konfigurierten OllamaService.\n     *\n     * @return OllamaService Konfigurierter OllamaService\n     *\n     * @example\n     * $config = AIConfig::fromCredentialsFile();\n     * $ollama = $config->createOllamaService();\n     * $embedding = $ollama->getEmbedding('Hello World');\n     *\/\n    public function createOllamaService(): OllamaService\n    {\n        return new OllamaService($this->ollamaHost);\n    }\n\n    \/**\n     * Erstellt einen konfigurierten QdrantService.\n     *\n     * @return QdrantService Konfigurierter QdrantService\n     *\n     * @example\n     * $config = AIConfig::fromCredentialsFile();\n     * $qdrant = $config->createQdrantService();\n     * $results = $qdrant->search($vector, 'documents');\n     *\/\n    public function createQdrantService(): QdrantService\n    {\n        return new QdrantService($this->qdrantHost);\n    }\n\n    \/**\n     * Erstellt einen konfigurierten ClaudeService.\n     *\n     * @return ClaudeService Konfigurierter ClaudeService\n     *\n     * @example\n     * $config = AIConfig::fromCredentialsFile();\n     * $claude = $config->createClaudeService();\n     * $result = $claude->ask('Explain quantum computing');\n     *\/\n    public function createClaudeService(): ClaudeService\n    {\n        return new ClaudeService($this->anthropicApiKey);\n    }\n\n    \/**\n     * Lädt den Anthropic API Key aus der Credentials-Datei.\n     *\n     * Sucht nach einer Zeile, die mit 'sk-ant-' beginnt und gibt diese zurück.\n     * API Key wird niemals in Exception-Messages geloggt.\n     *\n     * @param string $credentialsPath Pfad zur credentials.md Datei\n     *\n     * @return string Der gefundene API Key\n     *\n     * @throws RuntimeException Wenn Credentials-Datei nicht existiert\n     * @throws RuntimeException Wenn Credentials-Datei nicht gelesen werden kann\n     * @throws RuntimeException Wenn API Key nicht gefunden wird\n     *\/\n    private static function loadAnthropicApiKey(string $credentialsPath): string\n    {\n        if (!file_exists($credentialsPath)) {\n            throw new RuntimeException('Credentials file not found');\n        }\n\n        $content = file_get_contents($credentialsPath);\n\n        if ($content === false) {\n            throw new RuntimeException('Could not read credentials file');\n        }\n\n        foreach (explode(\"\\n\", $content) as $line) {\n            $trimmedLine = trim($line);\n            if (str_starts_with($trimmedLine, 'sk-ant-')) {\n                return $trimmedLine;\n            }\n        }\n\n        throw new RuntimeException('Anthropic API key not found in credentials file');\n    }\n}\n",
                "numLines": 183,
                "startLine": 1,
                "totalLines": 183
            }
        },
        "tool_use_id": "toolu_018owiQwdqcgSPymNE5nPtMp"
    }
}

Response

-
← Vorheriger Zur Liste Nächster →