initialize(); $cfg = (array) config('prescription_ai'); $endpoint = (new ReflectionMethod(\app\common\service\DifyChatService::class, 'buildEndpoint'))->invoke(null, $cfg['base_url'], 'parameters'); $out = []; foreach (['qwen', 'openai'] as $model) { $curl = curl_init($endpoint); curl_setopt_array($curl, [CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 15, CURLOPT_CONNECTTIMEOUT => 5, CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $cfg['models'][$model]['api_key']]]); $body = curl_exec($curl); $status = curl_getinfo($curl, CURLINFO_HTTP_CODE); $decoded = is_string($body) ? json_decode($body, true) : []; $files = (array) ($decoded['file_upload'] ?? []); $image = (array) ($files['image'] ?? []); $out[$model] = ['http_code' => $status, 'curl_errno' => curl_errno($curl), 'files' => array_intersect_key($files, array_flip(['enabled', 'number_limits', 'allowed_file_types', 'allowed_file_extensions', 'allowed_file_upload_methods'])), 'image' => array_intersect_key($image, array_flip(['enabled', 'number_limits', 'transfer_methods']))]; curl_close($curl); } echo json_encode($out, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE), PHP_EOL;