更新
This commit is contained in:
@@ -5,6 +5,8 @@ declare(strict_types=1);
|
||||
namespace app\adminapi\logic\tcm;
|
||||
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\service\NihaixiaClinicalSkill;
|
||||
use app\common\service\TcmAncientBooksReference;
|
||||
use app\common\service\prescriptionai\PrescriptionAiAccess as Access;
|
||||
use app\common\service\prescriptionai\PrescriptionAiCipher as Cipher;
|
||||
use app\common\service\prescriptionai\PrescriptionAiDoctorSnapshot as DoctorSnapshot;
|
||||
@@ -298,6 +300,9 @@ final class PrescriptionAiLogic
|
||||
}
|
||||
foreach ($results as $result) {
|
||||
$body = $full ? (new Cipher())->decrypt($result['body_cipher'], 'result:' . $result['batch_id'] . ':' . $result['model_key']) : [];
|
||||
if ($full) {
|
||||
$body = self::localizeSourceMetadata($body);
|
||||
}
|
||||
unset($result['body_cipher']);
|
||||
$result['score'] = $result['score'] === null ? null : (float) $result['score'];
|
||||
$result['herb_score'] = $result['herb_score'] === null ? null : (float) $result['herb_score'];
|
||||
@@ -321,6 +326,15 @@ final class PrescriptionAiLogic
|
||||
return $map;
|
||||
}
|
||||
|
||||
/** Existing encrypted results may still contain repository links. */
|
||||
private static function localizeSourceMetadata(array $body): array
|
||||
{
|
||||
$body['knowledge_source'] = NihaixiaClinicalSkill::localizeKnowledgeSource($body['knowledge_source'] ?? null);
|
||||
$body['ancient_book_sources'] = TcmAncientBooksReference::localizeSources(
|
||||
is_array($body['ancient_book_sources'] ?? null) ? $body['ancient_book_sources'] : []);
|
||||
return $body;
|
||||
}
|
||||
|
||||
private static function formatBatch(array $batch, array $models, ?array $rx = null): array
|
||||
{
|
||||
$validity = $batch['validity'];
|
||||
|
||||
Reference in New Issue
Block a user