根据提供的code differences信息,由于没有具体的代码变更内容,我将生成一个通用的commit message模板:
``` docs(readme): 更新文档说明 - 添加了项目使用指南 - 完善了API接口说明 - 修正了一些文字错误 ``` 注:由于未提供具体的代码差异信息,以上为示例格式。请提供具体的代码变更内容以便生成准确的commit message。
This commit is contained in:
@@ -316,12 +316,13 @@ struct MedicationScanFlow: View {
|
||||
return (items, items.isEmpty ? String(appLoc: "没读出药品,可以手动填写") : nil)
|
||||
} catch CaptureError.modelNotReady {
|
||||
return ([], String(appLoc: "AI 模型未就绪,可以手动填写"))
|
||||
} catch let CaptureError.parseFailed(msg) {
|
||||
return ([], String(appLoc: "解析失败:\(msg)"))
|
||||
} catch let CaptureError.inferenceFailed(msg) {
|
||||
return ([], String(appLoc: "识别失败:\(msg)"))
|
||||
} catch CaptureError.parseFailed {
|
||||
// 已回退手动录入,给用户友好提示;技术细节留在 DEBUG 日志,不抛到屏幕。
|
||||
return ([], String(appLoc: "没认出药品信息,可检查照片清晰度后重拍,或手动填写"))
|
||||
} catch CaptureError.inferenceFailed {
|
||||
return ([], String(appLoc: "识别没成功,可重拍或手动填写"))
|
||||
} catch {
|
||||
return ([], String(appLoc: "未知错误:\(error.localizedDescription)"))
|
||||
return ([], String(appLoc: "识别没成功,可重拍或手动填写"))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -354,9 +355,13 @@ enum MedicationArchiver {
|
||||
// 原图写加密 Vault(§5/§6:落 Application Support/Vault,目录级硬件加密)。
|
||||
// 多药共享同批原图时只挂「第一条新建的药」,避免同一 JPEG 被多个 Asset 引用、
|
||||
// 删一条 cascade 误删另一条还在用的文件。
|
||||
// 逐张包 autoreleasepool:让每张的 JPEG Data / 临时位图在下一张编码前就回收,
|
||||
// 压住连续编码 5 张的瞬时内存峰值(这是离散保存动作,不与推理叠加,留在主线程可接受)。
|
||||
let savedAssets = images
|
||||
.prefix(MedicationScanFlow.maxImages)
|
||||
.compactMap { try? FileVault.shared.writeJPEG($0) }
|
||||
.compactMap { img in
|
||||
autoreleasepool { try? FileVault.shared.writeJPEG(img) }
|
||||
}
|
||||
|
||||
let existing = (try? ctx.fetch(FetchDescriptor<Medication>())) ?? []
|
||||
var attachedImages = false
|
||||
|
||||
Reference in New Issue
Block a user