This commit is contained in:
Your Name
2026-10-30 13:41:35 +08:00
parent 28ba9b97f2
commit e2fc30e1f7
69 changed files with 8702 additions and 252 deletions
@@ -179,6 +179,10 @@ final class DifyRequiredAttachmentUpload
self::check($deadline, $shouldAbort);
$textCheck = ['status' => 'disabled', 'images' => []];
if ($imageSources !== [] && !empty($options['ocr']['enabled'])) {
// Created only after the current authorized source copies/uploads succeeded.
// Never accept a caller-supplied cache scope; existing reuse opt-out disables OCR reuse too.
$options['ocr']['_cache_scope'] = !empty($options['reuse_uploaded_files'])
? hash_hmac('sha256', serialize(['clinical-ocr-v1', $endpoint, $user]), $apiKey) : null;
$ocrStarted = microtime(true);
try { $textCheck = self::optionalImageText($imageSources, $tempRoot, $deadline, $shouldAbort, $options); }
finally { $timing['ocr_ms'] += max(0, (int) round((microtime(true) - $ocrStarted) * 1000)); }