first commit
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
require dirname(__DIR__) . '/vendor/autoload.php';
|
||||
|
||||
$app = new think\App(dirname(__DIR__));
|
||||
$app->initialize();
|
||||
$config = config('prescription_ai') ?: [];
|
||||
|
||||
$checks = [
|
||||
'ENABLE' => array_key_exists('enable', $config),
|
||||
'BASE_URL' => trim((string) ($config['base_url'] ?? '')) !== '',
|
||||
'TIMEOUT' => (int) ($config['timeout'] ?? 0) >= 1
|
||||
&& (int) ($config['timeout'] ?? 0) <= 300,
|
||||
'QWEN_API_KEY' => trim((string) ($config['models']['qwen']['api_key'] ?? '')) !== '',
|
||||
'OPENAI_API_KEY' => trim((string) ($config['models']['openai']['api_key'] ?? '')) !== '',
|
||||
];
|
||||
|
||||
$failed = false;
|
||||
foreach ($checks as $name => $configured) {
|
||||
echo $name . '=' . ($configured ? 'configured' : 'not-configured') . PHP_EOL;
|
||||
$failed = $failed || !$configured;
|
||||
}
|
||||
|
||||
if ($failed) {
|
||||
fwrite(STDERR, "Prescription AI server configuration is incomplete.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
echo "Prescription AI configuration: OK\n";
|
||||
Reference in New Issue
Block a user