更新
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
// Read-only: exercise actual permission-aware endpoints, print only public progress metadata.
|
||||
$root = dirname(__DIR__, 2) . '/server/';
|
||||
chdir($root);
|
||||
require $root . 'vendor/autoload.php';
|
||||
$app = new \think\App($root);
|
||||
$app->initialize();
|
||||
use think\facade\Db;
|
||||
use app\adminapi\logic\tcm\PrescriptionAiLogic as Api;
|
||||
use app\common\service\prescriptionai\PrescriptionAiAccess as Access;
|
||||
try {
|
||||
$batchId = (int) Db::name('prescription_ai_subject')->where('prescription_id', 7556)->value('latest_batch_id');
|
||||
$batch = Db::name('prescription_ai_batch')->where('id', $batchId)->find();
|
||||
$actor = (int) $batch['actor_id'];
|
||||
$info = Access::actor($actor);
|
||||
$started = microtime(true);
|
||||
$statuses = Api::statuses([7556], $actor, $info);
|
||||
$statusMs = round((microtime(true) - $started) * 1000, 1);
|
||||
$started = microtime(true);
|
||||
$detail = Api::detail($batchId, $actor, $info);
|
||||
$detailMs = round((microtime(true) - $started) * 1000, 1);
|
||||
$models = [];
|
||||
foreach ($detail['models'] ?? [] as $key => $model) {
|
||||
$models[$key] = ['status' => $model['status'], 'error_code' => $model['error_code'], 'progress' => $model['progress'] ?? null];
|
||||
}
|
||||
$out = ['time' => date('c'), 'batch_id' => $batchId, 'batch_status' => $detail['status'], 'models' => $models,
|
||||
'list_has_progress' => isset($statuses['items'][0]['progress']),
|
||||
'list_milliseconds' => $statusMs, 'detail_milliseconds' => $detailMs];
|
||||
echo json_encode($out, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE), PHP_EOL;
|
||||
} catch (Throwable $e) {
|
||||
echo json_encode(['error' => get_class($e), 'code' => $e->getCode()]), PHP_EOL;
|
||||
exit(1);
|
||||
}
|
||||
Reference in New Issue
Block a user