Local branch had diverged from origin/master (sibling commits on the same base). Rewrote local history linearly on top of origin/master, folding in all local content: exa/hot-platform discovery hunters, leaks ledger, nightly sweep orchestrator, updated .gitignore and skill docs, plus the latest hunt output and vault state. Remote-only files (vault keys, channel scripts) were restored rather than dropped, so the resulting tree is a full union of both sides.
1 line
35 KiB
JSON
1 line
35 KiB
JSON
{"repo": "aymhki/harvestschools", "files": {"bot/shared/llm_handler.php": {"8e1812e86c37c5fabde829b0d3b8007bce9ac4c5": {"t": 1785745765.462811, "n": 4143, "h": "4cdc05fa4668a3ee", "c": "<?php\n$doc_root = rtrim($_SERVER['DOCUMENT_ROOT'], '/\\\\');\nrequire_once dirname($doc_root) . '/configs/botConfig.php';\n\nfunction llm_curl_post($url, $headers, $payload) {\n $ch = curl_init($url);\n curl_setopt_array($ch, [\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_POST => true,\n CURLOPT_HTTPHEADER => $headers,\n CURLOPT_POSTFIELDS => json_encode($payload),\n CURLOPT_TIMEOUT => 30\n ]);\n $body = curl_exec($ch);\n $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);\n $curlErr = curl_error($ch);\n\n if ($curlErr) {\n file_put_contents(__DIR__ . '/error.log', date('c') . \" LLM CURL ERROR: {$curlErr}\\n\", FILE_APPEND);\n return false;\n }\n if ($httpCode < 200 || $httpCode >= 300) {\n file_put_contents(__DIR__ . '/error.log', date('c') . \" LLM HTTP {$httpCode}: {$body}\\n\", FILE_APPEND);\n return false;\n }\n $decoded = json_decode($body, true);\n if (!is_array($decoded)) {\n file_put_contents(__DIR__ . '/error.log', date('c') . \" LLM JSON DECODE ERROR: {$body}\\n\", FILE_APPEND);\n return false;\n }\n return $decoded;\n}\n\nfunction llm_chat($systemPrompt, $history, $userMessage, $lang = 'en') {\n global $STRINGS;\n $result = false;\n if (LLM_PROVIDER === 'gemini') {\n $result = gemini_chat($systemPrompt, $history, $userMessage);\n } elseif (LLM_PROVIDER === 'deepseek') {\n $result = deepseek_chat($systemPrompt, $history, $userMessage);\n } elseif (LLM_PROVIDER === 'claude') {\n $result = claude_chat($systemPrompt, $history, $userMessage);\n }\n if ($result === false || $result === null || trim((string)$result) === '') {\n return $STRINGS['llm_error'][$lang] ?? \"Sorry, could not process your request.\";\n }\n return $result;\n}\n\nfunction gemini_chat($systemPrompt, $history, $userMessage) {\n $contents = [];\n foreach ($history as $h) {\n $contents[] = [\n \"role\" => $h['role'] === 'assistant' ? 'model' : 'user',\n \"parts\" => [[\"text\" => $h['message']]]\n ];\n }\n $contents[] = [\"role\" => \"user\", \"parts\" => [[\"text\" => $userMessage]]];\n\n $payload = [\n \"system_instruction\" => [\"parts\" => [[\"text\" => $systemPrompt]]],\n \"contents\" => $contents\n ];\n\n $url = \"https://generativelanguage.googleapis.com/v1/models/gemini-3.1-flash-lite:generateContent?key=\" . GEMINI_API_KEY;\n $resp = llm_curl_post($url, [\"Content-Type: application/json\"], $payload);\n if ($resp === false) return false;\n return $resp['candidates'][0]['content']['parts'][0]['text'] ?? false;\n}\n\nfunction deepseek_chat($systemPrompt, $history, $userMessage) {\n $messages = [[\"role\" => \"system\", \"content\" => $systemPrompt]];\n foreach ($history as $h) {\n $messages[] = [\"role\" => $h['role'], \"content\" => $h['message']];\n }\n $messages[] = [\"role\" => \"user\", \"content\" => $userMessage];\n $payload = [\n \"model\" => \"deepseek-v4-pro\",\n \"messages\" => $messages\n ];\n $headers = [\n \"Authorization: Bearer \" . DEEPSEEK_API_KEY,\n \"Content-Type: application/json\"\n ];\n $resp = llm_curl_post(\"https://api.deepseek.com/chat/completions\", $headers, $payload);\n if ($resp === false) return false;\n return $resp['choices'][0]['message']['content'] ?? false;\n}\n\nfunction claude_chat($systemPrompt, $history, $userMessage) {\n $messages = [];\n foreach ($history as $h) {\n $messages[] = [\n \"role\" => $h['role'] === 'assistant' ? 'assistant' : 'user',\n \"content\" => $h['message']\n ];\n }\n $messages[] = [\"role\" => \"user\", \"content\" => $userMessage];\n $payload = [\n \"model\" => \"claude-haiku-4-5-20251001\",\n \"max_tokens\" => 1024,\n \"system\" => $systemPrompt,\n \"messages\" => $messages\n ];\n $headers = [\n \"x-api-key: \" . CLAUDE_API_KEY,\n \"anthropic-version: 2023-06-01\",\n \"Content-Type: application/json\"\n ];\n $resp = llm_curl_post(\"https://api.anthropic.com/v1/messages\", $headers, $payload);\n if ($resp === false) return false;\n return $resp['content'][0]['text'] ?? false;\n}\n"}, "fcb3de79f79d6a8be25fb727ccc34510bea401d1": {"t": 1785756287.6792066, "n": 4143, "h": "4cdc05fa4668a3ee", "c": "<?php\n$doc_root = rtrim($_SERVER['DOCUMENT_ROOT'], '/\\\\');\nrequire_once dirname($doc_root) . '/configs/botConfig.php';\n\nfunction llm_curl_post($url, $headers, $payload) {\n $ch = curl_init($url);\n curl_setopt_array($ch, [\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_POST => true,\n CURLOPT_HTTPHEADER => $headers,\n CURLOPT_POSTFIELDS => json_encode($payload),\n CURLOPT_TIMEOUT => 30\n ]);\n $body = curl_exec($ch);\n $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);\n $curlErr = curl_error($ch);\n\n if ($curlErr) {\n file_put_contents(__DIR__ . '/error.log', date('c') . \" LLM CURL ERROR: {$curlErr}\\n\", FILE_APPEND);\n return false;\n }\n if ($httpCode < 200 || $httpCode >= 300) {\n file_put_contents(__DIR__ . '/error.log', date('c') . \" LLM HTTP {$httpCode}: {$body}\\n\", FILE_APPEND);\n return false;\n }\n $decoded = json_decode($body, true);\n if (!is_array($decoded)) {\n file_put_contents(__DIR__ . '/error.log', date('c') . \" LLM JSON DECODE ERROR: {$body}\\n\", FILE_APPEND);\n return false;\n }\n return $decoded;\n}\n\nfunction llm_chat($systemPrompt, $history, $userMessage, $lang = 'en') {\n global $STRINGS;\n $result = false;\n if (LLM_PROVIDER === 'gemini') {\n $result = gemini_chat($systemPrompt, $history, $userMessage);\n } elseif (LLM_PROVIDER === 'deepseek') {\n $result = deepseek_chat($systemPrompt, $history, $userMessage);\n } elseif (LLM_PROVIDER === 'claude') {\n $result = claude_chat($systemPrompt, $history, $userMessage);\n }\n if ($result === false || $result === null || trim((string)$result) === '') {\n return $STRINGS['llm_error'][$lang] ?? \"Sorry, could not process your request.\";\n }\n return $result;\n}\n\nfunction gemini_chat($systemPrompt, $history, $userMessage) {\n $contents = [];\n foreach ($history as $h) {\n $contents[] = [\n \"role\" => $h['role'] === 'assistant' ? 'model' : 'user',\n \"parts\" => [[\"text\" => $h['message']]]\n ];\n }\n $contents[] = [\"role\" => \"user\", \"parts\" => [[\"text\" => $userMessage]]];\n\n $payload = [\n \"system_instruction\" => [\"parts\" => [[\"text\" => $systemPrompt]]],\n \"contents\" => $contents\n ];\n\n $url = \"https://generativelanguage.googleapis.com/v1/models/gemini-3.1-flash-lite:generateContent?key=\" . GEMINI_API_KEY;\n $resp = llm_curl_post($url, [\"Content-Type: application/json\"], $payload);\n if ($resp === false) return false;\n return $resp['candidates'][0]['content']['parts'][0]['text'] ?? false;\n}\n\nfunction deepseek_chat($systemPrompt, $history, $userMessage) {\n $messages = [[\"role\" => \"system\", \"content\" => $systemPrompt]];\n foreach ($history as $h) {\n $messages[] = [\"role\" => $h['role'], \"content\" => $h['message']];\n }\n $messages[] = [\"role\" => \"user\", \"content\" => $userMessage];\n $payload = [\n \"model\" => \"deepseek-v4-pro\",\n \"messages\" => $messages\n ];\n $headers = [\n \"Authorization: Bearer \" . DEEPSEEK_API_KEY,\n \"Content-Type: application/json\"\n ];\n $resp = llm_curl_post(\"https://api.deepseek.com/chat/completions\", $headers, $payload);\n if ($resp === false) return false;\n return $resp['choices'][0]['message']['content'] ?? false;\n}\n\nfunction claude_chat($systemPrompt, $history, $userMessage) {\n $messages = [];\n foreach ($history as $h) {\n $messages[] = [\n \"role\" => $h['role'] === 'assistant' ? 'assistant' : 'user',\n \"content\" => $h['message']\n ];\n }\n $messages[] = [\"role\" => \"user\", \"content\" => $userMessage];\n $payload = [\n \"model\" => \"claude-haiku-4-5-20251001\",\n \"max_tokens\" => 1024,\n \"system\" => $systemPrompt,\n \"messages\" => $messages\n ];\n $headers = [\n \"x-api-key: \" . CLAUDE_API_KEY,\n \"anthropic-version: 2023-06-01\",\n \"Content-Type: application/json\"\n ];\n $resp = llm_curl_post(\"https://api.anthropic.com/v1/messages\", $headers, $payload);\n if ($resp === false) return false;\n return $resp['content'][0]['text'] ?? false;\n}\n"}, "5a6e04c0c6766e2b52451d7c79cf031ed5e2dd36": {"t": 1785756288.8776643, "n": 4164, "h": "c8f68f2249baae9b", "c": "<?php\n$doc_root = rtrim($_SERVER['DOCUMENT_ROOT'], '/\\\\');\nrequire_once dirname($doc_root) . '/configs/botConfig.php';\n\nfunction llm_curl_post($url, $headers, $payload) {\n $ch = curl_init($url);\n curl_setopt_array($ch, [\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_POST => true,\n CURLOPT_HTTPHEADER => $headers,\n CURLOPT_POSTFIELDS => json_encode($payload),\n CURLOPT_TIMEOUT => 30\n ]);\n $body = curl_exec($ch);\n $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);\n $curlErr = curl_error($ch);\n curl_close($ch);\n\n if ($curlErr) {\n file_put_contents(__DIR__ . '/error.log', date('c') . \" LLM CURL ERROR: {$curlErr}\\n\", FILE_APPEND);\n return false;\n }\n if ($httpCode < 200 || $httpCode >= 300) {\n file_put_contents(__DIR__ . '/error.log', date('c') . \" LLM HTTP {$httpCode}: {$body}\\n\", FILE_APPEND);\n return false;\n }\n $decoded = json_decode($body, true);\n if (!is_array($decoded)) {\n file_put_contents(__DIR__ . '/error.log', date('c') . \" LLM JSON DECODE ERROR: {$body}\\n\", FILE_APPEND);\n return false;\n }\n return $decoded;\n}\n\nfunction llm_chat($systemPrompt, $history, $userMessage, $lang = 'en') {\n global $STRINGS;\n $result = false;\n if (LLM_PROVIDER === 'gemini') {\n $result = gemini_chat($systemPrompt, $history, $userMessage);\n } elseif (LLM_PROVIDER === 'deepseek') {\n $result = deepseek_chat($systemPrompt, $history, $userMessage);\n } elseif (LLM_PROVIDER === 'claude') {\n $result = claude_chat($systemPrompt, $history, $userMessage);\n }\n if ($result === false || $result === null || trim((string)$result) === '') {\n return $STRINGS['llm_error'][$lang] ?? \"Sorry, could not process your request.\";\n }\n return $result;\n}\n\nfunction gemini_chat($systemPrompt, $history, $userMessage) {\n $contents = [];\n foreach ($history as $h) {\n $contents[] = [\n \"role\" => $h['role'] === 'assistant' ? 'model' : 'user',\n \"parts\" => [[\"text\" => $h['message']]]\n ];\n }\n $contents[] = [\"role\" => \"user\", \"parts\" => [[\"text\" => $userMessage]]];\n\n $payload = [\n \"system_instruction\" => [\"parts\" => [[\"text\" => $systemPrompt]]],\n \"contents\" => $contents\n ];\n\n $url = \"https://generativelanguage.googleapis.com/v1/models/gemini-3.1-flash-lite:generateContent?key=\" . GEMINI_API_KEY;\n $resp = llm_curl_post($url, [\"Content-Type: application/json\"], $payload);\n if ($resp === false) return false;\n return $resp['candidates'][0]['content']['parts'][0]['text'] ?? false;\n}\n\nfunction deepseek_chat($systemPrompt, $history, $userMessage) {\n $messages = [[\"role\" => \"system\", \"content\" => $systemPrompt]];\n foreach ($history as $h) {\n $messages[] = [\"role\" => $h['role'], \"content\" => $h['message']];\n }\n $messages[] = [\"role\" => \"user\", \"content\" => $userMessage];\n $payload = [\n \"model\" => \"deepseek-v4-pro\",\n \"messages\" => $messages\n ];\n $headers = [\n \"Authorization: Bearer \" . DEEPSEEK_API_KEY,\n \"Content-Type: application/json\"\n ];\n $resp = llm_curl_post(\"https://api.deepseek.com/chat/completions\", $headers, $payload);\n if ($resp === false) return false;\n return $resp['choices'][0]['message']['content'] ?? false;\n}\n\nfunction claude_chat($systemPrompt, $history, $userMessage) {\n $messages = [];\n foreach ($history as $h) {\n $messages[] = [\n \"role\" => $h['role'] === 'assistant' ? 'assistant' : 'user',\n \"content\" => $h['message']\n ];\n }\n $messages[] = [\"role\" => \"user\", \"content\" => $userMessage];\n $payload = [\n \"model\" => \"claude-haiku-4-5-20251001\",\n \"max_tokens\" => 1024,\n \"system\" => $systemPrompt,\n \"messages\" => $messages\n ];\n $headers = [\n \"x-api-key: \" . CLAUDE_API_KEY,\n \"anthropic-version: 2023-06-01\",\n \"Content-Type: application/json\"\n ];\n $resp = llm_curl_post(\"https://api.anthropic.com/v1/messages\", $headers, $payload);\n if ($resp === false) return false;\n return $resp['content'][0]['text'] ?? false;\n}\n"}, "ddb79bdf5c01ab1a8f35505ebe120ee2ddb46f03": {"t": 1785756290.3302388, "n": 4095, "h": "60afca8f56c2da8f", "c": "<?php\nrequire_once '../../configs/botConfig.php';\n\nfunction llm_curl_post($url, $headers, $payload) {\n $ch = curl_init($url);\n curl_setopt_array($ch, [\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_POST => true,\n CURLOPT_HTTPHEADER => $headers,\n CURLOPT_POSTFIELDS => json_encode($payload),\n CURLOPT_TIMEOUT => 30\n ]);\n $body = curl_exec($ch);\n $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);\n $curlErr = curl_error($ch);\n curl_close($ch);\n\n if ($curlErr) {\n file_put_contents(__DIR__ . '/error.log', date('c') . \" LLM CURL ERROR: {$curlErr}\\n\", FILE_APPEND);\n return false;\n }\n if ($httpCode < 200 || $httpCode >= 300) {\n file_put_contents(__DIR__ . '/error.log', date('c') . \" LLM HTTP {$httpCode}: {$body}\\n\", FILE_APPEND);\n return false;\n }\n $decoded = json_decode($body, true);\n if (!is_array($decoded)) {\n file_put_contents(__DIR__ . '/error.log', date('c') . \" LLM JSON DECODE ERROR: {$body}\\n\", FILE_APPEND);\n return false;\n }\n return $decoded;\n}\n\nfunction llm_chat($systemPrompt, $history, $userMessage, $lang = 'en') {\n global $STRINGS;\n $result = false;\n if (LLM_PROVIDER === 'gemini') {\n $result = gemini_chat($systemPrompt, $history, $userMessage);\n } elseif (LLM_PROVIDER === 'deepseek') {\n $result = deepseek_chat($systemPrompt, $history, $userMessage);\n } elseif (LLM_PROVIDER === 'claude') {\n $result = claude_chat($systemPrompt, $history, $userMessage);\n }\n if ($result === false || $result === null || trim((string)$result) === '') {\n return $STRINGS['llm_error'][$lang] ?? \"Sorry, could not process your request.\";\n }\n return $result;\n}\n\nfunction gemini_chat($systemPrompt, $history, $userMessage) {\n $contents = [];\n foreach ($history as $h) {\n $contents[] = [\n \"role\" => $h['role'] === 'assistant' ? 'model' : 'user',\n \"parts\" => [[\"text\" => $h['message']]]\n ];\n }\n $contents[] = [\"role\" => \"user\", \"parts\" => [[\"text\" => $userMessage]]];\n\n $payload = [\n \"system_instruction\" => [\"parts\" => [[\"text\" => $systemPrompt]]],\n \"contents\" => $contents\n ];\n\n $url = \"https://generativelanguage.googleapis.com/v1/models/gemini-3.1-flash-lite:generateContent?key=\" . GEMINI_API_KEY;\n $resp = llm_curl_post($url, [\"Content-Type: application/json\"], $payload);\n if ($resp === false) return false;\n return $resp['candidates'][0]['content']['parts'][0]['text'] ?? false;\n}\n\nfunction deepseek_chat($systemPrompt, $history, $userMessage) {\n $messages = [[\"role\" => \"system\", \"content\" => $systemPrompt]];\n foreach ($history as $h) {\n $messages[] = [\"role\" => $h['role'], \"content\" => $h['message']];\n }\n $messages[] = [\"role\" => \"user\", \"content\" => $userMessage];\n $payload = [\n \"model\" => \"deepseek-v4-pro\",\n \"messages\" => $messages\n ];\n $headers = [\n \"Authorization: Bearer \" . DEEPSEEK_API_KEY,\n \"Content-Type: application/json\"\n ];\n $resp = llm_curl_post(\"https://api.deepseek.com/chat/completions\", $headers, $payload);\n if ($resp === false) return false;\n return $resp['choices'][0]['message']['content'] ?? false;\n}\n\nfunction claude_chat($systemPrompt, $history, $userMessage) {\n $messages = [];\n foreach ($history as $h) {\n $messages[] = [\n \"role\" => $h['role'] === 'assistant' ? 'assistant' : 'user',\n \"content\" => $h['message']\n ];\n }\n $messages[] = [\"role\" => \"user\", \"content\" => $userMessage];\n $payload = [\n \"model\" => \"claude-haiku-4-5-20251001\",\n \"max_tokens\" => 1024,\n \"system\" => $systemPrompt,\n \"messages\" => $messages\n ];\n $headers = [\n \"x-api-key: \" . CLAUDE_API_KEY,\n \"anthropic-version: 2023-06-01\",\n \"Content-Type: application/json\"\n ];\n $resp = llm_curl_post(\"https://api.anthropic.com/v1/messages\", $headers, $payload);\n if ($resp === false) return false;\n return $resp['content'][0]['text'] ?? false;\n}\n"}, "037abde522ee1b96c3b5eaeae592d42837b45496": {"t": 1785756292.7620687, "n": 4106, "h": "f2d324b435ae097b", "c": "<?php\nrequire_once __DIR__ . '/../../configs/botConfig.php';\n\nfunction llm_curl_post($url, $headers, $payload) {\n $ch = curl_init($url);\n curl_setopt_array($ch, [\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_POST => true,\n CURLOPT_HTTPHEADER => $headers,\n CURLOPT_POSTFIELDS => json_encode($payload),\n CURLOPT_TIMEOUT => 30\n ]);\n $body = curl_exec($ch);\n $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);\n $curlErr = curl_error($ch);\n curl_close($ch);\n\n if ($curlErr) {\n file_put_contents(__DIR__ . '/error.log', date('c') . \" LLM CURL ERROR: {$curlErr}\\n\", FILE_APPEND);\n return false;\n }\n if ($httpCode < 200 || $httpCode >= 300) {\n file_put_contents(__DIR__ . '/error.log', date('c') . \" LLM HTTP {$httpCode}: {$body}\\n\", FILE_APPEND);\n return false;\n }\n $decoded = json_decode($body, true);\n if (!is_array($decoded)) {\n file_put_contents(__DIR__ . '/error.log', date('c') . \" LLM JSON DECODE ERROR: {$body}\\n\", FILE_APPEND);\n return false;\n }\n return $decoded;\n}\n\nfunction llm_chat($systemPrompt, $history, $userMessage, $lang = 'en') {\n global $STRINGS;\n $result = false;\n if (LLM_PROVIDER === 'gemini') {\n $result = gemini_chat($systemPrompt, $history, $userMessage);\n } elseif (LLM_PROVIDER === 'deepseek') {\n $result = deepseek_chat($systemPrompt, $history, $userMessage);\n } elseif (LLM_PROVIDER === 'claude') {\n $result = claude_chat($systemPrompt, $history, $userMessage);\n }\n if ($result === false || $result === null || trim((string)$result) === '') {\n return $STRINGS['llm_error'][$lang] ?? \"Sorry, could not process your request.\";\n }\n return $result;\n}\n\nfunction gemini_chat($systemPrompt, $history, $userMessage) {\n $contents = [];\n foreach ($history as $h) {\n $contents[] = [\n \"role\" => $h['role'] === 'assistant' ? 'model' : 'user',\n \"parts\" => [[\"text\" => $h['message']]]\n ];\n }\n $contents[] = [\"role\" => \"user\", \"parts\" => [[\"text\" => $userMessage]]];\n\n $payload = [\n \"system_instruction\" => [\"parts\" => [[\"text\" => $systemPrompt]]],\n \"contents\" => $contents\n ];\n\n $url = \"https://generativelanguage.googleapis.com/v1/models/gemini-3.1-flash-lite:generateContent?key=\" . GEMINI_API_KEY;\n $resp = llm_curl_post($url, [\"Content-Type: application/json\"], $payload);\n if ($resp === false) return false;\n return $resp['candidates'][0]['content']['parts'][0]['text'] ?? false;\n}\n\nfunction deepseek_chat($systemPrompt, $history, $userMessage) {\n $messages = [[\"role\" => \"system\", \"content\" => $systemPrompt]];\n foreach ($history as $h) {\n $messages[] = [\"role\" => $h['role'], \"content\" => $h['message']];\n }\n $messages[] = [\"role\" => \"user\", \"content\" => $userMessage];\n $payload = [\n \"model\" => \"deepseek-v4-pro\",\n \"messages\" => $messages\n ];\n $headers = [\n \"Authorization: Bearer \" . DEEPSEEK_API_KEY,\n \"Content-Type: application/json\"\n ];\n $resp = llm_curl_post(\"https://api.deepseek.com/chat/completions\", $headers, $payload);\n if ($resp === false) return false;\n return $resp['choices'][0]['message']['content'] ?? false;\n}\n\nfunction claude_chat($systemPrompt, $history, $userMessage) {\n $messages = [];\n foreach ($history as $h) {\n $messages[] = [\n \"role\" => $h['role'] === 'assistant' ? 'assistant' : 'user',\n \"content\" => $h['message']\n ];\n }\n $messages[] = [\"role\" => \"user\", \"content\" => $userMessage];\n $payload = [\n \"model\" => \"claude-haiku-4-5-20251001\",\n \"max_tokens\" => 1024,\n \"system\" => $systemPrompt,\n \"messages\" => $messages\n ];\n $headers = [\n \"x-api-key: \" . CLAUDE_API_KEY,\n \"anthropic-version: 2023-06-01\",\n \"Content-Type: application/json\"\n ];\n $resp = llm_curl_post(\"https://api.anthropic.com/v1/messages\", $headers, $payload);\n if ($resp === false) return false;\n return $resp['content'][0]['text'] ?? false;\n}\n"}, "84e092919cc3600ba8922b7383e1f24020342104": {"t": 1785756294.2180228, "n": 4089, "h": "7cedbd215fc29066", "c": "<?php\nrequire_once __DIR__ . '/config.php';\n\nfunction llm_curl_post($url, $headers, $payload) {\n $ch = curl_init($url);\n curl_setopt_array($ch, [\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_POST => true,\n CURLOPT_HTTPHEADER => $headers,\n CURLOPT_POSTFIELDS => json_encode($payload),\n CURLOPT_TIMEOUT => 30\n ]);\n $body = curl_exec($ch);\n $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);\n $curlErr = curl_error($ch);\n curl_close($ch);\n\n if ($curlErr) {\n file_put_contents(__DIR__ . '/error.log', date('c') . \" LLM CURL ERROR: {$curlErr}\\n\", FILE_APPEND);\n return false;\n }\n if ($httpCode < 200 || $httpCode >= 300) {\n file_put_contents(__DIR__ . '/error.log', date('c') . \" LLM HTTP {$httpCode}: {$body}\\n\", FILE_APPEND);\n return false;\n }\n $decoded = json_decode($body, true);\n if (!is_array($decoded)) {\n file_put_contents(__DIR__ . '/error.log', date('c') . \" LLM JSON DECODE ERROR: {$body}\\n\", FILE_APPEND);\n return false;\n }\n return $decoded;\n}\n\nfunction llm_chat($systemPrompt, $history, $userMessage, $lang = 'en') {\n global $STRINGS;\n $result = false;\n if (LLM_PROVIDER === 'gemini') {\n $result = gemini_chat($systemPrompt, $history, $userMessage);\n } elseif (LLM_PROVIDER === 'deepseek') {\n $result = deepseek_chat($systemPrompt, $history, $userMessage);\n } elseif (LLM_PROVIDER === 'claude') {\n $result = claude_chat($systemPrompt, $history, $userMessage);\n }\n if ($result === false || $result === null || trim((string)$result) === '') {\n return $STRINGS['llm_error'][$lang] ?? \"Sorry, could not process your request.\";\n }\n return $result;\n}\n\nfunction gemini_chat($systemPrompt, $history, $userMessage) {\n $contents = [];\n foreach ($history as $h) {\n $contents[] = [\n \"role\" => $h['role'] === 'assistant' ? 'model' : 'user',\n \"parts\" => [[\"text\" => $h['message']]]\n ];\n }\n $contents[] = [\"role\" => \"user\", \"parts\" => [[\"text\" => $userMessage]]];\n\n $payload = [\n \"system_instruction\" => [\"parts\" => [[\"text\" => $systemPrompt]]],\n \"contents\" => $contents\n ];\n\n $url = \"https://generativelanguage.googleapis.com/v1/models/gemini-3.1-flash-lite:generateContent?key=\" . GEMINI_API_KEY;\n $resp = llm_curl_post($url, [\"Content-Type: application/json\"], $payload);\n if ($resp === false) return false;\n return $resp['candidates'][0]['content']['parts'][0]['text'] ?? false;\n}\n\nfunction deepseek_chat($systemPrompt, $history, $userMessage) {\n $messages = [[\"role\" => \"system\", \"content\" => $systemPrompt]];\n foreach ($history as $h) {\n $messages[] = [\"role\" => $h['role'], \"content\" => $h['message']];\n }\n $messages[] = [\"role\" => \"user\", \"content\" => $userMessage];\n $payload = [\n \"model\" => \"deepseek-v4-pro\",\n \"messages\" => $messages\n ];\n $headers = [\n \"Authorization: Bearer \" . DEEPSEEK_API_KEY,\n \"Content-Type: application/json\"\n ];\n $resp = llm_curl_post(\"https://api.deepseek.com/chat/completions\", $headers, $payload);\n if ($resp === false) return false;\n return $resp['choices'][0]['message']['content'] ?? false;\n}\n\nfunction claude_chat($systemPrompt, $history, $userMessage) {\n $messages = [];\n foreach ($history as $h) {\n $messages[] = [\n \"role\" => $h['role'] === 'assistant' ? 'assistant' : 'user',\n \"content\" => $h['message']\n ];\n }\n $messages[] = [\"role\" => \"user\", \"content\" => $userMessage];\n $payload = [\n \"model\" => \"claude-haiku-4-5-20251001\",\n \"max_tokens\" => 1024,\n \"system\" => $systemPrompt,\n \"messages\" => $messages\n ];\n $headers = [\n \"x-api-key: \" . CLAUDE_API_KEY,\n \"anthropic-version: 2023-06-01\",\n \"Content-Type: application/json\"\n ];\n $resp = llm_curl_post(\"https://api.anthropic.com/v1/messages\", $headers, $payload);\n if ($resp === false) return false;\n return $resp['content'][0]['text'] ?? false;\n}\n"}, "c8dfbf06e78c62585e23e05740eea7845bc9059e": {"t": 1786067459.9088466, "n": 4143, "h": "4cdc05fa4668a3ee", "c": "<?php\n$doc_root = rtrim($_SERVER['DOCUMENT_ROOT'], '/\\\\');\nrequire_once dirname($doc_root) . '/configs/botConfig.php';\n\nfunction llm_curl_post($url, $headers, $payload) {\n $ch = curl_init($url);\n curl_setopt_array($ch, [\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_POST => true,\n CURLOPT_HTTPHEADER => $headers,\n CURLOPT_POSTFIELDS => json_encode($payload),\n CURLOPT_TIMEOUT => 30\n ]);\n $body = curl_exec($ch);\n $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);\n $curlErr = curl_error($ch);\n\n if ($curlErr) {\n file_put_contents(__DIR__ . '/error.log', date('c') . \" LLM CURL ERROR: {$curlErr}\\n\", FILE_APPEND);\n return false;\n }\n if ($httpCode < 200 || $httpCode >= 300) {\n file_put_contents(__DIR__ . '/error.log', date('c') . \" LLM HTTP {$httpCode}: {$body}\\n\", FILE_APPEND);\n return false;\n }\n $decoded = json_decode($body, true);\n if (!is_array($decoded)) {\n file_put_contents(__DIR__ . '/error.log', date('c') . \" LLM JSON DECODE ERROR: {$body}\\n\", FILE_APPEND);\n return false;\n }\n return $decoded;\n}\n\nfunction llm_chat($systemPrompt, $history, $userMessage, $lang = 'en') {\n global $STRINGS;\n $result = false;\n if (LLM_PROVIDER === 'gemini') {\n $result = gemini_chat($systemPrompt, $history, $userMessage);\n } elseif (LLM_PROVIDER === 'deepseek') {\n $result = deepseek_chat($systemPrompt, $history, $userMessage);\n } elseif (LLM_PROVIDER === 'claude') {\n $result = claude_chat($systemPrompt, $history, $userMessage);\n }\n if ($result === false || $result === null || trim((string)$result) === '') {\n return $STRINGS['llm_error'][$lang] ?? \"Sorry, could not process your request.\";\n }\n return $result;\n}\n\nfunction gemini_chat($systemPrompt, $history, $userMessage) {\n $contents = [];\n foreach ($history as $h) {\n $contents[] = [\n \"role\" => $h['role'] === 'assistant' ? 'model' : 'user',\n \"parts\" => [[\"text\" => $h['message']]]\n ];\n }\n $contents[] = [\"role\" => \"user\", \"parts\" => [[\"text\" => $userMessage]]];\n\n $payload = [\n \"system_instruction\" => [\"parts\" => [[\"text\" => $systemPrompt]]],\n \"contents\" => $contents\n ];\n\n $url = \"https://generativelanguage.googleapis.com/v1/models/gemini-3.1-flash-lite:generateContent?key=\" . GEMINI_API_KEY;\n $resp = llm_curl_post($url, [\"Content-Type: application/json\"], $payload);\n if ($resp === false) return false;\n return $resp['candidates'][0]['content']['parts'][0]['text'] ?? false;\n}\n\nfunction deepseek_chat($systemPrompt, $history, $userMessage) {\n $messages = [[\"role\" => \"system\", \"content\" => $systemPrompt]];\n foreach ($history as $h) {\n $messages[] = [\"role\" => $h['role'], \"content\" => $h['message']];\n }\n $messages[] = [\"role\" => \"user\", \"content\" => $userMessage];\n $payload = [\n \"model\" => \"deepseek-v4-pro\",\n \"messages\" => $messages\n ];\n $headers = [\n \"Authorization: Bearer \" . DEEPSEEK_API_KEY,\n \"Content-Type: application/json\"\n ];\n $resp = llm_curl_post(\"https://api.deepseek.com/chat/completions\", $headers, $payload);\n if ($resp === false) return false;\n return $resp['choices'][0]['message']['content'] ?? false;\n}\n\nfunction claude_chat($systemPrompt, $history, $userMessage) {\n $messages = [];\n foreach ($history as $h) {\n $messages[] = [\n \"role\" => $h['role'] === 'assistant' ? 'assistant' : 'user',\n \"content\" => $h['message']\n ];\n }\n $messages[] = [\"role\" => \"user\", \"content\" => $userMessage];\n $payload = [\n \"model\" => \"claude-haiku-4-5-20251001\",\n \"max_tokens\" => 1024,\n \"system\" => $systemPrompt,\n \"messages\" => $messages\n ];\n $headers = [\n \"x-api-key: \" . CLAUDE_API_KEY,\n \"anthropic-version: 2023-06-01\",\n \"Content-Type: application/json\"\n ];\n $resp = llm_curl_post(\"https://api.anthropic.com/v1/messages\", $headers, $payload);\n if ($resp === false) return false;\n return $resp['content'][0]['text'] ?? false;\n}\n"}, "0e0ed7e6fcbb99225699bb6e97e34796763441eb": {"t": 1786068313.275974, "n": 4143, "h": "4cdc05fa4668a3ee", "c": "<?php\n$doc_root = rtrim($_SERVER['DOCUMENT_ROOT'], '/\\\\');\nrequire_once dirname($doc_root) . '/configs/botConfig.php';\n\nfunction llm_curl_post($url, $headers, $payload) {\n $ch = curl_init($url);\n curl_setopt_array($ch, [\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_POST => true,\n CURLOPT_HTTPHEADER => $headers,\n CURLOPT_POSTFIELDS => json_encode($payload),\n CURLOPT_TIMEOUT => 30\n ]);\n $body = curl_exec($ch);\n $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);\n $curlErr = curl_error($ch);\n\n if ($curlErr) {\n file_put_contents(__DIR__ . '/error.log', date('c') . \" LLM CURL ERROR: {$curlErr}\\n\", FILE_APPEND);\n return false;\n }\n if ($httpCode < 200 || $httpCode >= 300) {\n file_put_contents(__DIR__ . '/error.log', date('c') . \" LLM HTTP {$httpCode}: {$body}\\n\", FILE_APPEND);\n return false;\n }\n $decoded = json_decode($body, true);\n if (!is_array($decoded)) {\n file_put_contents(__DIR__ . '/error.log', date('c') . \" LLM JSON DECODE ERROR: {$body}\\n\", FILE_APPEND);\n return false;\n }\n return $decoded;\n}\n\nfunction llm_chat($systemPrompt, $history, $userMessage, $lang = 'en') {\n global $STRINGS;\n $result = false;\n if (LLM_PROVIDER === 'gemini') {\n $result = gemini_chat($systemPrompt, $history, $userMessage);\n } elseif (LLM_PROVIDER === 'deepseek') {\n $result = deepseek_chat($systemPrompt, $history, $userMessage);\n } elseif (LLM_PROVIDER === 'claude') {\n $result = claude_chat($systemPrompt, $history, $userMessage);\n }\n if ($result === false || $result === null || trim((string)$result) === '') {\n return $STRINGS['llm_error'][$lang] ?? \"Sorry, could not process your request.\";\n }\n return $result;\n}\n\nfunction gemini_chat($systemPrompt, $history, $userMessage) {\n $contents = [];\n foreach ($history as $h) {\n $contents[] = [\n \"role\" => $h['role'] === 'assistant' ? 'model' : 'user',\n \"parts\" => [[\"text\" => $h['message']]]\n ];\n }\n $contents[] = [\"role\" => \"user\", \"parts\" => [[\"text\" => $userMessage]]];\n\n $payload = [\n \"system_instruction\" => [\"parts\" => [[\"text\" => $systemPrompt]]],\n \"contents\" => $contents\n ];\n\n $url = \"https://generativelanguage.googleapis.com/v1/models/gemini-3.1-flash-lite:generateContent?key=\" . GEMINI_API_KEY;\n $resp = llm_curl_post($url, [\"Content-Type: application/json\"], $payload);\n if ($resp === false) return false;\n return $resp['candidates'][0]['content']['parts'][0]['text'] ?? false;\n}\n\nfunction deepseek_chat($systemPrompt, $history, $userMessage) {\n $messages = [[\"role\" => \"system\", \"content\" => $systemPrompt]];\n foreach ($history as $h) {\n $messages[] = [\"role\" => $h['role'], \"content\" => $h['message']];\n }\n $messages[] = [\"role\" => \"user\", \"content\" => $userMessage];\n $payload = [\n \"model\" => \"deepseek-v4-pro\",\n \"messages\" => $messages\n ];\n $headers = [\n \"Authorization: Bearer \" . DEEPSEEK_API_KEY,\n \"Content-Type: application/json\"\n ];\n $resp = llm_curl_post(\"https://api.deepseek.com/chat/completions\", $headers, $payload);\n if ($resp === false) return false;\n return $resp['choices'][0]['message']['content'] ?? false;\n}\n\nfunction claude_chat($systemPrompt, $history, $userMessage) {\n $messages = [];\n foreach ($history as $h) {\n $messages[] = [\n \"role\" => $h['role'] === 'assistant' ? 'assistant' : 'user',\n \"content\" => $h['message']\n ];\n }\n $messages[] = [\"role\" => \"user\", \"content\" => $userMessage];\n $payload = [\n \"model\" => \"claude-haiku-4-5-20251001\",\n \"max_tokens\" => 1024,\n \"system\" => $systemPrompt,\n \"messages\" => $messages\n ];\n $headers = [\n \"x-api-key: \" . CLAUDE_API_KEY,\n \"anthropic-version: 2023-06-01\",\n \"Content-Type: application/json\"\n ];\n $resp = llm_curl_post(\"https://api.anthropic.com/v1/messages\", $headers, $payload);\n if ($resp === false) return false;\n return $resp['content'][0]['text'] ?? false;\n}\n"}}}} |