32 lines
1.9 KiB
PHP
32 lines
1.9 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
// Evaluate only the config file with a fixture lookup. Never bootstrap ThinkPHP or read .env.
|
|
$rxConfigEnvironment = [];
|
|
function env(string $key, $default = null)
|
|
{
|
|
return $GLOBALS['rxConfigEnvironment'][$key] ?? $default;
|
|
}
|
|
function rxConfigExpect(bool $condition, string $message): void
|
|
{
|
|
if (!$condition) {
|
|
throw new RuntimeException($message);
|
|
}
|
|
}
|
|
$path = dirname(__DIR__) . '/config/prescription_ai.php';
|
|
$defaults = require $path;
|
|
rxConfigExpect($defaults['manual_analysis']['input_token_budget'] === 48000, 'default staged input budget is available in runtime config');
|
|
rxConfigExpect($defaults['manual_analysis']['max_calls_per_model'] === 128, 'default independent model call budget is available in runtime config');
|
|
rxConfigExpect($defaults['manual_analysis']['request_timeout'] === 240 && $defaults['timeout'] === 90,
|
|
'background analysis has its own request timeout and does not change the interactive one');
|
|
rxConfigExpect($defaults['manual_analysis']['require_candidate'] === true && $defaults['manual_analysis']['candidate_insist_rounds'] === 2,
|
|
'research comparison requires an independent candidate by default');
|
|
$rxConfigEnvironment = ['prescription_ai.MANUAL_INPUT_TOKEN_BUDGET' => '18000', 'prescription_ai.MANUAL_MAX_CALLS_PER_MODEL' => '36',
|
|
'prescription_ai.MANUAL_REQUEST_TIMEOUT' => '180', 'prescription_ai.MANUAL_REQUIRE_CANDIDATE' => 'false'];
|
|
$configured = require $path;
|
|
rxConfigExpect($configured['manual_analysis']['input_token_budget'] === 18000 && $configured['manual_analysis']['max_calls_per_model'] === 36, 'explicit staged model limits override defaults without a code edit');
|
|
rxConfigExpect($configured['manual_analysis']['request_timeout'] === 180 && $configured['manual_analysis']['require_candidate'] === false,
|
|
'timeout and withholding policy stay configurable without a code edit');
|
|
echo "PrescriptionAiConfigurationTest passed\n";
|