feat: 添加拍药盒功能和语音直达入口

- 实现拍药盒扫描流程,支持本地OCR识别药品信息
- 在日记页面添加拍药盒和记症状的三选一入口
- 优化按钮点击区域,确保符合苹果HIG最小命中区标准
- 添加用药记录到时间线的独立分类显示
- 实现长按+号语音直达功能,支持语音意图分类跳转
- 更新项目配置文件,启用代码分析和死代码剥离选项
- 增加多项本地化字符串支持新功能
```
This commit is contained in:
link2026
2026-06-13 09:16:25 +08:00
parent f58d6064ba
commit 6c6a950140
30 changed files with 1856 additions and 64 deletions

View File

@@ -0,0 +1,43 @@
import Foundation
/// + prompt: LLM(MNN/SME2 )
/// : JSON `{"intent":""}`;/ VoiceIntentService 退(§3.2)
nonisolated enum IntentPrompts {
static func classify(_ utterance: String) -> String {
classifyTemplate.replacingOccurrences(of: "{{TEXT}}", with: String(utterance.prefix(120)))
}
private static let classifyTemplate: String = #"""
你是健康 App 的语音意图分类器。用户长按「新建」按钮说了一句话,判断 ta 想打开哪个功能。
请只输出一段合法 JSON,格式 {"intent":"<>"},不要解释、不要 markdown 围栏、不要任何前后缀文字。
分类(只能选下面其中一个):
- "diary" 写日记,记录今天的感受、饮食、睡眠、身体状态
- "medication" 记录用药、拍药盒、吃了什么药
- "symptom" 记录症状,哪里不舒服(头疼、咳嗽、发烧、头晕…)
- "indicator" 记录指标数值(血压、血糖、体重、心率、体温…)
- "archive" 归档整份体检报告/化验单(拍报告存档)
- "export" 生成给医生看的身体档案/健康总结
- "reminder" 设置周期提醒
- "unknown" 无法判断
规则:
- 说到「提醒我…」一律 "reminder",即使内容涉及吃药或量血压。
- 只是陈述吃了什么药 → "medication";只是陈述哪里不舒服 → "symptom"
- 既像日记又提到具体数值时,以数值为准 → "indicator"
示例:
",12885" → {"intent":"indicator"}
"," → {"intent":"symptom"}
"," → {"intent":"medication"}
"," → {"intent":"diary"}
"" → {"intent":"archive"}
"" → {"intent":"reminder"}
"" → {"intent":"export"}
现在判断下面这句话,只输出 JSON。/no_think
用户的话:{{TEXT}}
"""#
}