diff --git a/ai/config.php b/ai/config.php index d28308b..c0b47b8 100644 --- a/ai/config.php +++ b/ai/config.php @@ -5,15 +5,15 @@ function get_ai_env($key) { $val = getenv($key); if ($val !== false && $val !== '') { - error_log("get_ai_env: $key from getenv: " . $val); + error_log("get_ai_env: $key from getenv: " . substr($val, 0, 5) . "..."); return $val; } if (isset($_ENV[$key]) && $_ENV[$key] !== '') { - error_log("get_ai_env: $key from \$_ENV: " . $_ENV[$key]); + error_log("get_ai_env: $key from \$_ENV: " . substr($_ENV[$key], 0, 5) . "..."); return $_ENV[$key]; } if (isset($_SERVER[$key]) && $_SERVER[$key] !== '') { - error_log("get_ai_env: $key from \$_SERVER: " . $_SERVER[$key]); + error_log("get_ai_env: $key from \$_SERVER: " . substr($_SERVER[$key], 0, 5) . "..."); return $_SERVER[$key]; } error_log("get_ai_env: $key not found in environment"); @@ -40,7 +40,7 @@ if (!$projectUuid || !$projectId) { if ($env) { if (!$projectUuid && !empty($env['PROJECT_UUID'])) { $projectUuid = $env['PROJECT_UUID']; - error_log("Found PROJECT_UUID in $path: " . $projectUuid); + error_log("Found PROJECT_UUID in $path: " . substr($projectUuid, 0, 5) . "..."); } if (!$projectId && !empty($env['PROJECT_ID'])) { $projectId = $env['PROJECT_ID']; @@ -54,6 +54,8 @@ if (!$projectUuid || !$projectId) { } if ($projectUuid && $projectId) break; } +} else { + error_log("PROJECT_UUID and PROJECT_ID found in environment immediately."); } $baseUrl = 'https://flatlogic.com'; diff --git a/debug.log b/debug.log index 5dcb483..0234038 100644 --- a/debug.log +++ b/debug.log @@ -108,3 +108,6 @@ 2026-03-19 18:15:13 - Items case hit 2026-03-19 21:18:34 - Items case hit 2026-03-19 21:18:52 - Items case hit +2026-03-20 04:58:13 - Test write from web server +2026-03-20 09:01:08 - Requesting AI. UUID: [e1f9b5b3-fcef-4c8d-87d2-8630b1f72491] CFG: {"base_url":"https:\/\/flatlogic.com","responses_path":"\/projects\/38471\/ai-request","project_id":"38471","project_uuid":"e1f9b5b3-fcef-4c8d-87d2-8630b1f72491","project_header":"Project-UUID","default_model":"gpt-4o-mini","timeout":30,"verify_tls":true} +2026-03-20 09:01:47 - Requesting AI. UUID: [e1f9b5b3-fcef-4c8d-87d2-8630b1f72491] CFG: {"base_url":"https:\/\/flatlogic.com","responses_path":"\/projects\/38471\/ai-request","project_id":"38471","project_uuid":"e1f9b5b3-fcef-4c8d-87d2-8630b1f72491","project_header":"Project-UUID","default_model":"gpt-4o-mini","timeout":30,"verify_tls":true} diff --git a/index.php b/index.php index 0adb9a2..39abdf2 100644 --- a/index.php +++ b/index.php @@ -48,10 +48,10 @@ if (isset($_GET['action']) && $_GET['action'] === 'download_items_template') { if ($_SERVER['REQUEST_METHOD'] === 'POST') { file_put_contents('post_debug.log', date('Y-m-d H:i:s') . " - POST: " . json_encode($_POST) . "\n", FILE_APPEND); } -require_once 'db/config.php'; -require_once 'includes/SimpleXLSX.php'; -require_once 'includes/stock_helper.php'; -require_once 'db/BackupService.php'; +require_once __DIR__ . '/db/config.php'; +require_once __DIR__ . '/includes/SimpleXLSX.php'; +require_once __DIR__ . '/includes/stock_helper.php'; +require_once __DIR__ . '/db/BackupService.php'; // Helper for current outlet if (!function_exists('current_outlet_id')) { @@ -6926,9 +6926,9 @@ $projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? 'Accounting System';