Protokoll #24553
| ID | 24553 |
|---|---|
| Zeitstempel | 2025-12-27 23:47:45.782806 |
| Client | root |
| IP | Warning: Undefined array key "request_ip" in /var/www/dev.campus.systemische-tools.de/src/View/protokoll/show.php on line 13 Deprecated: htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/dev.campus.systemische-tools.de/src/View/protokoll/show.php on line 13 |
| Modell | claude-sonnet-4-20250514 |
| Status | completed |
| Tokens | 982 (Input: 0, Output: 0) |
| Dauer | 117 ms |
| Request-Zeit | Warning: Undefined array key "request_timestamp" in /var/www/dev.campus.systemische-tools.de/src/View/protokoll/show.php on line 18 |
| Response-Zeit | - |
Warning: Undefined array key "error_message" in /var/www/dev.campus.systemische-tools.de/src/View/protokoll/show.php on line 22
Request
{
"event": "PreToolUse",
"tool_name": "Edit",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Infrastructure\/AI\/ScoringService.php",
"old_string": "namespace Infrastructure\\AI;\n\n\/\/ @responsibility: Berechnet gewichtete Scores aus Vector-Similarity, Recency und Authority\n\nuse DateTimeInterface;",
"new_string": "namespace Infrastructure\\AI;\n\n\/\/ @responsibility: Berechnet gewichtete Scores aus Vector-Similarity, Recency und Authority\n\nuse DateTimeInterface;\nuse Domain\\Constants;"
}
}
Response
{
"tool_response": {
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Infrastructure\/AI\/ScoringService.php",
"oldString": "namespace Infrastructure\\AI;\n\n\/\/ @responsibility: Berechnet gewichtete Scores aus Vector-Similarity, Recency und Authority\n\nuse DateTimeInterface;",
"newString": "namespace Infrastructure\\AI;\n\n\/\/ @responsibility: Berechnet gewichtete Scores aus Vector-Similarity, Recency und Authority\n\nuse DateTimeInterface;\nuse Domain\\Constants;",
"originalFile": "<?php\n\ndeclare(strict_types=1);\n\nnamespace Infrastructure\\AI;\n\n\/\/ @responsibility: Berechnet gewichtete Scores aus Vector-Similarity, Recency und Authority\n\nuse DateTimeInterface;\n\n\/**\n * Calculates weighted scores for RAG search results.\n *\n * Combines vector similarity with recency and authority factors\n * to produce a more nuanced ranking of search results.\n *\/\nfinal readonly class ScoringService\n{\n \/** Weight for vector similarity score (cosine) *\/\n private const WEIGHT_SIMILARITY = 0.7;\n\n \/** Weight for document recency *\/\n private const WEIGHT_RECENCY = 0.1;\n\n \/** Weight for source authority *\/\n private const WEIGHT_AUTHORITY = 0.2;\n\n \/**\n * Calculate weighted score combining similarity, recency, and authority.\n *\n * @param float $vectorScore The cosine similarity score from vector search (0.0-1.0)\n * @param DateTimeInterface $documentDate The document's processed\/created date\n * @param float $authorityScore The source authority score (0.0-1.0, default: 0.5)\n *\n * @return float The weighted score (0.0-1.0)\n *\/\n public function calculateScore(\n float $vectorScore,\n DateTimeInterface $documentDate,\n float $authorityScore = 0.5\n ): float {\n $recencyScore = $this->calculateRecency($documentDate);\n\n return (self::WEIGHT_SIMILARITY * $vectorScore)\n + (self::WEIGHT_RECENCY * $recencyScore)\n + (self::WEIGHT_AUTHORITY * $authorityScore);\n }\n\n \/**\n * Calculate recency score based on document age.\n *\n * Returns 1.0 for today, linearly decreasing to 0.0 at 365 days old.\n *\n * @param DateTimeInterface $date The document date\n *\n * @return float Recency score (0.0-1.0)\n *\/\n private function calculateRecency(DateTimeInterface $date): float\n {\n $now = new \\DateTime();\n $interval = $now->diff($date);\n $daysOld = $interval->days;\n\n \/\/ Documents older than 1 year get minimum recency score\n return max(0.0, 1.0 - ($daysOld \/ 365));\n }\n\n \/**\n * Get the weight configuration for transparency.\n *\n * @return array{similarity: float, recency: float, authority: float}\n *\/\n public function getWeights(): array\n {\n return [\n 'similarity' => self::WEIGHT_SIMILARITY,\n 'recency' => self::WEIGHT_RECENCY,\n 'authority' => self::WEIGHT_AUTHORITY,\n ];\n }\n}\n",
"structuredPatch": [
{
"oldStart": 7,
"oldLines": 6,
"newStart": 7,
"newLines": 7,
"lines": [
" \/\/ @responsibility: Berechnet gewichtete Scores aus Vector-Similarity, Recency und Authority",
" ",
" use DateTimeInterface;",
"+use Domain\\Constants;",
" ",
" \/**",
" * Calculates weighted scores for RAG search results."
]
}
],
"userModified": false,
"replaceAll": false
}
}