{
"event": "PreToolUse",
"tool_name": "Read",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/UseCases\/Chat\/StreamingChatMessageUseCase.php",
"offset": 150,
"limit": 50
}
}
{
"tool_response": {
"type": "text",
"file": {
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/UseCases\/Chat\/StreamingChatMessageUseCase.php",
"content": " }\n\n \/\/ Step 9: LLM Request\n $isOllama = str_starts_with($model, 'ollama:');\n $isClaude = str_starts_with($model, 'claude-');\n $hasContext = $context !== '';\n $this->emit('llm', 'Anfrage an ' . ($isOllama ? substr($model, 7) : $model) . '...');\n $this->startStep();\n $llmStart = microtime(true);\n try {\n if ($isClaude) {\n $userPrompt = $hasContext ? $this->claude->buildRagPrompt($message, $context) : $message;\n $effectiveSystemPrompt = $systemPrompt ?? ($hasContext ? $this->claude->getDefaultSystemPrompt() : 'Du bist ein hilfreicher Assistent. Antworte auf Deutsch, präzise und hilfreich.');\n if ($stylePrompt !== null && $stylePrompt !== '') { $effectiveSystemPrompt .= \"\\n\\n\" . $stylePrompt; }\n\n \/\/ Update protokoll with full prompt before LLM call\n if ($protokollId !== null) {\n $fullPrompt = \"=== SYSTEM ===\\n\" . $effectiveSystemPrompt . \"\\n\\n=== USER ===\\n\" . $userPrompt;\n $this->protokollService->updateFullPrompt($protokollId, $fullPrompt);\n }\n\n $llmResponse = $this->claude->ask($userPrompt, $effectiveSystemPrompt, $model, $maxTokens, $temperature);\n $answer = $llmResponse['text'];\n $usage = $llmResponse['usage'];\n } elseif ($isOllama) {\n $ollamaModel = substr($model, 7);\n $instructions = array_filter([$systemPrompt, $stylePrompt]);\n $instructionBlock = $instructions !== [] ? implode(\"\\n\\n\", $instructions) . \"\\n\\n\" : '';\n $userPrompt = $hasContext ? sprintf(\"%sKontext:\\n\\n%s\\n\\n---\\n\\nFrage: %s\", $instructionBlock, $context, $message) : $instructionBlock . $message;\n\n \/\/ Update protokoll with full prompt before LLM call\n if ($protokollId !== null) {\n $this->protokollService->updateFullPrompt($protokollId, $userPrompt);\n }\n\n $answer = $this->ollama->generate($userPrompt, $ollamaModel, $temperature);\n $usage = null;\n } else {\n $this->emit('error', \"Unbekanntes Modell: {$model}\");\n if ($protokollId !== null) {\n $this->protokollService->logFailure($protokollId, \"Unbekanntes Modell: {$model}\");\n }\n\n return ChatResponse::error(\"Unknown model \\\"{$model}\\\".\");\n }\n } catch (\\RuntimeException $e) {\n $this->emit('error', 'LLM-Fehler: ' . $e->getMessage());\n if ($protokollId !== null) {\n $this->protokollService->logFailure($protokollId, 'LLM-Fehler: ' . $e->getMessage());\n }",
"numLines": 50,
"startLine": 150,
"totalLines": 314
}
}
}