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"。 示例: "帮我记一下今天的血压,高压128低压85" → {"intent":"indicator"} "我今天有点头疼,想记录一下" → {"intent":"symptom"} "刚买了一盒降压药,拍一下存进去" → {"intent":"medication"} "今天睡得不错,写个日记" → {"intent":"diary"} "把这份体检报告存档" → {"intent":"archive"} "每天早上八点提醒我量血压" → {"intent":"reminder"} "整理一份给医生看的健康总结" → {"intent":"export"} 现在判断下面这句话,只输出 JSON。/no_think 用户的话:{{TEXT}} """# }